##// END OF EJS Templates
Add support for set_trace-like functionality, but with IPython's enhanced...
fperez -
Show More
@@ -1,416 +1,497 b''
1 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 1961 2006-12-05 21:02:40Z vivainio $"""
18 $Id: Debugger.py 2014 2007-01-05 10:36:58Z fperez $"""
19 19
20 20 #*****************************************************************************
21 21 #
22 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 43 import sys
44 44
45 from IPython import PyColorize, ColorANSI
45 from IPython import PyColorize, ColorANSI, ipapi
46 46 from IPython.genutils import Term
47 47 from IPython.excolors import ExceptionColors
48 48
49 49 # See if we can use pydb.
50 50 has_pydb = False
51 51 prompt = 'ipdb>'
52 52 try:
53 53 import pydb
54 54 if hasattr(pydb.pydb, "runl"):
55 55 has_pydb = True
56 56 from pydb import Pdb as OldPdb
57 57 prompt = 'ipydb>'
58 58 except ImportError:
59 59 pass
60 60
61 61 if has_pydb:
62 62 from pydb import Pdb as OldPdb
63 63 else:
64 64 from pdb import Pdb as OldPdb
65 65
66 # Allow the set_trace code to operate outside of an ipython instance, even if
67 # it does so with some limitations. The rest of this support is implemented in
68 # the Tracer constructor.
69 def BdbQuit_excepthook(et,ev,tb):
70 if et==bdb.BdbQuit:
71 print 'Exiting Debugger.'
72 else:
73 ehook.excepthook_ori(et,ev,tb)
74
75 def BdbQuit_IPython_excepthook(self,et,ev,tb):
76 print 'Exiting Debugger.'
77
78 class Tracer(object):
79 """Class for local debugging, similar to pdb.set_trace.
80
81 Instances of this class, when called, behave like pdb.set_trace, but
82 providing IPython's enhanced capabilities.
83
84 This is implemented as a class which must be initialized in your own code
85 and not as a standalone function because we need to detect at runtime
86 whether IPython is already active or not. That detection is done in the
87 constructor, ensuring that this code plays nicely with a running IPython,
88 while functioning acceptably (though with limitations) if outside of it.
89 """
90
91 def __init__(self,colors=None):
92 """Create a local debugger instance.
93
94 :Parameters:
95
96 - `colors` (None): a string containing the name of the color scheme to
97 use, it must be one of IPython's valid color schemes. If not given, the
98 function will default to the current IPython scheme when running inside
99 IPython, and to 'NoColor' otherwise.
100
101 Usage example:
102
103 from IPython.Debugger import Tracer; debug_here = Tracer()
104
105 ... later in your code
106 debug_here() # -> will open up the debugger at that point.
107
108 Once the debugger activates, you can use all of its regular commands to
109 step through code, set breakpoints, etc. See the pdb documentation
110 from the Python standard library for usage details.
111 """
112
113 global __IPYTHON__
114 try:
115 __IPYTHON__
116 except NameError:
117 # Outside of ipython, we set our own exception hook manually
118 __IPYTHON__ = ipapi.get(True,False)
119 BdbQuit_excepthook.excepthook_ori = sys.excepthook
120 sys.excepthook = BdbQuit_excepthook
121 def_colors = 'NoColor'
122 try:
123 # Limited tab completion support
124 import rlcompleter,readline
125 readline.parse_and_bind('tab: complete')
126 except ImportError:
127 pass
128 else:
129 # In ipython, we use its custom exception handler mechanism
130 ip = ipapi.get()
131 def_colors = ip.options.colors
132 ip.set_custom_exc((bdb.BdbQuit,),BdbQuit_IPython_excepthook)
133
134 if colors is None:
135 colors = def_colors
136 self.debugger = Pdb(colors)
137
138 def __call__(self):
139 """Starts an interactive debugger at the point where called.
140
141 This is similar to the pdb.set_trace() function from the std lib, but
142 using IPython's enhanced debugger."""
143
144 self.debugger.set_trace(sys._getframe().f_back)
145
66 146 def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):
67 147 """Make new_fn have old_fn's doc string. This is particularly useful
68 148 for the do_... commands that hook into the help system.
69 149 Adapted from from a comp.lang.python posting
70 150 by Duncan Booth."""
71 151 def wrapper(*args, **kw):
72 152 return new_fn(*args, **kw)
73 153 if old_fn.__doc__:
74 154 wrapper.__doc__ = old_fn.__doc__ + additional_text
75 155 return wrapper
76 156
77 157 def _file_lines(fname):
78 158 """Return the contents of a named file as a list of lines.
79 159
80 160 This function never raises an IOError exception: if the file can't be
81 161 read, it simply returns an empty list."""
82 162
83 163 try:
84 164 outfile = open(fname)
85 165 except IOError:
86 166 return []
87 167 else:
88 168 out = outfile.readlines()
89 169 outfile.close()
90 170 return out
91 171
92 172 class Pdb(OldPdb):
93 173 """Modified Pdb class, does not load readline."""
94 174
95 175 if sys.version[:3] >= '2.5' or has_pydb:
96 176 def __init__(self,color_scheme='NoColor',completekey=None,
97 177 stdin=None, stdout=None):
98 178
99 179 # Parent constructor:
100 180 if has_pydb and completekey is None:
101 181 OldPdb.__init__(self,stdin=stdin,stdout=stdout)
102 182 else:
103 183 OldPdb.__init__(self,completekey,stdin,stdout)
104 184 self.prompt = prompt # The default prompt is '(Pdb)'
105 185
106 186 # IPython changes...
107 187 self.is_pydb = has_pydb
108 188
109 189 if self.is_pydb:
110 190
111 191 # iplib.py's ipalias seems to want pdb's checkline
112 192 # which located in pydb.fn
113 193 import pydb.fns
114 194 self.checkline = lambda filename, lineno: \
115 195 pydb.fns.checkline(self, filename, lineno)
116 196
117 197 self.curframe = None
118 198 self.do_restart = self.new_do_restart
119 199
120 200 self.old_all_completions = __IPYTHON__.Completer.all_completions
121 201 __IPYTHON__.Completer.all_completions=self.all_completions
122 202
123 203 self.do_list = decorate_fn_with_doc(self.list_command_pydb,
124 204 OldPdb.do_list)
125 205 self.do_l = self.do_list
126 206 self.do_frame = decorate_fn_with_doc(self.new_do_frame,
127 207 OldPdb.do_frame)
128 208
129 209 self.aliases = {}
130 210
131 211 # Create color table: we copy the default one from the traceback
132 212 # module and add a few attributes needed for debugging
133 213 self.color_scheme_table = ExceptionColors.copy()
134 214
135 215 # shorthands
136 216 C = ColorANSI.TermColors
137 217 cst = self.color_scheme_table
138 218
139 219 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
140 220 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
141 221
142 222 cst['Linux'].colors.breakpoint_enabled = C.LightRed
143 223 cst['Linux'].colors.breakpoint_disabled = C.Red
144 224
145 225 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
146 226 cst['LightBG'].colors.breakpoint_disabled = C.Red
147 227
148 228 self.set_colors(color_scheme)
149 229
150 230 else:
151 231 # Ugly hack: for Python 2.3-2.4, we can't call the parent constructor,
152 232 # because it binds readline and breaks tab-completion. This means we
153 233 # have to COPY the constructor here.
154 234 def __init__(self,color_scheme='NoColor'):
155 235 bdb.Bdb.__init__(self)
156 236 cmd.Cmd.__init__(self,completekey=None) # don't load readline
157 237 self.prompt = 'ipdb> ' # The default prompt is '(Pdb)'
158 238 self.aliases = {}
159 239
160 240 # These two lines are part of the py2.4 constructor, let's put them
161 241 # unconditionally here as they won't cause any problems in 2.3.
162 242 self.mainpyfile = ''
163 243 self._wait_for_mainpyfile = 0
164 244
165 245 # Read $HOME/.pdbrc and ./.pdbrc
166 246 try:
167 247 self.rcLines = _file_lines(os.path.join(os.environ['HOME'],
168 248 ".pdbrc"))
169 249 except KeyError:
170 250 self.rcLines = []
171 251 self.rcLines.extend(_file_lines(".pdbrc"))
172 252
173 253 # Create color table: we copy the default one from the traceback
174 254 # module and add a few attributes needed for debugging
255 ExceptionColors.set_active_scheme(color_scheme)
175 256 self.color_scheme_table = ExceptionColors.copy()
176 257
177 258 # shorthands
178 259 C = ColorANSI.TermColors
179 260 cst = self.color_scheme_table
180 261
181 262 cst['NoColor'].colors.breakpoint_enabled = C.NoColor
182 263 cst['NoColor'].colors.breakpoint_disabled = C.NoColor
183 264
184 265 cst['Linux'].colors.breakpoint_enabled = C.LightRed
185 266 cst['Linux'].colors.breakpoint_disabled = C.Red
186 267
187 268 cst['LightBG'].colors.breakpoint_enabled = C.LightRed
188 269 cst['LightBG'].colors.breakpoint_disabled = C.Red
189 270
190 271 self.set_colors(color_scheme)
191 272
192 273 def set_colors(self, scheme):
193 274 """Shorthand access to the color table scheme selector method."""
194 275 self.color_scheme_table.set_active_scheme(scheme)
195 276
196 277 def interaction(self, frame, traceback):
197 278 __IPYTHON__.set_completer_frame(frame)
198 279 OldPdb.interaction(self, frame, traceback)
199 280
200 281 def new_do_up(self, arg):
201 282 OldPdb.do_up(self, arg)
202 283 __IPYTHON__.set_completer_frame(self.curframe)
203 284 do_u = do_up = decorate_fn_with_doc(new_do_up, OldPdb.do_up)
204 285
205 286 def new_do_down(self, arg):
206 287 OldPdb.do_down(self, arg)
207 288 __IPYTHON__.set_completer_frame(self.curframe)
208 289
209 290 do_d = do_down = decorate_fn_with_doc(new_do_down, OldPdb.do_down)
210 291
211 292 def new_do_frame(self, arg):
212 293 OldPdb.do_frame(self, arg)
213 294 __IPYTHON__.set_completer_frame(self.curframe)
214 295
215 296 def new_do_quit(self, arg):
216 297
217 298 if hasattr(self, 'old_all_completions'):
218 299 __IPYTHON__.Completer.all_completions=self.old_all_completions
219 300
220 301
221 302 return OldPdb.do_quit(self, arg)
222 303
223 304 do_q = do_quit = decorate_fn_with_doc(new_do_quit, OldPdb.do_quit)
224 305
225 306 def new_do_restart(self, arg):
226 307 """Restart command. In the context of ipython this is exactly the same
227 308 thing as 'quit'."""
228 309 self.msg("Restart doesn't make sense here. Using 'quit' instead.")
229 310 return self.do_quit(arg)
230 311
231 312 def postloop(self):
232 313 __IPYTHON__.set_completer_frame(None)
233 314
234 315 def print_stack_trace(self):
235 316 try:
236 317 for frame_lineno in self.stack:
237 318 self.print_stack_entry(frame_lineno, context = 5)
238 319 except KeyboardInterrupt:
239 320 pass
240 321
241 322 def print_stack_entry(self,frame_lineno,prompt_prefix='\n-> ',
242 323 context = 3):
243 324 frame, lineno = frame_lineno
244 325 print >>Term.cout, self.format_stack_entry(frame_lineno, '', context)
245 326
246 327 def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3):
247 328 import linecache, repr
248 329
249 330 ret = []
250 331
251 332 Colors = self.color_scheme_table.active_colors
252 333 ColorsNormal = Colors.Normal
253 334 tpl_link = '%s%%s%s' % (Colors.filenameEm, ColorsNormal)
254 335 tpl_call = '%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal)
255 336 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
256 337 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line,
257 338 ColorsNormal)
258 339
259 340 frame, lineno = frame_lineno
260 341
261 342 return_value = ''
262 343 if '__return__' in frame.f_locals:
263 344 rv = frame.f_locals['__return__']
264 345 #return_value += '->'
265 346 return_value += repr.repr(rv) + '\n'
266 347 ret.append(return_value)
267 348
268 349 #s = filename + '(' + `lineno` + ')'
269 350 filename = self.canonic(frame.f_code.co_filename)
270 351 link = tpl_link % filename
271 352
272 353 if frame.f_code.co_name:
273 354 func = frame.f_code.co_name
274 355 else:
275 356 func = "<lambda>"
276 357
277 358 call = ''
278 359 if func != '?':
279 360 if '__args__' in frame.f_locals:
280 361 args = repr.repr(frame.f_locals['__args__'])
281 362 else:
282 363 args = '()'
283 364 call = tpl_call % (func, args)
284 365
285 366 # The level info should be generated in the same format pdb uses, to
286 367 # avoid breaking the pdbtrack functionality of python-mode in *emacs.
287 368 ret.append('> %s(%s)%s\n' % (link,lineno,call))
288 369
289 370 start = lineno - 1 - context//2
290 371 lines = linecache.getlines(filename)
291 372 start = max(start, 0)
292 373 start = min(start, len(lines) - context)
293 374 lines = lines[start : start + context]
294 375
295 376 for i,line in enumerate(lines):
296 377 show_arrow = (start + 1 + i == lineno)
297 378 ret.append(self.__format_line(tpl_line_em, filename,
298 379 start + 1 + i, line,
299 380 arrow = show_arrow) )
300 381
301 382 return ''.join(ret)
302 383
303 384 def __format_line(self, tpl_line, filename, lineno, line, arrow = False):
304 385 bp_mark = ""
305 386 bp_mark_color = ""
306 387
307 388 bp = None
308 389 if lineno in self.get_file_breaks(filename):
309 390 bps = self.get_breaks(filename, lineno)
310 391 bp = bps[-1]
311 392
312 393 if bp:
313 394 Colors = self.color_scheme_table.active_colors
314 395 bp_mark = str(bp.number)
315 396 bp_mark_color = Colors.breakpoint_enabled
316 397 if not bp.enabled:
317 398 bp_mark_color = Colors.breakpoint_disabled
318 399
319 400 numbers_width = 7
320 401 if arrow:
321 402 # This is the line with the error
322 403 pad = numbers_width - len(str(lineno)) - len(bp_mark)
323 404 if pad >= 3:
324 405 marker = '-'*(pad-3) + '-> '
325 406 elif pad == 2:
326 407 marker = '> '
327 408 elif pad == 1:
328 409 marker = '>'
329 410 else:
330 411 marker = ''
331 412 num = '%s%s' % (marker, str(lineno))
332 413 line = tpl_line % (bp_mark_color + bp_mark, num, line)
333 414 else:
334 415 num = '%*s' % (numbers_width - len(bp_mark), str(lineno))
335 416 line = tpl_line % (bp_mark_color + bp_mark, num, line)
336 417
337 418 return line
338 419
339 420 def list_command_pydb(self, arg):
340 421 """List command to use if we have a newer pydb installed"""
341 422 filename, first, last = OldPdb.parse_list_cmd(self, arg)
342 423 if filename is not None:
343 424 self.print_list_lines(filename, first, last)
344 425
345 426 def print_list_lines(self, filename, first, last):
346 427 """The printing (as opposed to the parsing part of a 'list'
347 428 command."""
348 429 try:
349 430 Colors = self.color_scheme_table.active_colors
350 431 ColorsNormal = Colors.Normal
351 432 tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal)
352 433 tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal)
353 434 src = []
354 435 for lineno in range(first, last+1):
355 436 line = linecache.getline(filename, lineno)
356 437 if not line:
357 438 break
358 439
359 440 if lineno == self.curframe.f_lineno:
360 441 line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True)
361 442 else:
362 443 line = self.__format_line(tpl_line, filename, lineno, line, arrow = False)
363 444
364 445 src.append(line)
365 446 self.lineno = lineno
366 447
367 448 print >>Term.cout, ''.join(src)
368 449
369 450 except KeyboardInterrupt:
370 451 pass
371 452
372 453 def do_list(self, arg):
373 454 self.lastcmd = 'list'
374 455 last = None
375 456 if arg:
376 457 try:
377 458 x = eval(arg, {}, {})
378 459 if type(x) == type(()):
379 460 first, last = x
380 461 first = int(first)
381 462 last = int(last)
382 463 if last < first:
383 464 # Assume it's a count
384 465 last = first + last
385 466 else:
386 467 first = max(1, int(x) - 5)
387 468 except:
388 469 print '*** Error in argument:', `arg`
389 470 return
390 471 elif self.lineno is None:
391 472 first = max(1, self.curframe.f_lineno - 5)
392 473 else:
393 474 first = self.lineno + 1
394 475 if last is None:
395 476 last = first + 10
396 477 self.print_list_lines(self.curframe.f_code.co_filename, first, last)
397 478
398 479 do_l = do_list
399 480
400 481 def do_pdef(self, arg):
401 482 """The debugger interface to magic_pdef"""
402 483 namespaces = [('Locals', self.curframe.f_locals),
403 484 ('Globals', self.curframe.f_globals)]
404 485 __IPYTHON__.magic_pdef(arg, namespaces=namespaces)
405 486
406 487 def do_pdoc(self, arg):
407 488 """The debugger interface to magic_pdoc"""
408 489 namespaces = [('Locals', self.curframe.f_locals),
409 490 ('Globals', self.curframe.f_globals)]
410 491 __IPYTHON__.magic_pdoc(arg, namespaces=namespaces)
411 492
412 493 def do_pinfo(self, arg):
413 494 """The debugger equivalant of ?obj"""
414 495 namespaces = [('Locals', self.curframe.f_locals),
415 496 ('Globals', self.curframe.f_globals)]
416 497 __IPYTHON__.magic_pinfo("pinfo %s" % arg, namespaces=namespaces)
@@ -1,351 +1,364 b''
1 1 ''' IPython customization API
2 2
3 3 Your one-stop module for configuring & extending ipython
4 4
5 5 The API will probably break when ipython 1.0 is released, but so
6 6 will the other configuration method (rc files).
7 7
8 8 All names prefixed by underscores are for internal use, not part
9 9 of the public api.
10 10
11 11 Below is an example that you can just put to a module and import from ipython.
12 12
13 13 A good practice is to install the config script below as e.g.
14 14
15 15 ~/.ipython/my_private_conf.py
16 16
17 17 And do
18 18
19 19 import_mod my_private_conf
20 20
21 21 in ~/.ipython/ipythonrc
22 22
23 23 That way the module is imported at startup and you can have all your
24 24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
25 25 stuff) in there.
26 26
27 27 -----------------------------------------------
28 28 import IPython.ipapi
29 29 ip = IPython.ipapi.get()
30 30
31 31 def ankka_f(self, arg):
32 32 print "Ankka",self,"says uppercase:",arg.upper()
33 33
34 34 ip.expose_magic("ankka",ankka_f)
35 35
36 36 ip.magic('alias sayhi echo "Testing, hi ok"')
37 37 ip.magic('alias helloworld echo "Hello world"')
38 38 ip.system('pwd')
39 39
40 40 ip.ex('import re')
41 41 ip.ex("""
42 42 def funcci(a,b):
43 43 print a+b
44 44 print funcci(3,4)
45 45 """)
46 46 ip.ex("funcci(348,9)")
47 47
48 48 def jed_editor(self,filename, linenum=None):
49 49 print "Calling my own editor, jed ... via hook!"
50 50 import os
51 51 if linenum is None: linenum = 0
52 52 os.system('jed +%d %s' % (linenum, filename))
53 53 print "exiting jed"
54 54
55 55 ip.set_hook('editor',jed_editor)
56 56
57 57 o = ip.options
58 58 o.autocall = 2 # FULL autocall mode
59 59
60 60 print "done!"
61 61 '''
62 62
63 63 # stdlib imports
64 64 import __builtin__
65 65 import sys
66 66
67 67 # our own
68 68 from IPython.genutils import warn,error
69 69
70 70 class TryNext(Exception):
71 71 """Try next hook exception.
72 72
73 73 Raise this in your hook function to indicate that the next hook handler
74 74 should be used to handle the operation. If you pass arguments to the
75 75 constructor those arguments will be used by the next hook instead of the
76 76 original ones.
77 77 """
78 78
79 79 def __init__(self, *args, **kwargs):
80 80 self.args = args
81 81 self.kwargs = kwargs
82 82
83 83 # contains the most recently instantiated IPApi
84 84
85 85 class IPythonNotRunning:
86 86 """Dummy do-nothing class.
87 87
88 88 Instances of this class return a dummy attribute on all accesses, which
89 89 can be called and warns. This makes it easier to write scripts which use
90 90 the ipapi.get() object for informational purposes to operate both with and
91 91 without ipython. Obviously code which uses the ipython object for
92 92 computations will not work, but this allows a wider range of code to
93 93 transparently work whether ipython is being used or not."""
94
95 def __init__(self,warn=True):
96 if warn:
97 self.dummy = self._dummy_warn
98 else:
99 self.dummy = self._dummy_silent
94 100
95 101 def __str__(self):
96 102 return "<IPythonNotRunning>"
97 103
98 104 __repr__ = __str__
99 105
100 106 def __getattr__(self,name):
101 107 return self.dummy
102 108
103 def dummy(self,*args,**kw):
109 def _dummy_warn(self,*args,**kw):
104 110 """Dummy function, which doesn't do anything but warn."""
111
105 112 warn("IPython is not running, this is a dummy no-op function")
106 113
114 def _dummy_silent(self,*args,**kw):
115 """Dummy function, which doesn't do anything and emits no warnings."""
116 pass
117
107 118 _recent = None
108 119
109 120
110 def get(allow_dummy=False):
121 def get(allow_dummy=False,dummy_warn=True):
111 122 """Get an IPApi object.
112 123
113 124 If allow_dummy is true, returns an instance of IPythonNotRunning
114 125 instead of None if not running under IPython.
115 126
127 If dummy_warn is false, the dummy instance will be completely silent.
128
116 129 Running this should be the first thing you do when writing extensions that
117 130 can be imported as normal modules. You can then direct all the
118 131 configuration operations against the returned object.
119 132 """
120 133 global _recent
121 134 if allow_dummy and not _recent:
122 _recent = IPythonNotRunning()
135 _recent = IPythonNotRunning(dummy_warn)
123 136 return _recent
124 137
125 138 class IPApi:
126 139 """ The actual API class for configuring IPython
127 140
128 141 You should do all of the IPython configuration by getting an IPApi object
129 142 with IPython.ipapi.get() and using the attributes and methods of the
130 143 returned object."""
131 144
132 145 def __init__(self,ip):
133 146
134 147 # All attributes exposed here are considered to be the public API of
135 148 # IPython. As needs dictate, some of these may be wrapped as
136 149 # properties.
137 150
138 151 self.magic = ip.ipmagic
139 152
140 153 self.system = ip.ipsystem
141 154
142 155 self.set_hook = ip.set_hook
143 156
144 157 self.set_custom_exc = ip.set_custom_exc
145 158
146 159 self.user_ns = ip.user_ns
147 160
148 161 self.set_crash_handler = ip.set_crash_handler
149 162
150 163 # Session-specific data store, which can be used to store
151 164 # data that should persist through the ipython session.
152 165 self.meta = ip.meta
153 166
154 167 # The ipython instance provided
155 168 self.IP = ip
156 169
157 170 global _recent
158 171 _recent = self
159 172
160 173 # Use a property for some things which are added to the instance very
161 174 # late. I don't have time right now to disentangle the initialization
162 175 # order issues, so a property lets us delay item extraction while
163 176 # providing a normal attribute API.
164 177 def get_db(self):
165 178 """A handle to persistent dict-like database (a PickleShareDB object)"""
166 179 return self.IP.db
167 180
168 181 db = property(get_db,None,None,get_db.__doc__)
169 182
170 183 def get_options(self):
171 184 """All configurable variables."""
172 185
173 186 # catch typos by disabling new attribute creation. If new attr creation
174 187 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
175 188 # for the received rc struct.
176 189
177 190 self.IP.rc.allow_new_attr(False)
178 191 return self.IP.rc
179 192
180 193 options = property(get_options,None,None,get_options.__doc__)
181 194
182 195 def expose_magic(self,magicname, func):
183 196 ''' Expose own function as magic function for ipython
184 197
185 198 def foo_impl(self,parameter_s=''):
186 199 """My very own magic!. (Use docstrings, IPython reads them)."""
187 200 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
188 201 print 'The self object is:',self
189 202
190 203 ipapi.expose_magic("foo",foo_impl)
191 204 '''
192 205
193 206 import new
194 207 im = new.instancemethod(func,self.IP, self.IP.__class__)
195 208 setattr(self.IP, "magic_" + magicname, im)
196 209
197 210 def ex(self,cmd):
198 211 """ Execute a normal python statement in user namespace """
199 212 exec cmd in self.user_ns
200 213
201 214 def ev(self,expr):
202 215 """ Evaluate python expression expr in user namespace
203 216
204 217 Returns the result of evaluation"""
205 218 return eval(expr,self.user_ns)
206 219
207 220 def runlines(self,lines):
208 221 """ Run the specified lines in interpreter, honoring ipython directives.
209 222
210 223 This allows %magic and !shell escape notations.
211 224
212 225 Takes either all lines in one string or list of lines.
213 226 """
214 227 if isinstance(lines,basestring):
215 228 self.IP.runlines(lines)
216 229 else:
217 230 self.IP.runlines('\n'.join(lines))
218 231
219 232 def to_user_ns(self,vars):
220 233 """Inject a group of variables into the IPython user namespace.
221 234
222 235 Inputs:
223 236
224 237 - vars: string with variable names separated by whitespace
225 238
226 239 This utility routine is meant to ease interactive debugging work,
227 240 where you want to easily propagate some internal variable in your code
228 241 up to the interactive namespace for further exploration.
229 242
230 243 When you run code via %run, globals in your script become visible at
231 244 the interactive prompt, but this doesn't happen for locals inside your
232 245 own functions and methods. Yet when debugging, it is common to want
233 246 to explore some internal variables further at the interactive propmt.
234 247
235 248 Examples:
236 249
237 250 To use this, you first must obtain a handle on the ipython object as
238 251 indicated above, via:
239 252
240 253 import IPython.ipapi
241 254 ip = IPython.ipapi.get()
242 255
243 256 Once this is done, inside a routine foo() where you want to expose
244 257 variables x and y, you do the following:
245 258
246 259 def foo():
247 260 ...
248 261 x = your_computation()
249 262 y = something_else()
250 263
251 264 # This pushes x and y to the interactive prompt immediately, even
252 265 # if this routine crashes on the next line after:
253 266 ip.to_user_ns('x y')
254 267 ...
255 268 # return
256 269
257 270 If you need to rename variables, just use ip.user_ns with dict
258 271 and update:
259 272
260 273 # exposes variables 'foo' as 'x' and 'bar' as 'y' in IPython
261 274 # user namespace
262 275 ip.user_ns.update(dict(x=foo,y=bar))
263 276 """
264 277
265 278 # print 'vars given:',vars # dbg
266 279 # Get the caller's frame to evaluate the given names in
267 280 cf = sys._getframe(1)
268 281
269 282 user_ns = self.user_ns
270 283
271 284 for name in vars.split():
272 285 try:
273 286 user_ns[name] = eval(name,cf.f_globals,cf.f_locals)
274 287 except:
275 288 error('could not get var. %s from %s' %
276 289 (name,cf.f_code.co_name))
277 290
278 291 def expand_alias(self,line):
279 292 """ Expand an alias in the command line
280 293
281 294 Returns the provided command line, possibly with the first word
282 295 (command) translated according to alias expansion rules.
283 296
284 297 [ipython]|16> _ip.expand_aliases("np myfile.txt")
285 298 <16> 'q:/opt/np/notepad++.exe myfile.txt'
286 299 """
287 300
288 301 pre,fn,rest = self.IP.split_user_input(line)
289 302 res = pre + self.IP.expand_aliases(fn,rest)
290 303
291 304
292 305
293 306 def launch_new_instance(user_ns = None):
294 307 """ Make and start a new ipython instance.
295 308
296 309 This can be called even without having an already initialized
297 310 ipython session running.
298 311
299 312 This is also used as the egg entry point for the 'ipython' script.
300 313
301 314 """
302 315 ses = make_session(user_ns)
303 316 ses.mainloop()
304 317
305 318
306 319 def make_user_ns(user_ns = None):
307 320 """Return a valid user interactive namespace.
308 321
309 322 This builds a dict with the minimal information needed to operate as a
310 323 valid IPython user namespace, which you can pass to the various embedding
311 324 classes in ipython.
312 325 """
313 326
314 327 if user_ns is None:
315 328 # Set __name__ to __main__ to better match the behavior of the
316 329 # normal interpreter.
317 330 user_ns = {'__name__' :'__main__',
318 331 '__builtins__' : __builtin__,
319 332 }
320 333 else:
321 334 user_ns.setdefault('__name__','__main__')
322 335 user_ns.setdefault('__builtins__',__builtin__)
323 336
324 337 return user_ns
325 338
326 339
327 340 def make_user_global_ns(ns = None):
328 341 """Return a valid user global namespace.
329 342
330 343 Similar to make_user_ns(), but global namespaces are really only needed in
331 344 embedded applications, where there is a distinction between the user's
332 345 interactive namespace and the global one where ipython is running."""
333 346
334 347 if ns is None: ns = {}
335 348 return ns
336 349
337 350
338 351 def make_session(user_ns = None):
339 352 """Makes, but does not launch an IPython session.
340 353
341 354 Later on you can call obj.mainloop() on the returned object.
342 355
343 356 Inputs:
344 357
345 358 - user_ns(None): a dict to be used as the user's namespace with initial
346 359 data.
347 360
348 361 WARNING: This should *not* be run when a session exists already."""
349 362
350 363 import IPython
351 364 return IPython.Shell.start(user_ns)
@@ -1,2538 +1,2542 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 1977 2006-12-11 16:52:12Z fperez $
9 $Id: iplib.py 2014 2007-01-05 10:36:58Z fperez $
10 10 """
11 11
12 12 #*****************************************************************************
13 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 50 import pydoc
51 51 import re
52 52 import shutil
53 53 import string
54 54 import sys
55 55 import tempfile
56 56 import traceback
57 57 import types
58 58 import pickleshare
59 59 from sets import Set
60 60 from pprint import pprint, pformat
61 61
62 62 # IPython's own modules
63 63 import IPython
64 64 from IPython import OInspect,PyColorize,ultraTB
65 65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 66 from IPython.FakeModule import FakeModule
67 67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 68 from IPython.Logger import Logger
69 69 from IPython.Magic import Magic
70 70 from IPython.Prompts import CachedOutput
71 71 from IPython.ipstruct import Struct
72 72 from IPython.background_jobs import BackgroundJobManager
73 73 from IPython.usage import cmd_line_usage,interactive_usage
74 74 from IPython.genutils import *
75 75 from IPython.strdispatch import StrDispatch
76 76 import IPython.ipapi
77 77
78 78 # Globals
79 79
80 80 # store the builtin raw_input globally, and use this always, in case user code
81 81 # overwrites it (like wx.py.PyShell does)
82 82 raw_input_original = raw_input
83 83
84 84 # compiled regexps for autoindent management
85 85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86 86
87 87
88 88 #****************************************************************************
89 89 # Some utility function definitions
90 90
91 91 ini_spaces_re = re.compile(r'^(\s+)')
92 92
93 93 def num_ini_spaces(strng):
94 94 """Return the number of initial spaces in a string"""
95 95
96 96 ini_spaces = ini_spaces_re.match(strng)
97 97 if ini_spaces:
98 98 return ini_spaces.end()
99 99 else:
100 100 return 0
101 101
102 102 def softspace(file, newvalue):
103 103 """Copied from code.py, to remove the dependency"""
104 104
105 105 oldvalue = 0
106 106 try:
107 107 oldvalue = file.softspace
108 108 except AttributeError:
109 109 pass
110 110 try:
111 111 file.softspace = newvalue
112 112 except (AttributeError, TypeError):
113 113 # "attribute-less object" or "read-only attributes"
114 114 pass
115 115 return oldvalue
116 116
117 117
118 118 #****************************************************************************
119 119 # Local use exceptions
120 120 class SpaceInInput(exceptions.Exception): pass
121 121
122 122
123 123 #****************************************************************************
124 124 # Local use classes
125 125 class Bunch: pass
126 126
127 127 class Undefined: pass
128 128
129 129 class Quitter(object):
130 130 """Simple class to handle exit, similar to Python 2.5's.
131 131
132 132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
133 133 doesn't do (obviously, since it doesn't know about ipython)."""
134 134
135 135 def __init__(self,shell,name):
136 136 self.shell = shell
137 137 self.name = name
138 138
139 139 def __repr__(self):
140 140 return 'Type %s() to exit.' % self.name
141 141 __str__ = __repr__
142 142
143 143 def __call__(self):
144 144 self.shell.exit()
145 145
146 146 class InputList(list):
147 147 """Class to store user input.
148 148
149 149 It's basically a list, but slices return a string instead of a list, thus
150 150 allowing things like (assuming 'In' is an instance):
151 151
152 152 exec In[4:7]
153 153
154 154 or
155 155
156 156 exec In[5:9] + In[14] + In[21:25]"""
157 157
158 158 def __getslice__(self,i,j):
159 159 return ''.join(list.__getslice__(self,i,j))
160 160
161 161 class SyntaxTB(ultraTB.ListTB):
162 162 """Extension which holds some state: the last exception value"""
163 163
164 164 def __init__(self,color_scheme = 'NoColor'):
165 165 ultraTB.ListTB.__init__(self,color_scheme)
166 166 self.last_syntax_error = None
167 167
168 168 def __call__(self, etype, value, elist):
169 169 self.last_syntax_error = value
170 170 ultraTB.ListTB.__call__(self,etype,value,elist)
171 171
172 172 def clear_err_state(self):
173 173 """Return the current error state and clear it"""
174 174 e = self.last_syntax_error
175 175 self.last_syntax_error = None
176 176 return e
177 177
178 178 #****************************************************************************
179 179 # Main IPython class
180 180
181 181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
182 182 # until a full rewrite is made. I've cleaned all cross-class uses of
183 183 # attributes and methods, but too much user code out there relies on the
184 184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
185 185 #
186 186 # But at least now, all the pieces have been separated and we could, in
187 187 # principle, stop using the mixin. This will ease the transition to the
188 188 # chainsaw branch.
189 189
190 190 # For reference, the following is the list of 'self.foo' uses in the Magic
191 191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
192 192 # class, to prevent clashes.
193 193
194 194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 197 # 'self.value']
198 198
199 199 class InteractiveShell(object,Magic):
200 200 """An enhanced console for Python."""
201 201
202 202 # class attribute to indicate whether the class supports threads or not.
203 203 # Subclasses with thread support should override this as needed.
204 204 isthreaded = False
205 205
206 206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
207 207 user_ns = None,user_global_ns=None,banner2='',
208 208 custom_exceptions=((),None),embedded=False):
209 209
210 210 # log system
211 211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212 212
213 213 # some minimal strict typechecks. For some core data structures, I
214 214 # want actual basic python types, not just anything that looks like
215 215 # one. This is especially true for namespaces.
216 216 for ns in (user_ns,user_global_ns):
217 217 if ns is not None and type(ns) != types.DictType:
218 218 raise TypeError,'namespace must be a dictionary'
219 219
220 220 # Job manager (for jobs run as background threads)
221 221 self.jobs = BackgroundJobManager()
222 222
223 223 # Store the actual shell's name
224 224 self.name = name
225 225
226 226 # We need to know whether the instance is meant for embedding, since
227 227 # global/local namespaces need to be handled differently in that case
228 228 self.embedded = embedded
229 229
230 230 # command compiler
231 231 self.compile = codeop.CommandCompiler()
232 232
233 233 # User input buffer
234 234 self.buffer = []
235 235
236 236 # Default name given in compilation of code
237 237 self.filename = '<ipython console>'
238 238
239 239 # Install our own quitter instead of the builtins. For python2.3-2.4,
240 240 # this brings in behavior like 2.5, and for 2.5 it's identical.
241 241 __builtin__.exit = Quitter(self,'exit')
242 242 __builtin__.quit = Quitter(self,'quit')
243 243
244 244 # Make an empty namespace, which extension writers can rely on both
245 245 # existing and NEVER being used by ipython itself. This gives them a
246 246 # convenient location for storing additional information and state
247 247 # their extensions may require, without fear of collisions with other
248 248 # ipython names that may develop later.
249 249 self.meta = Struct()
250 250
251 251 # Create the namespace where the user will operate. user_ns is
252 252 # normally the only one used, and it is passed to the exec calls as
253 253 # the locals argument. But we do carry a user_global_ns namespace
254 254 # given as the exec 'globals' argument, This is useful in embedding
255 255 # situations where the ipython shell opens in a context where the
256 256 # distinction between locals and globals is meaningful.
257 257
258 258 # FIXME. For some strange reason, __builtins__ is showing up at user
259 259 # level as a dict instead of a module. This is a manual fix, but I
260 260 # should really track down where the problem is coming from. Alex
261 261 # Schmolck reported this problem first.
262 262
263 263 # A useful post by Alex Martelli on this topic:
264 264 # Re: inconsistent value from __builtins__
265 265 # Von: Alex Martelli <aleaxit@yahoo.com>
266 266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 267 # Gruppen: comp.lang.python
268 268
269 269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 271 # > <type 'dict'>
272 272 # > >>> print type(__builtins__)
273 273 # > <type 'module'>
274 274 # > Is this difference in return value intentional?
275 275
276 276 # Well, it's documented that '__builtins__' can be either a dictionary
277 277 # or a module, and it's been that way for a long time. Whether it's
278 278 # intentional (or sensible), I don't know. In any case, the idea is
279 279 # that if you need to access the built-in namespace directly, you
280 280 # should start with "import __builtin__" (note, no 's') which will
281 281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282 282
283 283 # These routines return properly built dicts as needed by the rest of
284 284 # the code, and can also be used by extension writers to generate
285 285 # properly initialized namespaces.
286 286 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
288 288
289 289 # Assign namespaces
290 290 # This is the namespace where all normal user variables live
291 291 self.user_ns = user_ns
292 292 # Embedded instances require a separate namespace for globals.
293 293 # Normally this one is unused by non-embedded instances.
294 294 self.user_global_ns = user_global_ns
295 295 # A namespace to keep track of internal data structures to prevent
296 296 # them from cluttering user-visible stuff. Will be updated later
297 297 self.internal_ns = {}
298 298
299 299 # Namespace of system aliases. Each entry in the alias
300 300 # table must be a 2-tuple of the form (N,name), where N is the number
301 301 # of positional arguments of the alias.
302 302 self.alias_table = {}
303 303
304 304 # A table holding all the namespaces IPython deals with, so that
305 305 # introspection facilities can search easily.
306 306 self.ns_table = {'user':user_ns,
307 307 'user_global':user_global_ns,
308 308 'alias':self.alias_table,
309 309 'internal':self.internal_ns,
310 310 'builtin':__builtin__.__dict__
311 311 }
312 312
313 313 # The user namespace MUST have a pointer to the shell itself.
314 314 self.user_ns[name] = self
315 315
316 316 # We need to insert into sys.modules something that looks like a
317 317 # module but which accesses the IPython namespace, for shelve and
318 318 # pickle to work interactively. Normally they rely on getting
319 319 # everything out of __main__, but for embedding purposes each IPython
320 320 # instance has its own private namespace, so we can't go shoving
321 321 # everything into __main__.
322 322
323 323 # note, however, that we should only do this for non-embedded
324 324 # ipythons, which really mimic the __main__.__dict__ with their own
325 325 # namespace. Embedded instances, on the other hand, should not do
326 326 # this because they need to manage the user local/global namespaces
327 327 # only, but they live within a 'normal' __main__ (meaning, they
328 328 # shouldn't overtake the execution environment of the script they're
329 329 # embedded in).
330 330
331 331 if not embedded:
332 332 try:
333 333 main_name = self.user_ns['__name__']
334 334 except KeyError:
335 335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 336 else:
337 337 #print "pickle hack in place" # dbg
338 338 #print 'main_name:',main_name # dbg
339 339 sys.modules[main_name] = FakeModule(self.user_ns)
340 340
341 341 # List of input with multi-line handling.
342 342 # Fill its zero entry, user counter starts at 1
343 343 self.input_hist = InputList(['\n'])
344 344 # This one will hold the 'raw' input history, without any
345 345 # pre-processing. This will allow users to retrieve the input just as
346 346 # it was exactly typed in by the user, with %hist -r.
347 347 self.input_hist_raw = InputList(['\n'])
348 348
349 349 # list of visited directories
350 350 try:
351 351 self.dir_hist = [os.getcwd()]
352 352 except IOError, e:
353 353 self.dir_hist = []
354 354
355 355 # dict of output history
356 356 self.output_hist = {}
357 357
358 358 # dict of things NOT to alias (keywords, builtins and some magics)
359 359 no_alias = {}
360 360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 361 for key in keyword.kwlist + no_alias_magics:
362 362 no_alias[key] = 1
363 363 no_alias.update(__builtin__.__dict__)
364 364 self.no_alias = no_alias
365 365
366 366 # make global variables for user access to these
367 367 self.user_ns['_ih'] = self.input_hist
368 368 self.user_ns['_oh'] = self.output_hist
369 369 self.user_ns['_dh'] = self.dir_hist
370 370
371 371 # user aliases to input and output histories
372 372 self.user_ns['In'] = self.input_hist
373 373 self.user_ns['Out'] = self.output_hist
374 374
375 375 # Object variable to store code object waiting execution. This is
376 376 # used mainly by the multithreaded shells, but it can come in handy in
377 377 # other situations. No need to use a Queue here, since it's a single
378 378 # item which gets cleared once run.
379 379 self.code_to_run = None
380 380
381 381 # escapes for automatic behavior on the command line
382 382 self.ESC_SHELL = '!'
383 383 self.ESC_HELP = '?'
384 384 self.ESC_MAGIC = '%'
385 385 self.ESC_QUOTE = ','
386 386 self.ESC_QUOTE2 = ';'
387 387 self.ESC_PAREN = '/'
388 388
389 389 # And their associated handlers
390 390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 391 self.ESC_QUOTE : self.handle_auto,
392 392 self.ESC_QUOTE2 : self.handle_auto,
393 393 self.ESC_MAGIC : self.handle_magic,
394 394 self.ESC_HELP : self.handle_help,
395 395 self.ESC_SHELL : self.handle_shell_escape,
396 396 }
397 397
398 398 # class initializations
399 399 Magic.__init__(self,self)
400 400
401 401 # Python source parser/formatter for syntax highlighting
402 402 pyformat = PyColorize.Parser().format
403 403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404 404
405 405 # hooks holds pointers used for user-side customizations
406 406 self.hooks = Struct()
407 407
408 408 self.strdispatchers = {}
409 409
410 410 # Set all default hooks, defined in the IPython.hooks module.
411 411 hooks = IPython.hooks
412 412 for hook_name in hooks.__all__:
413 413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 415 #print "bound hook",hook_name
416 416
417 417 # Flag to mark unconditional exit
418 418 self.exit_now = False
419 419
420 420 self.usage_min = """\
421 421 An enhanced console for Python.
422 422 Some of its features are:
423 423 - Readline support if the readline library is present.
424 424 - Tab completion in the local namespace.
425 425 - Logging of input, see command-line options.
426 426 - System shell escape via ! , eg !ls.
427 427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 428 - Keeps track of locally defined variables via %who, %whos.
429 429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 430 """
431 431 if usage: self.usage = usage
432 432 else: self.usage = self.usage_min
433 433
434 434 # Storage
435 435 self.rc = rc # This will hold all configuration information
436 436 self.pager = 'less'
437 437 # temporary files used for various purposes. Deleted at exit.
438 438 self.tempfiles = []
439 439
440 440 # Keep track of readline usage (later set by init_readline)
441 441 self.has_readline = False
442 442
443 443 # template for logfile headers. It gets resolved at runtime by the
444 444 # logstart method.
445 445 self.loghead_tpl = \
446 446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 448 #log# opts = %s
449 449 #log# args = %s
450 450 #log# It is safe to make manual edits below here.
451 451 #log#-----------------------------------------------------------------------
452 452 """
453 453 # for pushd/popd management
454 454 try:
455 455 self.home_dir = get_home_dir()
456 456 except HomeDirError,msg:
457 457 fatal(msg)
458 458
459 459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460 460
461 461 # Functions to call the underlying shell.
462 462
463 463 # The first is similar to os.system, but it doesn't return a value,
464 464 # and it allows interpolation of variables in the user's namespace.
465 465 self.system = lambda cmd: \
466 466 shell(self.var_expand(cmd,depth=2),
467 467 header=self.rc.system_header,
468 468 verbose=self.rc.system_verbose)
469 469
470 470 # These are for getoutput and getoutputerror:
471 471 self.getoutput = lambda cmd: \
472 472 getoutput(self.var_expand(cmd,depth=2),
473 473 header=self.rc.system_header,
474 474 verbose=self.rc.system_verbose)
475 475
476 476 self.getoutputerror = lambda cmd: \
477 477 getoutputerror(self.var_expand(cmd,depth=2),
478 478 header=self.rc.system_header,
479 479 verbose=self.rc.system_verbose)
480 480
481 481 # RegExp for splitting line contents into pre-char//first
482 482 # word-method//rest. For clarity, each group in on one line.
483 483
484 484 # WARNING: update the regexp if the above escapes are changed, as they
485 485 # are hardwired in.
486 486
487 487 # Don't get carried away with trying to make the autocalling catch too
488 488 # much: it's better to be conservative rather than to trigger hidden
489 489 # evals() somewhere and end up causing side effects.
490 490
491 491 self.line_split = re.compile(r'^([\s*,;/])'
492 492 r'([\?\w\.]+\w*\s*)'
493 493 r'(\(?.*$)')
494 494
495 495 # Original re, keep around for a while in case changes break something
496 496 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
497 497 # r'(\s*[\?\w\.]+\w*\s*)'
498 498 # r'(\(?.*$)')
499 499
500 500 # RegExp to identify potential function names
501 501 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
502 502
503 503 # RegExp to exclude strings with this start from autocalling. In
504 504 # particular, all binary operators should be excluded, so that if foo
505 505 # is callable, foo OP bar doesn't become foo(OP bar), which is
506 506 # invalid. The characters '!=()' don't need to be checked for, as the
507 507 # _prefilter routine explicitely does so, to catch direct calls and
508 508 # rebindings of existing names.
509 509
510 510 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
511 511 # it affects the rest of the group in square brackets.
512 512 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
513 513 '|^is |^not |^in |^and |^or ')
514 514
515 515 # try to catch also methods for stuff in lists/tuples/dicts: off
516 516 # (experimental). For this to work, the line_split regexp would need
517 517 # to be modified so it wouldn't break things at '['. That line is
518 518 # nasty enough that I shouldn't change it until I can test it _well_.
519 519 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
520 520
521 521 # keep track of where we started running (mainly for crash post-mortem)
522 522 self.starting_dir = os.getcwd()
523 523
524 524 # Various switches which can be set
525 525 self.CACHELENGTH = 5000 # this is cheap, it's just text
526 526 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
527 527 self.banner2 = banner2
528 528
529 529 # TraceBack handlers:
530 530
531 531 # Syntax error handler.
532 532 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
533 533
534 534 # The interactive one is initialized with an offset, meaning we always
535 535 # want to remove the topmost item in the traceback, which is our own
536 536 # internal code. Valid modes: ['Plain','Context','Verbose']
537 537 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
538 538 color_scheme='NoColor',
539 539 tb_offset = 1)
540 540
541 541 # IPython itself shouldn't crash. This will produce a detailed
542 542 # post-mortem if it does. But we only install the crash handler for
543 543 # non-threaded shells, the threaded ones use a normal verbose reporter
544 544 # and lose the crash handler. This is because exceptions in the main
545 545 # thread (such as in GUI code) propagate directly to sys.excepthook,
546 546 # and there's no point in printing crash dumps for every user exception.
547 547 if self.isthreaded:
548 548 ipCrashHandler = ultraTB.FormattedTB()
549 549 else:
550 550 from IPython import CrashHandler
551 551 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
552 552 self.set_crash_handler(ipCrashHandler)
553 553
554 554 # and add any custom exception handlers the user may have specified
555 555 self.set_custom_exc(*custom_exceptions)
556 556
557 557 # indentation management
558 558 self.autoindent = False
559 559 self.indent_current_nsp = 0
560 560
561 561 # Make some aliases automatically
562 562 # Prepare list of shell aliases to auto-define
563 563 if os.name == 'posix':
564 564 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
565 565 'mv mv -i','rm rm -i','cp cp -i',
566 566 'cat cat','less less','clear clear',
567 567 # a better ls
568 568 'ls ls -F',
569 569 # long ls
570 570 'll ls -lF')
571 571 # Extra ls aliases with color, which need special treatment on BSD
572 572 # variants
573 573 ls_extra = ( # color ls
574 574 'lc ls -F -o --color',
575 575 # ls normal files only
576 576 'lf ls -F -o --color %l | grep ^-',
577 577 # ls symbolic links
578 578 'lk ls -F -o --color %l | grep ^l',
579 579 # directories or links to directories,
580 580 'ldir ls -F -o --color %l | grep /$',
581 581 # things which are executable
582 582 'lx ls -F -o --color %l | grep ^-..x',
583 583 )
584 584 # The BSDs don't ship GNU ls, so they don't understand the
585 585 # --color switch out of the box
586 586 if 'bsd' in sys.platform:
587 587 ls_extra = ( # ls normal files only
588 588 'lf ls -lF | grep ^-',
589 589 # ls symbolic links
590 590 'lk ls -lF | grep ^l',
591 591 # directories or links to directories,
592 592 'ldir ls -lF | grep /$',
593 593 # things which are executable
594 594 'lx ls -lF | grep ^-..x',
595 595 )
596 596 auto_alias = auto_alias + ls_extra
597 597 elif os.name in ['nt','dos']:
598 598 auto_alias = ('dir dir /on', 'ls dir /on',
599 599 'ddir dir /ad /on', 'ldir dir /ad /on',
600 600 'mkdir mkdir','rmdir rmdir','echo echo',
601 601 'ren ren','cls cls','copy copy')
602 602 else:
603 603 auto_alias = ()
604 604 self.auto_alias = [s.split(None,1) for s in auto_alias]
605 605 # Call the actual (public) initializer
606 606 self.init_auto_alias()
607 607
608 608 # Produce a public API instance
609 609 self.api = IPython.ipapi.IPApi(self)
610 610
611 611 # track which builtins we add, so we can clean up later
612 612 self.builtins_added = {}
613 613 # This method will add the necessary builtins for operation, but
614 614 # tracking what it did via the builtins_added dict.
615 615 self.add_builtins()
616 616
617 617 # end __init__
618 618
619 619 def var_expand(self,cmd,depth=0):
620 620 """Expand python variables in a string.
621 621
622 622 The depth argument indicates how many frames above the caller should
623 623 be walked to look for the local namespace where to expand variables.
624 624
625 625 The global namespace for expansion is always the user's interactive
626 626 namespace.
627 627 """
628 628
629 629 return str(ItplNS(cmd.replace('#','\#'),
630 630 self.user_ns, # globals
631 631 # Skip our own frame in searching for locals:
632 632 sys._getframe(depth+1).f_locals # locals
633 633 ))
634 634
635 635 def pre_config_initialization(self):
636 636 """Pre-configuration init method
637 637
638 638 This is called before the configuration files are processed to
639 639 prepare the services the config files might need.
640 640
641 641 self.rc already has reasonable default values at this point.
642 642 """
643 643 rc = self.rc
644 644
645 645 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
646 646
647 647 def post_config_initialization(self):
648 648 """Post configuration init method
649 649
650 650 This is called after the configuration files have been processed to
651 651 'finalize' the initialization."""
652 652
653 653 rc = self.rc
654 654
655 655 # Object inspector
656 656 self.inspector = OInspect.Inspector(OInspect.InspectColors,
657 657 PyColorize.ANSICodeColors,
658 658 'NoColor',
659 659 rc.object_info_string_level)
660 660
661 661 # Load readline proper
662 662 if rc.readline:
663 663 self.init_readline()
664 664
665 665 # local shortcut, this is used a LOT
666 666 self.log = self.logger.log
667 667
668 668 # Initialize cache, set in/out prompts and printing system
669 669 self.outputcache = CachedOutput(self,
670 670 rc.cache_size,
671 671 rc.pprint,
672 672 input_sep = rc.separate_in,
673 673 output_sep = rc.separate_out,
674 674 output_sep2 = rc.separate_out2,
675 675 ps1 = rc.prompt_in1,
676 676 ps2 = rc.prompt_in2,
677 677 ps_out = rc.prompt_out,
678 678 pad_left = rc.prompts_pad_left)
679 679
680 680 # user may have over-ridden the default print hook:
681 681 try:
682 682 self.outputcache.__class__.display = self.hooks.display
683 683 except AttributeError:
684 684 pass
685 685
686 686 # I don't like assigning globally to sys, because it means when
687 687 # embedding instances, each embedded instance overrides the previous
688 688 # choice. But sys.displayhook seems to be called internally by exec,
689 689 # so I don't see a way around it. We first save the original and then
690 690 # overwrite it.
691 691 self.sys_displayhook = sys.displayhook
692 692 sys.displayhook = self.outputcache
693 693
694 694 # Set user colors (don't do it in the constructor above so that it
695 695 # doesn't crash if colors option is invalid)
696 696 self.magic_colors(rc.colors)
697 697
698 698 # Set calling of pdb on exceptions
699 699 self.call_pdb = rc.pdb
700 700
701 701 # Load user aliases
702 702 for alias in rc.alias:
703 703 self.magic_alias(alias)
704 704 self.hooks.late_startup_hook()
705 705
706 706 batchrun = False
707 707 for batchfile in [path(arg) for arg in self.rc.args
708 708 if arg.lower().endswith('.ipy')]:
709 709 if not batchfile.isfile():
710 710 print "No such batch file:", batchfile
711 711 continue
712 712 self.api.runlines(batchfile.text())
713 713 batchrun = True
714 714 if batchrun:
715 715 self.exit_now = True
716 716
717 717 def add_builtins(self):
718 718 """Store ipython references into the builtin namespace.
719 719
720 720 Some parts of ipython operate via builtins injected here, which hold a
721 721 reference to IPython itself."""
722 722
723 723 # TODO: deprecate all except _ip; 'jobs' should be installed
724 724 # by an extension and the rest are under _ip, ipalias is redundant
725 725 builtins_new = dict(__IPYTHON__ = self,
726 726 ip_set_hook = self.set_hook,
727 727 jobs = self.jobs,
728 728 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
729 729 ipalias = wrap_deprecated(self.ipalias),
730 730 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
731 731 _ip = self.api
732 732 )
733 733 for biname,bival in builtins_new.items():
734 734 try:
735 735 # store the orignal value so we can restore it
736 736 self.builtins_added[biname] = __builtin__.__dict__[biname]
737 737 except KeyError:
738 738 # or mark that it wasn't defined, and we'll just delete it at
739 739 # cleanup
740 740 self.builtins_added[biname] = Undefined
741 741 __builtin__.__dict__[biname] = bival
742 742
743 743 # Keep in the builtins a flag for when IPython is active. We set it
744 744 # with setdefault so that multiple nested IPythons don't clobber one
745 745 # another. Each will increase its value by one upon being activated,
746 746 # which also gives us a way to determine the nesting level.
747 747 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
748 748
749 749 def clean_builtins(self):
750 750 """Remove any builtins which might have been added by add_builtins, or
751 751 restore overwritten ones to their previous values."""
752 752 for biname,bival in self.builtins_added.items():
753 753 if bival is Undefined:
754 754 del __builtin__.__dict__[biname]
755 755 else:
756 756 __builtin__.__dict__[biname] = bival
757 757 self.builtins_added.clear()
758 758
759 759 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
760 760 """set_hook(name,hook) -> sets an internal IPython hook.
761 761
762 762 IPython exposes some of its internal API as user-modifiable hooks. By
763 763 adding your function to one of these hooks, you can modify IPython's
764 764 behavior to call at runtime your own routines."""
765 765
766 766 # At some point in the future, this should validate the hook before it
767 767 # accepts it. Probably at least check that the hook takes the number
768 768 # of args it's supposed to.
769 769
770 770 f = new.instancemethod(hook,self,self.__class__)
771 771
772 772 # check if the hook is for strdispatcher first
773 773 if str_key is not None:
774 774 sdp = self.strdispatchers.get(name, StrDispatch())
775 775 sdp.add_s(str_key, f, priority )
776 776 self.strdispatchers[name] = sdp
777 777 return
778 778 if re_key is not None:
779 779 sdp = self.strdispatchers.get(name, StrDispatch())
780 780 sdp.add_re(re.compile(re_key), f, priority )
781 781 self.strdispatchers[name] = sdp
782 782 return
783 783
784 784 dp = getattr(self.hooks, name, None)
785 785 if name not in IPython.hooks.__all__:
786 786 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
787 787 if not dp:
788 788 dp = IPython.hooks.CommandChainDispatcher()
789 789
790 790 try:
791 791 dp.add(f,priority)
792 792 except AttributeError:
793 793 # it was not commandchain, plain old func - replace
794 794 dp = f
795 795
796 796 setattr(self.hooks,name, dp)
797 797
798 798
799 799 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
800 800
801 801 def set_crash_handler(self,crashHandler):
802 802 """Set the IPython crash handler.
803 803
804 804 This must be a callable with a signature suitable for use as
805 805 sys.excepthook."""
806 806
807 807 # Install the given crash handler as the Python exception hook
808 808 sys.excepthook = crashHandler
809 809
810 810 # The instance will store a pointer to this, so that runtime code
811 811 # (such as magics) can access it. This is because during the
812 812 # read-eval loop, it gets temporarily overwritten (to deal with GUI
813 813 # frameworks).
814 814 self.sys_excepthook = sys.excepthook
815 815
816 816
817 817 def set_custom_exc(self,exc_tuple,handler):
818 818 """set_custom_exc(exc_tuple,handler)
819 819
820 820 Set a custom exception handler, which will be called if any of the
821 821 exceptions in exc_tuple occur in the mainloop (specifically, in the
822 822 runcode() method.
823 823
824 824 Inputs:
825 825
826 826 - exc_tuple: a *tuple* of valid exceptions to call the defined
827 827 handler for. It is very important that you use a tuple, and NOT A
828 828 LIST here, because of the way Python's except statement works. If
829 829 you only want to trap a single exception, use a singleton tuple:
830 830
831 831 exc_tuple == (MyCustomException,)
832 832
833 833 - handler: this must be defined as a function with the following
834 834 basic interface: def my_handler(self,etype,value,tb).
835 835
836 836 This will be made into an instance method (via new.instancemethod)
837 837 of IPython itself, and it will be called if any of the exceptions
838 838 listed in the exc_tuple are caught. If the handler is None, an
839 839 internal basic one is used, which just prints basic info.
840 840
841 841 WARNING: by putting in your own exception handler into IPython's main
842 842 execution loop, you run a very good chance of nasty crashes. This
843 843 facility should only be used if you really know what you are doing."""
844 844
845 845 assert type(exc_tuple)==type(()) , \
846 846 "The custom exceptions must be given AS A TUPLE."
847 847
848 848 def dummy_handler(self,etype,value,tb):
849 849 print '*** Simple custom exception handler ***'
850 850 print 'Exception type :',etype
851 851 print 'Exception value:',value
852 852 print 'Traceback :',tb
853 853 print 'Source code :','\n'.join(self.buffer)
854 854
855 855 if handler is None: handler = dummy_handler
856 856
857 857 self.CustomTB = new.instancemethod(handler,self,self.__class__)
858 858 self.custom_exceptions = exc_tuple
859 859
860 860 def set_custom_completer(self,completer,pos=0):
861 861 """set_custom_completer(completer,pos=0)
862 862
863 863 Adds a new custom completer function.
864 864
865 865 The position argument (defaults to 0) is the index in the completers
866 866 list where you want the completer to be inserted."""
867 867
868 868 newcomp = new.instancemethod(completer,self.Completer,
869 869 self.Completer.__class__)
870 870 self.Completer.matchers.insert(pos,newcomp)
871 871
872 872 def _get_call_pdb(self):
873 873 return self._call_pdb
874 874
875 875 def _set_call_pdb(self,val):
876 876
877 877 if val not in (0,1,False,True):
878 878 raise ValueError,'new call_pdb value must be boolean'
879 879
880 880 # store value in instance
881 881 self._call_pdb = val
882 882
883 883 # notify the actual exception handlers
884 884 self.InteractiveTB.call_pdb = val
885 885 if self.isthreaded:
886 886 try:
887 887 self.sys_excepthook.call_pdb = val
888 888 except:
889 889 warn('Failed to activate pdb for threaded exception handler')
890 890
891 891 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
892 892 'Control auto-activation of pdb at exceptions')
893 893
894 894
895 895 # These special functions get installed in the builtin namespace, to
896 896 # provide programmatic (pure python) access to magics, aliases and system
897 897 # calls. This is important for logging, user scripting, and more.
898 898
899 899 # We are basically exposing, via normal python functions, the three
900 900 # mechanisms in which ipython offers special call modes (magics for
901 901 # internal control, aliases for direct system access via pre-selected
902 902 # names, and !cmd for calling arbitrary system commands).
903 903
904 904 def ipmagic(self,arg_s):
905 905 """Call a magic function by name.
906 906
907 907 Input: a string containing the name of the magic function to call and any
908 908 additional arguments to be passed to the magic.
909 909
910 910 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
911 911 prompt:
912 912
913 913 In[1]: %name -opt foo bar
914 914
915 915 To call a magic without arguments, simply use ipmagic('name').
916 916
917 917 This provides a proper Python function to call IPython's magics in any
918 918 valid Python code you can type at the interpreter, including loops and
919 919 compound statements. It is added by IPython to the Python builtin
920 920 namespace upon initialization."""
921 921
922 922 args = arg_s.split(' ',1)
923 923 magic_name = args[0]
924 924 magic_name = magic_name.lstrip(self.ESC_MAGIC)
925 925
926 926 try:
927 927 magic_args = args[1]
928 928 except IndexError:
929 929 magic_args = ''
930 930 fn = getattr(self,'magic_'+magic_name,None)
931 931 if fn is None:
932 932 error("Magic function `%s` not found." % magic_name)
933 933 else:
934 934 magic_args = self.var_expand(magic_args,1)
935 935 return fn(magic_args)
936 936
937 937 def ipalias(self,arg_s):
938 938 """Call an alias by name.
939 939
940 940 Input: a string containing the name of the alias to call and any
941 941 additional arguments to be passed to the magic.
942 942
943 943 ipalias('name -opt foo bar') is equivalent to typing at the ipython
944 944 prompt:
945 945
946 946 In[1]: name -opt foo bar
947 947
948 948 To call an alias without arguments, simply use ipalias('name').
949 949
950 950 This provides a proper Python function to call IPython's aliases in any
951 951 valid Python code you can type at the interpreter, including loops and
952 952 compound statements. It is added by IPython to the Python builtin
953 953 namespace upon initialization."""
954 954
955 955 args = arg_s.split(' ',1)
956 956 alias_name = args[0]
957 957 try:
958 958 alias_args = args[1]
959 959 except IndexError:
960 960 alias_args = ''
961 961 if alias_name in self.alias_table:
962 962 self.call_alias(alias_name,alias_args)
963 963 else:
964 964 error("Alias `%s` not found." % alias_name)
965 965
966 966 def ipsystem(self,arg_s):
967 967 """Make a system call, using IPython."""
968 968
969 969 self.system(arg_s)
970 970
971 971 def complete(self,text):
972 972 """Return a sorted list of all possible completions on text.
973 973
974 974 Inputs:
975 975
976 976 - text: a string of text to be completed on.
977 977
978 978 This is a wrapper around the completion mechanism, similar to what
979 979 readline does at the command line when the TAB key is hit. By
980 980 exposing it as a method, it can be used by other non-readline
981 981 environments (such as GUIs) for text completion.
982 982
983 983 Simple usage example:
984 984
985 985 In [1]: x = 'hello'
986 986
987 987 In [2]: __IP.complete('x.l')
988 988 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
989 989
990 990 complete = self.Completer.complete
991 991 state = 0
992 992 # use a dict so we get unique keys, since ipyhton's multiple
993 993 # completers can return duplicates.
994 994 comps = {}
995 995 while True:
996 996 newcomp = complete(text,state)
997 997 if newcomp is None:
998 998 break
999 999 comps[newcomp] = 1
1000 1000 state += 1
1001 1001 outcomps = comps.keys()
1002 1002 outcomps.sort()
1003 1003 return outcomps
1004 1004
1005 1005 def set_completer_frame(self, frame=None):
1006 1006 if frame:
1007 1007 self.Completer.namespace = frame.f_locals
1008 1008 self.Completer.global_namespace = frame.f_globals
1009 1009 else:
1010 1010 self.Completer.namespace = self.user_ns
1011 1011 self.Completer.global_namespace = self.user_global_ns
1012 1012
1013 1013 def init_auto_alias(self):
1014 1014 """Define some aliases automatically.
1015 1015
1016 1016 These are ALL parameter-less aliases"""
1017 1017
1018 1018 for alias,cmd in self.auto_alias:
1019 1019 self.alias_table[alias] = (0,cmd)
1020 1020
1021 1021 def alias_table_validate(self,verbose=0):
1022 1022 """Update information about the alias table.
1023 1023
1024 1024 In particular, make sure no Python keywords/builtins are in it."""
1025 1025
1026 1026 no_alias = self.no_alias
1027 1027 for k in self.alias_table.keys():
1028 1028 if k in no_alias:
1029 1029 del self.alias_table[k]
1030 1030 if verbose:
1031 1031 print ("Deleting alias <%s>, it's a Python "
1032 1032 "keyword or builtin." % k)
1033 1033
1034 1034 def set_autoindent(self,value=None):
1035 1035 """Set the autoindent flag, checking for readline support.
1036 1036
1037 1037 If called with no arguments, it acts as a toggle."""
1038 1038
1039 1039 if not self.has_readline:
1040 1040 if os.name == 'posix':
1041 1041 warn("The auto-indent feature requires the readline library")
1042 1042 self.autoindent = 0
1043 1043 return
1044 1044 if value is None:
1045 1045 self.autoindent = not self.autoindent
1046 1046 else:
1047 1047 self.autoindent = value
1048 1048
1049 1049 def rc_set_toggle(self,rc_field,value=None):
1050 1050 """Set or toggle a field in IPython's rc config. structure.
1051 1051
1052 1052 If called with no arguments, it acts as a toggle.
1053 1053
1054 1054 If called with a non-existent field, the resulting AttributeError
1055 1055 exception will propagate out."""
1056 1056
1057 1057 rc_val = getattr(self.rc,rc_field)
1058 1058 if value is None:
1059 1059 value = not rc_val
1060 1060 setattr(self.rc,rc_field,value)
1061 1061
1062 1062 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1063 1063 """Install the user configuration directory.
1064 1064
1065 1065 Can be called when running for the first time or to upgrade the user's
1066 1066 .ipython/ directory with the mode parameter. Valid modes are 'install'
1067 1067 and 'upgrade'."""
1068 1068
1069 1069 def wait():
1070 1070 try:
1071 1071 raw_input("Please press <RETURN> to start IPython.")
1072 1072 except EOFError:
1073 1073 print >> Term.cout
1074 1074 print '*'*70
1075 1075
1076 1076 cwd = os.getcwd() # remember where we started
1077 1077 glb = glob.glob
1078 1078 print '*'*70
1079 1079 if mode == 'install':
1080 1080 print \
1081 1081 """Welcome to IPython. I will try to create a personal configuration directory
1082 1082 where you can customize many aspects of IPython's functionality in:\n"""
1083 1083 else:
1084 1084 print 'I am going to upgrade your configuration in:'
1085 1085
1086 1086 print ipythondir
1087 1087
1088 1088 rcdirend = os.path.join('IPython','UserConfig')
1089 1089 cfg = lambda d: os.path.join(d,rcdirend)
1090 1090 try:
1091 1091 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1092 1092 except IOError:
1093 1093 warning = """
1094 1094 Installation error. IPython's directory was not found.
1095 1095
1096 1096 Check the following:
1097 1097
1098 1098 The ipython/IPython directory should be in a directory belonging to your
1099 1099 PYTHONPATH environment variable (that is, it should be in a directory
1100 1100 belonging to sys.path). You can copy it explicitly there or just link to it.
1101 1101
1102 1102 IPython will proceed with builtin defaults.
1103 1103 """
1104 1104 warn(warning)
1105 1105 wait()
1106 1106 return
1107 1107
1108 1108 if mode == 'install':
1109 1109 try:
1110 1110 shutil.copytree(rcdir,ipythondir)
1111 1111 os.chdir(ipythondir)
1112 1112 rc_files = glb("ipythonrc*")
1113 1113 for rc_file in rc_files:
1114 1114 os.rename(rc_file,rc_file+rc_suffix)
1115 1115 except:
1116 1116 warning = """
1117 1117
1118 1118 There was a problem with the installation:
1119 1119 %s
1120 1120 Try to correct it or contact the developers if you think it's a bug.
1121 1121 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1122 1122 warn(warning)
1123 1123 wait()
1124 1124 return
1125 1125
1126 1126 elif mode == 'upgrade':
1127 1127 try:
1128 1128 os.chdir(ipythondir)
1129 1129 except:
1130 1130 print """
1131 1131 Can not upgrade: changing to directory %s failed. Details:
1132 1132 %s
1133 1133 """ % (ipythondir,sys.exc_info()[1])
1134 1134 wait()
1135 1135 return
1136 1136 else:
1137 1137 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1138 1138 for new_full_path in sources:
1139 1139 new_filename = os.path.basename(new_full_path)
1140 1140 if new_filename.startswith('ipythonrc'):
1141 1141 new_filename = new_filename + rc_suffix
1142 1142 # The config directory should only contain files, skip any
1143 1143 # directories which may be there (like CVS)
1144 1144 if os.path.isdir(new_full_path):
1145 1145 continue
1146 1146 if os.path.exists(new_filename):
1147 1147 old_file = new_filename+'.old'
1148 1148 if os.path.exists(old_file):
1149 1149 os.remove(old_file)
1150 1150 os.rename(new_filename,old_file)
1151 1151 shutil.copy(new_full_path,new_filename)
1152 1152 else:
1153 1153 raise ValueError,'unrecognized mode for install:',`mode`
1154 1154
1155 1155 # Fix line-endings to those native to each platform in the config
1156 1156 # directory.
1157 1157 try:
1158 1158 os.chdir(ipythondir)
1159 1159 except:
1160 1160 print """
1161 1161 Problem: changing to directory %s failed.
1162 1162 Details:
1163 1163 %s
1164 1164
1165 1165 Some configuration files may have incorrect line endings. This should not
1166 1166 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1167 1167 wait()
1168 1168 else:
1169 1169 for fname in glb('ipythonrc*'):
1170 1170 try:
1171 1171 native_line_ends(fname,backup=0)
1172 1172 except IOError:
1173 1173 pass
1174 1174
1175 1175 if mode == 'install':
1176 1176 print """
1177 1177 Successful installation!
1178 1178
1179 1179 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1180 1180 IPython manual (there are both HTML and PDF versions supplied with the
1181 1181 distribution) to make sure that your system environment is properly configured
1182 1182 to take advantage of IPython's features.
1183 1183
1184 1184 Important note: the configuration system has changed! The old system is
1185 1185 still in place, but its setting may be partly overridden by the settings in
1186 1186 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1187 1187 if some of the new settings bother you.
1188 1188
1189 1189 """
1190 1190 else:
1191 1191 print """
1192 1192 Successful upgrade!
1193 1193
1194 1194 All files in your directory:
1195 1195 %(ipythondir)s
1196 1196 which would have been overwritten by the upgrade were backed up with a .old
1197 1197 extension. If you had made particular customizations in those files you may
1198 1198 want to merge them back into the new files.""" % locals()
1199 1199 wait()
1200 1200 os.chdir(cwd)
1201 1201 # end user_setup()
1202 1202
1203 1203 def atexit_operations(self):
1204 1204 """This will be executed at the time of exit.
1205 1205
1206 1206 Saving of persistent data should be performed here. """
1207 1207
1208 1208 #print '*** IPython exit cleanup ***' # dbg
1209 1209 # input history
1210 1210 self.savehist()
1211 1211
1212 1212 # Cleanup all tempfiles left around
1213 1213 for tfile in self.tempfiles:
1214 1214 try:
1215 1215 os.unlink(tfile)
1216 1216 except OSError:
1217 1217 pass
1218 1218
1219 1219 # save the "persistent data" catch-all dictionary
1220 1220 self.hooks.shutdown_hook()
1221 1221
1222 1222 def savehist(self):
1223 1223 """Save input history to a file (via readline library)."""
1224 1224 try:
1225 1225 self.readline.write_history_file(self.histfile)
1226 1226 except:
1227 1227 print 'Unable to save IPython command history to file: ' + \
1228 1228 `self.histfile`
1229 1229
1230 1230 def history_saving_wrapper(self, func):
1231 1231 """ Wrap func for readline history saving
1232 1232
1233 1233 Convert func into callable that saves & restores
1234 1234 history around the call """
1235 1235
1236 1236 if not self.has_readline:
1237 1237 return func
1238 1238
1239 1239 def wrapper():
1240 1240 self.savehist()
1241 1241 try:
1242 1242 func()
1243 1243 finally:
1244 1244 readline.read_history_file(self.histfile)
1245 1245 return wrapper
1246 1246
1247 1247
1248 1248 def pre_readline(self):
1249 1249 """readline hook to be used at the start of each line.
1250 1250
1251 1251 Currently it handles auto-indent only."""
1252 1252
1253 1253 #debugx('self.indent_current_nsp','pre_readline:')
1254 1254 self.readline.insert_text(self.indent_current_str())
1255 1255
1256 1256 def init_readline(self):
1257 1257 """Command history completion/saving/reloading."""
1258 1258
1259 1259 import IPython.rlineimpl as readline
1260 1260 if not readline.have_readline:
1261 1261 self.has_readline = 0
1262 1262 self.readline = None
1263 1263 # no point in bugging windows users with this every time:
1264 1264 warn('Readline services not available on this platform.')
1265 1265 else:
1266 1266 sys.modules['readline'] = readline
1267 1267 import atexit
1268 1268 from IPython.completer import IPCompleter
1269 1269 self.Completer = IPCompleter(self,
1270 1270 self.user_ns,
1271 1271 self.user_global_ns,
1272 1272 self.rc.readline_omit__names,
1273 1273 self.alias_table)
1274 1274 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1275 1275 self.strdispatchers['complete_command'] = sdisp
1276 1276 self.Completer.custom_completers = sdisp
1277 1277 # Platform-specific configuration
1278 1278 if os.name == 'nt':
1279 1279 self.readline_startup_hook = readline.set_pre_input_hook
1280 1280 else:
1281 1281 self.readline_startup_hook = readline.set_startup_hook
1282 1282
1283 1283 # Load user's initrc file (readline config)
1284 1284 inputrc_name = os.environ.get('INPUTRC')
1285 1285 if inputrc_name is None:
1286 1286 home_dir = get_home_dir()
1287 1287 if home_dir is not None:
1288 1288 inputrc_name = os.path.join(home_dir,'.inputrc')
1289 1289 if os.path.isfile(inputrc_name):
1290 1290 try:
1291 1291 readline.read_init_file(inputrc_name)
1292 1292 except:
1293 1293 warn('Problems reading readline initialization file <%s>'
1294 1294 % inputrc_name)
1295 1295
1296 1296 self.has_readline = 1
1297 1297 self.readline = readline
1298 1298 # save this in sys so embedded copies can restore it properly
1299 1299 sys.ipcompleter = self.Completer.complete
1300 1300 readline.set_completer(self.Completer.complete)
1301 1301
1302 1302 # Configure readline according to user's prefs
1303 1303 for rlcommand in self.rc.readline_parse_and_bind:
1304 1304 readline.parse_and_bind(rlcommand)
1305 1305
1306 1306 # remove some chars from the delimiters list
1307 1307 delims = readline.get_completer_delims()
1308 1308 delims = delims.translate(string._idmap,
1309 1309 self.rc.readline_remove_delims)
1310 1310 readline.set_completer_delims(delims)
1311 1311 # otherwise we end up with a monster history after a while:
1312 1312 readline.set_history_length(1000)
1313 1313 try:
1314 1314 #print '*** Reading readline history' # dbg
1315 1315 readline.read_history_file(self.histfile)
1316 1316 except IOError:
1317 1317 pass # It doesn't exist yet.
1318 1318
1319 1319 atexit.register(self.atexit_operations)
1320 1320 del atexit
1321 1321
1322 1322 # Configure auto-indent for all platforms
1323 1323 self.set_autoindent(self.rc.autoindent)
1324 1324
1325 1325 def ask_yes_no(self,prompt,default=True):
1326 1326 if self.rc.quiet:
1327 1327 return True
1328 1328 return ask_yes_no(prompt,default)
1329 1329
1330 1330 def _should_recompile(self,e):
1331 1331 """Utility routine for edit_syntax_error"""
1332 1332
1333 1333 if e.filename in ('<ipython console>','<input>','<string>',
1334 1334 '<console>','<BackgroundJob compilation>',
1335 1335 None):
1336 1336
1337 1337 return False
1338 1338 try:
1339 1339 if (self.rc.autoedit_syntax and
1340 1340 not self.ask_yes_no('Return to editor to correct syntax error? '
1341 1341 '[Y/n] ','y')):
1342 1342 return False
1343 1343 except EOFError:
1344 1344 return False
1345 1345
1346 1346 def int0(x):
1347 1347 try:
1348 1348 return int(x)
1349 1349 except TypeError:
1350 1350 return 0
1351 1351 # always pass integer line and offset values to editor hook
1352 1352 self.hooks.fix_error_editor(e.filename,
1353 1353 int0(e.lineno),int0(e.offset),e.msg)
1354 1354 return True
1355 1355
1356 1356 def edit_syntax_error(self):
1357 1357 """The bottom half of the syntax error handler called in the main loop.
1358 1358
1359 1359 Loop until syntax error is fixed or user cancels.
1360 1360 """
1361 1361
1362 1362 while self.SyntaxTB.last_syntax_error:
1363 1363 # copy and clear last_syntax_error
1364 1364 err = self.SyntaxTB.clear_err_state()
1365 1365 if not self._should_recompile(err):
1366 1366 return
1367 1367 try:
1368 1368 # may set last_syntax_error again if a SyntaxError is raised
1369 1369 self.safe_execfile(err.filename,self.user_ns)
1370 1370 except:
1371 1371 self.showtraceback()
1372 1372 else:
1373 1373 try:
1374 1374 f = file(err.filename)
1375 1375 try:
1376 1376 sys.displayhook(f.read())
1377 1377 finally:
1378 1378 f.close()
1379 1379 except:
1380 1380 self.showtraceback()
1381 1381
1382 1382 def showsyntaxerror(self, filename=None):
1383 1383 """Display the syntax error that just occurred.
1384 1384
1385 1385 This doesn't display a stack trace because there isn't one.
1386 1386
1387 1387 If a filename is given, it is stuffed in the exception instead
1388 1388 of what was there before (because Python's parser always uses
1389 1389 "<string>" when reading from a string).
1390 1390 """
1391 1391 etype, value, last_traceback = sys.exc_info()
1392 1392
1393 1393 # See note about these variables in showtraceback() below
1394 1394 sys.last_type = etype
1395 1395 sys.last_value = value
1396 1396 sys.last_traceback = last_traceback
1397 1397
1398 1398 if filename and etype is SyntaxError:
1399 1399 # Work hard to stuff the correct filename in the exception
1400 1400 try:
1401 1401 msg, (dummy_filename, lineno, offset, line) = value
1402 1402 except:
1403 1403 # Not the format we expect; leave it alone
1404 1404 pass
1405 1405 else:
1406 1406 # Stuff in the right filename
1407 1407 try:
1408 1408 # Assume SyntaxError is a class exception
1409 1409 value = SyntaxError(msg, (filename, lineno, offset, line))
1410 1410 except:
1411 1411 # If that failed, assume SyntaxError is a string
1412 1412 value = msg, (filename, lineno, offset, line)
1413 1413 self.SyntaxTB(etype,value,[])
1414 1414
1415 1415 def debugger(self,force=False):
1416 1416 """Call the pydb/pdb debugger.
1417 1417
1418 1418 Keywords:
1419 1419
1420 1420 - force(False): by default, this routine checks the instance call_pdb
1421 1421 flag and does not actually invoke the debugger if the flag is false.
1422 1422 The 'force' option forces the debugger to activate even if the flag
1423 1423 is false.
1424 1424 """
1425 1425
1426 1426 if not (force or self.call_pdb):
1427 1427 return
1428 1428
1429 1429 if not hasattr(sys,'last_traceback'):
1430 1430 error('No traceback has been produced, nothing to debug.')
1431 1431 return
1432 1432
1433 1433 have_pydb = False
1434 1434 # use pydb if available
1435 1435 try:
1436 1436 from pydb import pm
1437 1437 have_pydb = True
1438 1438 except ImportError:
1439 1439 pass
1440 1440 if not have_pydb:
1441 1441 # fallback to our internal debugger
1442 1442 pm = lambda : self.InteractiveTB.debugger(force=True)
1443 1443 self.history_saving_wrapper(pm)()
1444 1444
1445 1445 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1446 1446 """Display the exception that just occurred.
1447 1447
1448 1448 If nothing is known about the exception, this is the method which
1449 1449 should be used throughout the code for presenting user tracebacks,
1450 1450 rather than directly invoking the InteractiveTB object.
1451 1451
1452 1452 A specific showsyntaxerror() also exists, but this method can take
1453 1453 care of calling it if needed, so unless you are explicitly catching a
1454 1454 SyntaxError exception, don't try to analyze the stack manually and
1455 1455 simply call this method."""
1456 1456
1457 1457 # Though this won't be called by syntax errors in the input line,
1458 1458 # there may be SyntaxError cases whith imported code.
1459 1459 if exc_tuple is None:
1460 1460 etype, value, tb = sys.exc_info()
1461 1461 else:
1462 1462 etype, value, tb = exc_tuple
1463
1463 1464 if etype is SyntaxError:
1464 1465 self.showsyntaxerror(filename)
1465 1466 else:
1466 1467 # WARNING: these variables are somewhat deprecated and not
1467 1468 # necessarily safe to use in a threaded environment, but tools
1468 1469 # like pdb depend on their existence, so let's set them. If we
1469 1470 # find problems in the field, we'll need to revisit their use.
1470 1471 sys.last_type = etype
1471 1472 sys.last_value = value
1472 1473 sys.last_traceback = tb
1473
1474 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1475 if self.InteractiveTB.call_pdb and self.has_readline:
1476 # pdb mucks up readline, fix it back
1477 self.readline.set_completer(self.Completer.complete)
1474
1475 if etype in self.custom_exceptions:
1476 self.CustomTB(etype,value,tb)
1477 else:
1478 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1479 if self.InteractiveTB.call_pdb and self.has_readline:
1480 # pdb mucks up readline, fix it back
1481 self.readline.set_completer(self.Completer.complete)
1478 1482
1479 1483 def mainloop(self,banner=None):
1480 1484 """Creates the local namespace and starts the mainloop.
1481 1485
1482 1486 If an optional banner argument is given, it will override the
1483 1487 internally created default banner."""
1484 1488
1485 1489 if self.rc.c: # Emulate Python's -c option
1486 1490 self.exec_init_cmd()
1487 1491 if banner is None:
1488 1492 if not self.rc.banner:
1489 1493 banner = ''
1490 1494 # banner is string? Use it directly!
1491 1495 elif isinstance(self.rc.banner,basestring):
1492 1496 banner = self.rc.banner
1493 1497 else:
1494 1498 banner = self.BANNER+self.banner2
1495 1499
1496 1500 self.interact(banner)
1497 1501
1498 1502 def exec_init_cmd(self):
1499 1503 """Execute a command given at the command line.
1500 1504
1501 1505 This emulates Python's -c option."""
1502 1506
1503 1507 #sys.argv = ['-c']
1504 1508 self.push(self.rc.c)
1505 1509
1506 1510 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1507 1511 """Embeds IPython into a running python program.
1508 1512
1509 1513 Input:
1510 1514
1511 1515 - header: An optional header message can be specified.
1512 1516
1513 1517 - local_ns, global_ns: working namespaces. If given as None, the
1514 1518 IPython-initialized one is updated with __main__.__dict__, so that
1515 1519 program variables become visible but user-specific configuration
1516 1520 remains possible.
1517 1521
1518 1522 - stack_depth: specifies how many levels in the stack to go to
1519 1523 looking for namespaces (when local_ns and global_ns are None). This
1520 1524 allows an intermediate caller to make sure that this function gets
1521 1525 the namespace from the intended level in the stack. By default (0)
1522 1526 it will get its locals and globals from the immediate caller.
1523 1527
1524 1528 Warning: it's possible to use this in a program which is being run by
1525 1529 IPython itself (via %run), but some funny things will happen (a few
1526 1530 globals get overwritten). In the future this will be cleaned up, as
1527 1531 there is no fundamental reason why it can't work perfectly."""
1528 1532
1529 1533 # Get locals and globals from caller
1530 1534 if local_ns is None or global_ns is None:
1531 1535 call_frame = sys._getframe(stack_depth).f_back
1532 1536
1533 1537 if local_ns is None:
1534 1538 local_ns = call_frame.f_locals
1535 1539 if global_ns is None:
1536 1540 global_ns = call_frame.f_globals
1537 1541
1538 1542 # Update namespaces and fire up interpreter
1539 1543
1540 1544 # The global one is easy, we can just throw it in
1541 1545 self.user_global_ns = global_ns
1542 1546
1543 1547 # but the user/local one is tricky: ipython needs it to store internal
1544 1548 # data, but we also need the locals. We'll copy locals in the user
1545 1549 # one, but will track what got copied so we can delete them at exit.
1546 1550 # This is so that a later embedded call doesn't see locals from a
1547 1551 # previous call (which most likely existed in a separate scope).
1548 1552 local_varnames = local_ns.keys()
1549 1553 self.user_ns.update(local_ns)
1550 1554
1551 1555 # Patch for global embedding to make sure that things don't overwrite
1552 1556 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1553 1557 # FIXME. Test this a bit more carefully (the if.. is new)
1554 1558 if local_ns is None and global_ns is None:
1555 1559 self.user_global_ns.update(__main__.__dict__)
1556 1560
1557 1561 # make sure the tab-completer has the correct frame information, so it
1558 1562 # actually completes using the frame's locals/globals
1559 1563 self.set_completer_frame()
1560 1564
1561 1565 # before activating the interactive mode, we need to make sure that
1562 1566 # all names in the builtin namespace needed by ipython point to
1563 1567 # ourselves, and not to other instances.
1564 1568 self.add_builtins()
1565 1569
1566 1570 self.interact(header)
1567 1571
1568 1572 # now, purge out the user namespace from anything we might have added
1569 1573 # from the caller's local namespace
1570 1574 delvar = self.user_ns.pop
1571 1575 for var in local_varnames:
1572 1576 delvar(var,None)
1573 1577 # and clean builtins we may have overridden
1574 1578 self.clean_builtins()
1575 1579
1576 1580 def interact(self, banner=None):
1577 1581 """Closely emulate the interactive Python console.
1578 1582
1579 1583 The optional banner argument specify the banner to print
1580 1584 before the first interaction; by default it prints a banner
1581 1585 similar to the one printed by the real Python interpreter,
1582 1586 followed by the current class name in parentheses (so as not
1583 1587 to confuse this with the real interpreter -- since it's so
1584 1588 close!).
1585 1589
1586 1590 """
1587 1591
1588 1592 if self.exit_now:
1589 1593 # batch run -> do not interact
1590 1594 return
1591 1595 cprt = 'Type "copyright", "credits" or "license" for more information.'
1592 1596 if banner is None:
1593 1597 self.write("Python %s on %s\n%s\n(%s)\n" %
1594 1598 (sys.version, sys.platform, cprt,
1595 1599 self.__class__.__name__))
1596 1600 else:
1597 1601 self.write(banner)
1598 1602
1599 1603 more = 0
1600 1604
1601 1605 # Mark activity in the builtins
1602 1606 __builtin__.__dict__['__IPYTHON__active'] += 1
1603 1607
1604 1608 # exit_now is set by a call to %Exit or %Quit
1605 1609 while not self.exit_now:
1606 1610 if more:
1607 1611 prompt = self.hooks.generate_prompt(True)
1608 1612 if self.autoindent:
1609 1613 self.readline_startup_hook(self.pre_readline)
1610 1614 else:
1611 1615 prompt = self.hooks.generate_prompt(False)
1612 1616 try:
1613 1617 line = self.raw_input(prompt,more)
1614 1618 if self.exit_now:
1615 1619 # quick exit on sys.std[in|out] close
1616 1620 break
1617 1621 if self.autoindent:
1618 1622 self.readline_startup_hook(None)
1619 1623 except KeyboardInterrupt:
1620 1624 self.write('\nKeyboardInterrupt\n')
1621 1625 self.resetbuffer()
1622 1626 # keep cache in sync with the prompt counter:
1623 1627 self.outputcache.prompt_count -= 1
1624 1628
1625 1629 if self.autoindent:
1626 1630 self.indent_current_nsp = 0
1627 1631 more = 0
1628 1632 except EOFError:
1629 1633 if self.autoindent:
1630 1634 self.readline_startup_hook(None)
1631 1635 self.write('\n')
1632 1636 self.exit()
1633 1637 except bdb.BdbQuit:
1634 1638 warn('The Python debugger has exited with a BdbQuit exception.\n'
1635 1639 'Because of how pdb handles the stack, it is impossible\n'
1636 1640 'for IPython to properly format this particular exception.\n'
1637 1641 'IPython will resume normal operation.')
1638 1642 except:
1639 1643 # exceptions here are VERY RARE, but they can be triggered
1640 1644 # asynchronously by signal handlers, for example.
1641 1645 self.showtraceback()
1642 1646 else:
1643 1647 more = self.push(line)
1644 1648 if (self.SyntaxTB.last_syntax_error and
1645 1649 self.rc.autoedit_syntax):
1646 1650 self.edit_syntax_error()
1647 1651
1648 1652 # We are off again...
1649 1653 __builtin__.__dict__['__IPYTHON__active'] -= 1
1650 1654
1651 1655 def excepthook(self, etype, value, tb):
1652 1656 """One more defense for GUI apps that call sys.excepthook.
1653 1657
1654 1658 GUI frameworks like wxPython trap exceptions and call
1655 1659 sys.excepthook themselves. I guess this is a feature that
1656 1660 enables them to keep running after exceptions that would
1657 1661 otherwise kill their mainloop. This is a bother for IPython
1658 1662 which excepts to catch all of the program exceptions with a try:
1659 1663 except: statement.
1660 1664
1661 1665 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1662 1666 any app directly invokes sys.excepthook, it will look to the user like
1663 1667 IPython crashed. In order to work around this, we can disable the
1664 1668 CrashHandler and replace it with this excepthook instead, which prints a
1665 1669 regular traceback using our InteractiveTB. In this fashion, apps which
1666 1670 call sys.excepthook will generate a regular-looking exception from
1667 1671 IPython, and the CrashHandler will only be triggered by real IPython
1668 1672 crashes.
1669 1673
1670 1674 This hook should be used sparingly, only in places which are not likely
1671 1675 to be true IPython errors.
1672 1676 """
1673 1677 self.showtraceback((etype,value,tb),tb_offset=0)
1674 1678
1675 1679 def expand_aliases(self,fn,rest):
1676 1680 """ Expand multiple levels of aliases:
1677 1681
1678 1682 if:
1679 1683
1680 1684 alias foo bar /tmp
1681 1685 alias baz foo
1682 1686
1683 1687 then:
1684 1688
1685 1689 baz huhhahhei -> bar /tmp huhhahhei
1686 1690
1687 1691 """
1688 1692 line = fn + " " + rest
1689 1693
1690 1694 done = Set()
1691 1695 while 1:
1692 1696 pre,fn,rest = self.split_user_input(line)
1693 1697 if fn in self.alias_table:
1694 1698 if fn in done:
1695 1699 warn("Cyclic alias definition, repeated '%s'" % fn)
1696 1700 return ""
1697 1701 done.add(fn)
1698 1702
1699 1703 l2 = self.transform_alias(fn,rest)
1700 1704 # dir -> dir
1701 1705 # print "alias",line, "->",l2 #dbg
1702 1706 if l2 == line:
1703 1707 break
1704 1708 # ls -> ls -F should not recurse forever
1705 1709 if l2.split(None,1)[0] == line.split(None,1)[0]:
1706 1710 line = l2
1707 1711 break
1708 1712
1709 1713 line=l2
1710 1714
1711 1715
1712 1716 # print "al expand to",line #dbg
1713 1717 else:
1714 1718 break
1715 1719
1716 1720 return line
1717 1721
1718 1722 def transform_alias(self, alias,rest=''):
1719 1723 """ Transform alias to system command string.
1720 1724 """
1721 1725 nargs,cmd = self.alias_table[alias]
1722 1726 if ' ' in cmd and os.path.isfile(cmd):
1723 1727 cmd = '"%s"' % cmd
1724 1728
1725 1729 # Expand the %l special to be the user's input line
1726 1730 if cmd.find('%l') >= 0:
1727 1731 cmd = cmd.replace('%l',rest)
1728 1732 rest = ''
1729 1733 if nargs==0:
1730 1734 # Simple, argument-less aliases
1731 1735 cmd = '%s %s' % (cmd,rest)
1732 1736 else:
1733 1737 # Handle aliases with positional arguments
1734 1738 args = rest.split(None,nargs)
1735 1739 if len(args)< nargs:
1736 1740 error('Alias <%s> requires %s arguments, %s given.' %
1737 1741 (alias,nargs,len(args)))
1738 1742 return None
1739 1743 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1740 1744 # Now call the macro, evaluating in the user's namespace
1741 1745 #print 'new command: <%r>' % cmd # dbg
1742 1746 return cmd
1743 1747
1744 1748 def call_alias(self,alias,rest=''):
1745 1749 """Call an alias given its name and the rest of the line.
1746 1750
1747 1751 This is only used to provide backwards compatibility for users of
1748 1752 ipalias(), use of which is not recommended for anymore."""
1749 1753
1750 1754 # Now call the macro, evaluating in the user's namespace
1751 1755 cmd = self.transform_alias(alias, rest)
1752 1756 try:
1753 1757 self.system(cmd)
1754 1758 except:
1755 1759 self.showtraceback()
1756 1760
1757 1761 def indent_current_str(self):
1758 1762 """return the current level of indentation as a string"""
1759 1763 return self.indent_current_nsp * ' '
1760 1764
1761 1765 def autoindent_update(self,line):
1762 1766 """Keep track of the indent level."""
1763 1767
1764 1768 #debugx('line')
1765 1769 #debugx('self.indent_current_nsp')
1766 1770 if self.autoindent:
1767 1771 if line:
1768 1772 inisp = num_ini_spaces(line)
1769 1773 if inisp < self.indent_current_nsp:
1770 1774 self.indent_current_nsp = inisp
1771 1775
1772 1776 if line[-1] == ':':
1773 1777 self.indent_current_nsp += 4
1774 1778 elif dedent_re.match(line):
1775 1779 self.indent_current_nsp -= 4
1776 1780 else:
1777 1781 self.indent_current_nsp = 0
1778 1782
1779 1783 def runlines(self,lines):
1780 1784 """Run a string of one or more lines of source.
1781 1785
1782 1786 This method is capable of running a string containing multiple source
1783 1787 lines, as if they had been entered at the IPython prompt. Since it
1784 1788 exposes IPython's processing machinery, the given strings can contain
1785 1789 magic calls (%magic), special shell access (!cmd), etc."""
1786 1790
1787 1791 # We must start with a clean buffer, in case this is run from an
1788 1792 # interactive IPython session (via a magic, for example).
1789 1793 self.resetbuffer()
1790 1794 lines = lines.split('\n')
1791 1795 more = 0
1792 1796 for line in lines:
1793 1797 # skip blank lines so we don't mess up the prompt counter, but do
1794 1798 # NOT skip even a blank line if we are in a code block (more is
1795 1799 # true)
1796 1800 if line or more:
1797 1801 more = self.push(self.prefilter(line,more))
1798 1802 # IPython's runsource returns None if there was an error
1799 1803 # compiling the code. This allows us to stop processing right
1800 1804 # away, so the user gets the error message at the right place.
1801 1805 if more is None:
1802 1806 break
1803 1807 # final newline in case the input didn't have it, so that the code
1804 1808 # actually does get executed
1805 1809 if more:
1806 1810 self.push('\n')
1807 1811
1808 1812 def runsource(self, source, filename='<input>', symbol='single'):
1809 1813 """Compile and run some source in the interpreter.
1810 1814
1811 1815 Arguments are as for compile_command().
1812 1816
1813 1817 One several things can happen:
1814 1818
1815 1819 1) The input is incorrect; compile_command() raised an
1816 1820 exception (SyntaxError or OverflowError). A syntax traceback
1817 1821 will be printed by calling the showsyntaxerror() method.
1818 1822
1819 1823 2) The input is incomplete, and more input is required;
1820 1824 compile_command() returned None. Nothing happens.
1821 1825
1822 1826 3) The input is complete; compile_command() returned a code
1823 1827 object. The code is executed by calling self.runcode() (which
1824 1828 also handles run-time exceptions, except for SystemExit).
1825 1829
1826 1830 The return value is:
1827 1831
1828 1832 - True in case 2
1829 1833
1830 1834 - False in the other cases, unless an exception is raised, where
1831 1835 None is returned instead. This can be used by external callers to
1832 1836 know whether to continue feeding input or not.
1833 1837
1834 1838 The return value can be used to decide whether to use sys.ps1 or
1835 1839 sys.ps2 to prompt the next line."""
1836 1840
1837 1841 # if the source code has leading blanks, add 'if 1:\n' to it
1838 1842 # this allows execution of indented pasted code. It is tempting
1839 1843 # to add '\n' at the end of source to run commands like ' a=1'
1840 1844 # directly, but this fails for more complicated scenarios
1841 1845 if source[:1] in [' ', '\t']:
1842 1846 source = 'if 1:\n%s' % source
1843 1847
1844 1848 try:
1845 1849 code = self.compile(source,filename,symbol)
1846 1850 except (OverflowError, SyntaxError, ValueError):
1847 1851 # Case 1
1848 1852 self.showsyntaxerror(filename)
1849 1853 return None
1850 1854
1851 1855 if code is None:
1852 1856 # Case 2
1853 1857 return True
1854 1858
1855 1859 # Case 3
1856 1860 # We store the code object so that threaded shells and
1857 1861 # custom exception handlers can access all this info if needed.
1858 1862 # The source corresponding to this can be obtained from the
1859 1863 # buffer attribute as '\n'.join(self.buffer).
1860 1864 self.code_to_run = code
1861 1865 # now actually execute the code object
1862 1866 if self.runcode(code) == 0:
1863 1867 return False
1864 1868 else:
1865 1869 return None
1866 1870
1867 1871 def runcode(self,code_obj):
1868 1872 """Execute a code object.
1869 1873
1870 1874 When an exception occurs, self.showtraceback() is called to display a
1871 1875 traceback.
1872 1876
1873 1877 Return value: a flag indicating whether the code to be run completed
1874 1878 successfully:
1875 1879
1876 1880 - 0: successful execution.
1877 1881 - 1: an error occurred.
1878 1882 """
1879 1883
1880 1884 # Set our own excepthook in case the user code tries to call it
1881 1885 # directly, so that the IPython crash handler doesn't get triggered
1882 1886 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1883 1887
1884 1888 # we save the original sys.excepthook in the instance, in case config
1885 1889 # code (such as magics) needs access to it.
1886 1890 self.sys_excepthook = old_excepthook
1887 1891 outflag = 1 # happens in more places, so it's easier as default
1888 1892 try:
1889 1893 try:
1890 1894 # Embedded instances require separate global/local namespaces
1891 1895 # so they can see both the surrounding (local) namespace and
1892 1896 # the module-level globals when called inside another function.
1893 1897 if self.embedded:
1894 1898 exec code_obj in self.user_global_ns, self.user_ns
1895 1899 # Normal (non-embedded) instances should only have a single
1896 1900 # namespace for user code execution, otherwise functions won't
1897 1901 # see interactive top-level globals.
1898 1902 else:
1899 1903 exec code_obj in self.user_ns
1900 1904 finally:
1901 1905 # Reset our crash handler in place
1902 1906 sys.excepthook = old_excepthook
1903 1907 except SystemExit:
1904 1908 self.resetbuffer()
1905 1909 self.showtraceback()
1906 1910 warn("Type %exit or %quit to exit IPython "
1907 1911 "(%Exit or %Quit do so unconditionally).",level=1)
1908 1912 except self.custom_exceptions:
1909 1913 etype,value,tb = sys.exc_info()
1910 1914 self.CustomTB(etype,value,tb)
1911 1915 except:
1912 1916 self.showtraceback()
1913 1917 else:
1914 1918 outflag = 0
1915 1919 if softspace(sys.stdout, 0):
1916 1920 print
1917 1921 # Flush out code object which has been run (and source)
1918 1922 self.code_to_run = None
1919 1923 return outflag
1920 1924
1921 1925 def push(self, line):
1922 1926 """Push a line to the interpreter.
1923 1927
1924 1928 The line should not have a trailing newline; it may have
1925 1929 internal newlines. The line is appended to a buffer and the
1926 1930 interpreter's runsource() method is called with the
1927 1931 concatenated contents of the buffer as source. If this
1928 1932 indicates that the command was executed or invalid, the buffer
1929 1933 is reset; otherwise, the command is incomplete, and the buffer
1930 1934 is left as it was after the line was appended. The return
1931 1935 value is 1 if more input is required, 0 if the line was dealt
1932 1936 with in some way (this is the same as runsource()).
1933 1937 """
1934 1938
1935 1939 # autoindent management should be done here, and not in the
1936 1940 # interactive loop, since that one is only seen by keyboard input. We
1937 1941 # need this done correctly even for code run via runlines (which uses
1938 1942 # push).
1939 1943
1940 1944 #print 'push line: <%s>' % line # dbg
1941 1945 for subline in line.splitlines():
1942 1946 self.autoindent_update(subline)
1943 1947 self.buffer.append(line)
1944 1948 more = self.runsource('\n'.join(self.buffer), self.filename)
1945 1949 if not more:
1946 1950 self.resetbuffer()
1947 1951 return more
1948 1952
1949 1953 def resetbuffer(self):
1950 1954 """Reset the input buffer."""
1951 1955 self.buffer[:] = []
1952 1956
1953 1957 def raw_input(self,prompt='',continue_prompt=False):
1954 1958 """Write a prompt and read a line.
1955 1959
1956 1960 The returned line does not include the trailing newline.
1957 1961 When the user enters the EOF key sequence, EOFError is raised.
1958 1962
1959 1963 Optional inputs:
1960 1964
1961 1965 - prompt(''): a string to be printed to prompt the user.
1962 1966
1963 1967 - continue_prompt(False): whether this line is the first one or a
1964 1968 continuation in a sequence of inputs.
1965 1969 """
1966 1970
1967 1971 try:
1968 1972 line = raw_input_original(prompt)
1969 1973 except ValueError:
1970 1974 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1971 1975 self.exit_now = True
1972 1976 return ""
1973 1977
1974 1978
1975 1979 # Try to be reasonably smart about not re-indenting pasted input more
1976 1980 # than necessary. We do this by trimming out the auto-indent initial
1977 1981 # spaces, if the user's actual input started itself with whitespace.
1978 1982 #debugx('self.buffer[-1]')
1979 1983
1980 1984 if self.autoindent:
1981 1985 if num_ini_spaces(line) > self.indent_current_nsp:
1982 1986 line = line[self.indent_current_nsp:]
1983 1987 self.indent_current_nsp = 0
1984 1988
1985 1989 # store the unfiltered input before the user has any chance to modify
1986 1990 # it.
1987 1991 if line.strip():
1988 1992 if continue_prompt:
1989 1993 self.input_hist_raw[-1] += '%s\n' % line
1990 1994 if self.has_readline: # and some config option is set?
1991 1995 try:
1992 1996 histlen = self.readline.get_current_history_length()
1993 1997 newhist = self.input_hist_raw[-1].rstrip()
1994 1998 self.readline.remove_history_item(histlen-1)
1995 1999 self.readline.replace_history_item(histlen-2,newhist)
1996 2000 except AttributeError:
1997 2001 pass # re{move,place}_history_item are new in 2.4.
1998 2002 else:
1999 2003 self.input_hist_raw.append('%s\n' % line)
2000 2004
2001 2005 try:
2002 2006 lineout = self.prefilter(line,continue_prompt)
2003 2007 except:
2004 2008 # blanket except, in case a user-defined prefilter crashes, so it
2005 2009 # can't take all of ipython with it.
2006 2010 self.showtraceback()
2007 2011 return ''
2008 2012 else:
2009 2013 return lineout
2010 2014
2011 2015 def split_user_input(self,line):
2012 2016 """Split user input into pre-char, function part and rest."""
2013 2017
2014 2018 lsplit = self.line_split.match(line)
2015 2019 if lsplit is None: # no regexp match returns None
2016 2020 try:
2017 2021 iFun,theRest = line.split(None,1)
2018 2022 except ValueError:
2019 2023 iFun,theRest = line,''
2020 2024 pre = re.match('^(\s*)(.*)',line).groups()[0]
2021 2025 else:
2022 2026 pre,iFun,theRest = lsplit.groups()
2023 2027
2024 2028 #print 'line:<%s>' % line # dbg
2025 2029 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2026 2030 return pre,iFun.strip(),theRest
2027 2031
2028 2032 def _prefilter(self, line, continue_prompt):
2029 2033 """Calls different preprocessors, depending on the form of line."""
2030 2034
2031 2035 # All handlers *must* return a value, even if it's blank ('').
2032 2036
2033 2037 # Lines are NOT logged here. Handlers should process the line as
2034 2038 # needed, update the cache AND log it (so that the input cache array
2035 2039 # stays synced).
2036 2040
2037 2041 # This function is _very_ delicate, and since it's also the one which
2038 2042 # determines IPython's response to user input, it must be as efficient
2039 2043 # as possible. For this reason it has _many_ returns in it, trying
2040 2044 # always to exit as quickly as it can figure out what it needs to do.
2041 2045
2042 2046 # This function is the main responsible for maintaining IPython's
2043 2047 # behavior respectful of Python's semantics. So be _very_ careful if
2044 2048 # making changes to anything here.
2045 2049
2046 2050 #.....................................................................
2047 2051 # Code begins
2048 2052
2049 2053 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2050 2054
2051 2055 # save the line away in case we crash, so the post-mortem handler can
2052 2056 # record it
2053 2057 self._last_input_line = line
2054 2058
2055 2059 #print '***line: <%s>' % line # dbg
2056 2060
2057 2061 # the input history needs to track even empty lines
2058 2062 stripped = line.strip()
2059 2063
2060 2064 if not stripped:
2061 2065 if not continue_prompt:
2062 2066 self.outputcache.prompt_count -= 1
2063 2067 return self.handle_normal(line,continue_prompt)
2064 2068 #return self.handle_normal('',continue_prompt)
2065 2069
2066 2070 # print '***cont',continue_prompt # dbg
2067 2071 # special handlers are only allowed for single line statements
2068 2072 if continue_prompt and not self.rc.multi_line_specials:
2069 2073 return self.handle_normal(line,continue_prompt)
2070 2074
2071 2075
2072 2076 # For the rest, we need the structure of the input
2073 2077 pre,iFun,theRest = self.split_user_input(line)
2074 2078
2075 2079 # See whether any pre-existing handler can take care of it
2076 2080
2077 2081 rewritten = self.hooks.input_prefilter(stripped)
2078 2082 if rewritten != stripped: # ok, some prefilter did something
2079 2083 rewritten = pre + rewritten # add indentation
2080 2084 return self.handle_normal(rewritten)
2081 2085
2082 2086 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2083 2087
2084 2088 # First check for explicit escapes in the last/first character
2085 2089 handler = None
2086 2090 if line[-1] == self.ESC_HELP:
2087 2091 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2088 2092 if handler is None:
2089 2093 # look at the first character of iFun, NOT of line, so we skip
2090 2094 # leading whitespace in multiline input
2091 2095 handler = self.esc_handlers.get(iFun[0:1])
2092 2096 if handler is not None:
2093 2097 return handler(line,continue_prompt,pre,iFun,theRest)
2094 2098 # Emacs ipython-mode tags certain input lines
2095 2099 if line.endswith('# PYTHON-MODE'):
2096 2100 return self.handle_emacs(line,continue_prompt)
2097 2101
2098 2102 # Next, check if we can automatically execute this thing
2099 2103
2100 2104 # Allow ! in multi-line statements if multi_line_specials is on:
2101 2105 if continue_prompt and self.rc.multi_line_specials and \
2102 2106 iFun.startswith(self.ESC_SHELL):
2103 2107 return self.handle_shell_escape(line,continue_prompt,
2104 2108 pre=pre,iFun=iFun,
2105 2109 theRest=theRest)
2106 2110
2107 2111 # Let's try to find if the input line is a magic fn
2108 2112 oinfo = None
2109 2113 if hasattr(self,'magic_'+iFun):
2110 2114 # WARNING: _ofind uses getattr(), so it can consume generators and
2111 2115 # cause other side effects.
2112 2116 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2113 2117 if oinfo['ismagic']:
2114 2118 # Be careful not to call magics when a variable assignment is
2115 2119 # being made (ls='hi', for example)
2116 2120 if self.rc.automagic and \
2117 2121 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2118 2122 (self.rc.multi_line_specials or not continue_prompt):
2119 2123 return self.handle_magic(line,continue_prompt,
2120 2124 pre,iFun,theRest)
2121 2125 else:
2122 2126 return self.handle_normal(line,continue_prompt)
2123 2127
2124 2128 # If the rest of the line begins with an (in)equality, assginment or
2125 2129 # function call, we should not call _ofind but simply execute it.
2126 2130 # This avoids spurious geattr() accesses on objects upon assignment.
2127 2131 #
2128 2132 # It also allows users to assign to either alias or magic names true
2129 2133 # python variables (the magic/alias systems always take second seat to
2130 2134 # true python code).
2131 2135 if theRest and theRest[0] in '!=()':
2132 2136 return self.handle_normal(line,continue_prompt)
2133 2137
2134 2138 if oinfo is None:
2135 2139 # let's try to ensure that _oinfo is ONLY called when autocall is
2136 2140 # on. Since it has inevitable potential side effects, at least
2137 2141 # having autocall off should be a guarantee to the user that no
2138 2142 # weird things will happen.
2139 2143
2140 2144 if self.rc.autocall:
2141 2145 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2142 2146 else:
2143 2147 # in this case, all that's left is either an alias or
2144 2148 # processing the line normally.
2145 2149 if iFun in self.alias_table:
2146 2150 # if autocall is off, by not running _ofind we won't know
2147 2151 # whether the given name may also exist in one of the
2148 2152 # user's namespace. At this point, it's best to do a
2149 2153 # quick check just to be sure that we don't let aliases
2150 2154 # shadow variables.
2151 2155 head = iFun.split('.',1)[0]
2152 2156 if head in self.user_ns or head in self.internal_ns \
2153 2157 or head in __builtin__.__dict__:
2154 2158 return self.handle_normal(line,continue_prompt)
2155 2159 else:
2156 2160 return self.handle_alias(line,continue_prompt,
2157 2161 pre,iFun,theRest)
2158 2162
2159 2163 else:
2160 2164 return self.handle_normal(line,continue_prompt)
2161 2165
2162 2166 if not oinfo['found']:
2163 2167 return self.handle_normal(line,continue_prompt)
2164 2168 else:
2165 2169 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2166 2170 if oinfo['isalias']:
2167 2171 return self.handle_alias(line,continue_prompt,
2168 2172 pre,iFun,theRest)
2169 2173
2170 2174 if (self.rc.autocall
2171 2175 and
2172 2176 (
2173 2177 #only consider exclusion re if not "," or ";" autoquoting
2174 2178 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2175 2179 or pre == self.ESC_PAREN) or
2176 2180 (not self.re_exclude_auto.match(theRest)))
2177 2181 and
2178 2182 self.re_fun_name.match(iFun) and
2179 2183 callable(oinfo['obj'])) :
2180 2184 #print 'going auto' # dbg
2181 2185 return self.handle_auto(line,continue_prompt,
2182 2186 pre,iFun,theRest,oinfo['obj'])
2183 2187 else:
2184 2188 #print 'was callable?', callable(oinfo['obj']) # dbg
2185 2189 return self.handle_normal(line,continue_prompt)
2186 2190
2187 2191 # If we get here, we have a normal Python line. Log and return.
2188 2192 return self.handle_normal(line,continue_prompt)
2189 2193
2190 2194 def _prefilter_dumb(self, line, continue_prompt):
2191 2195 """simple prefilter function, for debugging"""
2192 2196 return self.handle_normal(line,continue_prompt)
2193 2197
2194 2198
2195 2199 def multiline_prefilter(self, line, continue_prompt):
2196 2200 """ Run _prefilter for each line of input
2197 2201
2198 2202 Covers cases where there are multiple lines in the user entry,
2199 2203 which is the case when the user goes back to a multiline history
2200 2204 entry and presses enter.
2201 2205
2202 2206 """
2203 2207 out = []
2204 2208 for l in line.rstrip('\n').split('\n'):
2205 2209 out.append(self._prefilter(l, continue_prompt))
2206 2210 return '\n'.join(out)
2207 2211
2208 2212 # Set the default prefilter() function (this can be user-overridden)
2209 2213 prefilter = multiline_prefilter
2210 2214
2211 2215 def handle_normal(self,line,continue_prompt=None,
2212 2216 pre=None,iFun=None,theRest=None):
2213 2217 """Handle normal input lines. Use as a template for handlers."""
2214 2218
2215 2219 # With autoindent on, we need some way to exit the input loop, and I
2216 2220 # don't want to force the user to have to backspace all the way to
2217 2221 # clear the line. The rule will be in this case, that either two
2218 2222 # lines of pure whitespace in a row, or a line of pure whitespace but
2219 2223 # of a size different to the indent level, will exit the input loop.
2220 2224
2221 2225 if (continue_prompt and self.autoindent and line.isspace() and
2222 2226 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2223 2227 (self.buffer[-1]).isspace() )):
2224 2228 line = ''
2225 2229
2226 2230 self.log(line,line,continue_prompt)
2227 2231 return line
2228 2232
2229 2233 def handle_alias(self,line,continue_prompt=None,
2230 2234 pre=None,iFun=None,theRest=None):
2231 2235 """Handle alias input lines. """
2232 2236
2233 2237 # pre is needed, because it carries the leading whitespace. Otherwise
2234 2238 # aliases won't work in indented sections.
2235 2239 transformed = self.expand_aliases(iFun, theRest)
2236 2240 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2237 2241 self.log(line,line_out,continue_prompt)
2238 2242 #print 'line out:',line_out # dbg
2239 2243 return line_out
2240 2244
2241 2245 def handle_shell_escape(self, line, continue_prompt=None,
2242 2246 pre=None,iFun=None,theRest=None):
2243 2247 """Execute the line in a shell, empty return value"""
2244 2248
2245 2249 #print 'line in :', `line` # dbg
2246 2250 # Example of a special handler. Others follow a similar pattern.
2247 2251 if line.lstrip().startswith('!!'):
2248 2252 # rewrite iFun/theRest to properly hold the call to %sx and
2249 2253 # the actual command to be executed, so handle_magic can work
2250 2254 # correctly
2251 2255 theRest = '%s %s' % (iFun[2:],theRest)
2252 2256 iFun = 'sx'
2253 2257 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2254 2258 line.lstrip()[2:]),
2255 2259 continue_prompt,pre,iFun,theRest)
2256 2260 else:
2257 2261 cmd=line.lstrip().lstrip('!')
2258 2262 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2259 2263 # update cache/log and return
2260 2264 self.log(line,line_out,continue_prompt)
2261 2265 return line_out
2262 2266
2263 2267 def handle_magic(self, line, continue_prompt=None,
2264 2268 pre=None,iFun=None,theRest=None):
2265 2269 """Execute magic functions."""
2266 2270
2267 2271
2268 2272 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2269 2273 self.log(line,cmd,continue_prompt)
2270 2274 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2271 2275 return cmd
2272 2276
2273 2277 def handle_auto(self, line, continue_prompt=None,
2274 2278 pre=None,iFun=None,theRest=None,obj=None):
2275 2279 """Hande lines which can be auto-executed, quoting if requested."""
2276 2280
2277 2281 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2278 2282
2279 2283 # This should only be active for single-line input!
2280 2284 if continue_prompt:
2281 2285 self.log(line,line,continue_prompt)
2282 2286 return line
2283 2287
2284 2288 auto_rewrite = True
2285 2289
2286 2290 if pre == self.ESC_QUOTE:
2287 2291 # Auto-quote splitting on whitespace
2288 2292 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2289 2293 elif pre == self.ESC_QUOTE2:
2290 2294 # Auto-quote whole string
2291 2295 newcmd = '%s("%s")' % (iFun,theRest)
2292 2296 elif pre == self.ESC_PAREN:
2293 2297 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2294 2298 else:
2295 2299 # Auto-paren.
2296 2300 # We only apply it to argument-less calls if the autocall
2297 2301 # parameter is set to 2. We only need to check that autocall is <
2298 2302 # 2, since this function isn't called unless it's at least 1.
2299 2303 if not theRest and (self.rc.autocall < 2):
2300 2304 newcmd = '%s %s' % (iFun,theRest)
2301 2305 auto_rewrite = False
2302 2306 else:
2303 2307 if theRest.startswith('['):
2304 2308 if hasattr(obj,'__getitem__'):
2305 2309 # Don't autocall in this case: item access for an object
2306 2310 # which is BOTH callable and implements __getitem__.
2307 2311 newcmd = '%s %s' % (iFun,theRest)
2308 2312 auto_rewrite = False
2309 2313 else:
2310 2314 # if the object doesn't support [] access, go ahead and
2311 2315 # autocall
2312 2316 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2313 2317 elif theRest.endswith(';'):
2314 2318 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2315 2319 else:
2316 2320 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2317 2321
2318 2322 if auto_rewrite:
2319 2323 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2320 2324 # log what is now valid Python, not the actual user input (without the
2321 2325 # final newline)
2322 2326 self.log(line,newcmd,continue_prompt)
2323 2327 return newcmd
2324 2328
2325 2329 def handle_help(self, line, continue_prompt=None,
2326 2330 pre=None,iFun=None,theRest=None):
2327 2331 """Try to get some help for the object.
2328 2332
2329 2333 obj? or ?obj -> basic information.
2330 2334 obj?? or ??obj -> more details.
2331 2335 """
2332 2336
2333 2337 # We need to make sure that we don't process lines which would be
2334 2338 # otherwise valid python, such as "x=1 # what?"
2335 2339 try:
2336 2340 codeop.compile_command(line)
2337 2341 except SyntaxError:
2338 2342 # We should only handle as help stuff which is NOT valid syntax
2339 2343 if line[0]==self.ESC_HELP:
2340 2344 line = line[1:]
2341 2345 elif line[-1]==self.ESC_HELP:
2342 2346 line = line[:-1]
2343 2347 self.log(line,'#?'+line,continue_prompt)
2344 2348 if line:
2345 2349 self.magic_pinfo(line)
2346 2350 else:
2347 2351 page(self.usage,screen_lines=self.rc.screen_length)
2348 2352 return '' # Empty string is needed here!
2349 2353 except:
2350 2354 # Pass any other exceptions through to the normal handler
2351 2355 return self.handle_normal(line,continue_prompt)
2352 2356 else:
2353 2357 # If the code compiles ok, we should handle it normally
2354 2358 return self.handle_normal(line,continue_prompt)
2355 2359
2356 2360 def getapi(self):
2357 2361 """ Get an IPApi object for this shell instance
2358 2362
2359 2363 Getting an IPApi object is always preferable to accessing the shell
2360 2364 directly, but this holds true especially for extensions.
2361 2365
2362 2366 It should always be possible to implement an extension with IPApi
2363 2367 alone. If not, contact maintainer to request an addition.
2364 2368
2365 2369 """
2366 2370 return self.api
2367 2371
2368 2372 def handle_emacs(self,line,continue_prompt=None,
2369 2373 pre=None,iFun=None,theRest=None):
2370 2374 """Handle input lines marked by python-mode."""
2371 2375
2372 2376 # Currently, nothing is done. Later more functionality can be added
2373 2377 # here if needed.
2374 2378
2375 2379 # The input cache shouldn't be updated
2376 2380
2377 2381 return line
2378 2382
2379 2383 def mktempfile(self,data=None):
2380 2384 """Make a new tempfile and return its filename.
2381 2385
2382 2386 This makes a call to tempfile.mktemp, but it registers the created
2383 2387 filename internally so ipython cleans it up at exit time.
2384 2388
2385 2389 Optional inputs:
2386 2390
2387 2391 - data(None): if data is given, it gets written out to the temp file
2388 2392 immediately, and the file is closed again."""
2389 2393
2390 2394 filename = tempfile.mktemp('.py','ipython_edit_')
2391 2395 self.tempfiles.append(filename)
2392 2396
2393 2397 if data:
2394 2398 tmp_file = open(filename,'w')
2395 2399 tmp_file.write(data)
2396 2400 tmp_file.close()
2397 2401 return filename
2398 2402
2399 2403 def write(self,data):
2400 2404 """Write a string to the default output"""
2401 2405 Term.cout.write(data)
2402 2406
2403 2407 def write_err(self,data):
2404 2408 """Write a string to the default error output"""
2405 2409 Term.cerr.write(data)
2406 2410
2407 2411 def exit(self):
2408 2412 """Handle interactive exit.
2409 2413
2410 2414 This method sets the exit_now attribute."""
2411 2415
2412 2416 if self.rc.confirm_exit:
2413 2417 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2414 2418 self.exit_now = True
2415 2419 else:
2416 2420 self.exit_now = True
2417 2421
2418 2422 def safe_execfile(self,fname,*where,**kw):
2419 2423 """A safe version of the builtin execfile().
2420 2424
2421 2425 This version will never throw an exception, and knows how to handle
2422 2426 ipython logs as well."""
2423 2427
2424 2428 def syspath_cleanup():
2425 2429 """Internal cleanup routine for sys.path."""
2426 2430 if add_dname:
2427 2431 try:
2428 2432 sys.path.remove(dname)
2429 2433 except ValueError:
2430 2434 # For some reason the user has already removed it, ignore.
2431 2435 pass
2432 2436
2433 2437 fname = os.path.expanduser(fname)
2434 2438
2435 2439 # Find things also in current directory. This is needed to mimic the
2436 2440 # behavior of running a script from the system command line, where
2437 2441 # Python inserts the script's directory into sys.path
2438 2442 dname = os.path.dirname(os.path.abspath(fname))
2439 2443 add_dname = False
2440 2444 if dname not in sys.path:
2441 2445 sys.path.insert(0,dname)
2442 2446 add_dname = True
2443 2447
2444 2448 try:
2445 2449 xfile = open(fname)
2446 2450 except:
2447 2451 print >> Term.cerr, \
2448 2452 'Could not open file <%s> for safe execution.' % fname
2449 2453 syspath_cleanup()
2450 2454 return None
2451 2455
2452 2456 kw.setdefault('islog',0)
2453 2457 kw.setdefault('quiet',1)
2454 2458 kw.setdefault('exit_ignore',0)
2455 2459 first = xfile.readline()
2456 2460 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2457 2461 xfile.close()
2458 2462 # line by line execution
2459 2463 if first.startswith(loghead) or kw['islog']:
2460 2464 print 'Loading log file <%s> one line at a time...' % fname
2461 2465 if kw['quiet']:
2462 2466 stdout_save = sys.stdout
2463 2467 sys.stdout = StringIO.StringIO()
2464 2468 try:
2465 2469 globs,locs = where[0:2]
2466 2470 except:
2467 2471 try:
2468 2472 globs = locs = where[0]
2469 2473 except:
2470 2474 globs = locs = globals()
2471 2475 badblocks = []
2472 2476
2473 2477 # we also need to identify indented blocks of code when replaying
2474 2478 # logs and put them together before passing them to an exec
2475 2479 # statement. This takes a bit of regexp and look-ahead work in the
2476 2480 # file. It's easiest if we swallow the whole thing in memory
2477 2481 # first, and manually walk through the lines list moving the
2478 2482 # counter ourselves.
2479 2483 indent_re = re.compile('\s+\S')
2480 2484 xfile = open(fname)
2481 2485 filelines = xfile.readlines()
2482 2486 xfile.close()
2483 2487 nlines = len(filelines)
2484 2488 lnum = 0
2485 2489 while lnum < nlines:
2486 2490 line = filelines[lnum]
2487 2491 lnum += 1
2488 2492 # don't re-insert logger status info into cache
2489 2493 if line.startswith('#log#'):
2490 2494 continue
2491 2495 else:
2492 2496 # build a block of code (maybe a single line) for execution
2493 2497 block = line
2494 2498 try:
2495 2499 next = filelines[lnum] # lnum has already incremented
2496 2500 except:
2497 2501 next = None
2498 2502 while next and indent_re.match(next):
2499 2503 block += next
2500 2504 lnum += 1
2501 2505 try:
2502 2506 next = filelines[lnum]
2503 2507 except:
2504 2508 next = None
2505 2509 # now execute the block of one or more lines
2506 2510 try:
2507 2511 exec block in globs,locs
2508 2512 except SystemExit:
2509 2513 pass
2510 2514 except:
2511 2515 badblocks.append(block.rstrip())
2512 2516 if kw['quiet']: # restore stdout
2513 2517 sys.stdout.close()
2514 2518 sys.stdout = stdout_save
2515 2519 print 'Finished replaying log file <%s>' % fname
2516 2520 if badblocks:
2517 2521 print >> sys.stderr, ('\nThe following lines/blocks in file '
2518 2522 '<%s> reported errors:' % fname)
2519 2523
2520 2524 for badline in badblocks:
2521 2525 print >> sys.stderr, badline
2522 2526 else: # regular file execution
2523 2527 try:
2524 2528 execfile(fname,*where)
2525 2529 except SyntaxError:
2526 2530 self.showsyntaxerror()
2527 2531 warn('Failure executing file: <%s>' % fname)
2528 2532 except SystemExit,status:
2529 2533 if not kw['exit_ignore']:
2530 2534 self.showtraceback()
2531 2535 warn('Failure executing file: <%s>' % fname)
2532 2536 except:
2533 2537 self.showtraceback()
2534 2538 warn('Failure executing file: <%s>' % fname)
2535 2539
2536 2540 syspath_cleanup()
2537 2541
2538 2542 #************************* end of file <iplib.py> *****************************
@@ -1,6141 +1,6150 b''
1 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (showtraceback): ensure that we correctly call
4 custom handlers in all cases (some with pdb were slipping through,
5 but I'm not exactly sure why).
6
7 * IPython/Debugger.py (Tracer.__init__): added new class to
8 support set_trace-like usage of IPython's enhanced debugger.
9
1 10 2006-12-24 Ville Vainio <vivainio@gmail.com>
2 11
3 12 * ipmaker.py: more informative message when ipy_user_conf
4 13 import fails (suggest running %upgrade).
5 14
6 15 * tools/run_ipy_in_profiler.py: Utility to see where
7 16 the time during IPython startup is spent.
8 17
9 18 2006-12-20 Ville Vainio <vivainio@gmail.com>
10 19
11 20 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
12 21
13 22 * ipapi.py: Add new ipapi method, expand_alias.
14 23
15 24 * Release.py: Bump up version to 0.7.4.svn
16 25
17 26 2006-12-17 Ville Vainio <vivainio@gmail.com>
18 27
19 28 * Extensions/jobctrl.py: Fixed &cmd arg arg...
20 29 to work properly on posix too
21 30
22 31 * Release.py: Update revnum (version is still just 0.7.3).
23 32
24 33 2006-12-15 Ville Vainio <vivainio@gmail.com>
25 34
26 35 * scripts/ipython_win_post_install: create ipython.py in
27 36 prefix + "/scripts".
28 37
29 38 * Release.py: Update version to 0.7.3.
30 39
31 40 2006-12-14 Ville Vainio <vivainio@gmail.com>
32 41
33 42 * scripts/ipython_win_post_install: Overwrite old shortcuts
34 43 if they already exist
35 44
36 45 * Release.py: release 0.7.3rc2
37 46
38 47 2006-12-13 Ville Vainio <vivainio@gmail.com>
39 48
40 49 * Branch and update Release.py for 0.7.3rc1
41 50
42 51 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
43 52
44 53 * IPython/Shell.py (IPShellWX): update for current WX naming
45 54 conventions, to avoid a deprecation warning with current WX
46 55 versions. Thanks to a report by Danny Shevitz.
47 56
48 57 2006-12-12 Ville Vainio <vivainio@gmail.com>
49 58
50 59 * ipmaker.py: apply david cournapeau's patch to make
51 60 import_some work properly even when ipythonrc does
52 61 import_some on empty list (it was an old bug!).
53 62
54 63 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
55 64 Add deprecation note to ipythonrc and a url to wiki
56 65 in ipy_user_conf.py
57 66
58 67
59 68 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
60 69 as if it was typed on IPython command prompt, i.e.
61 70 as IPython script.
62 71
63 72 * example-magic.py, magic_grepl.py: remove outdated examples
64 73
65 74 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
66 75
67 76 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
68 77 is called before any exception has occurred.
69 78
70 79 2006-12-08 Ville Vainio <vivainio@gmail.com>
71 80
72 81 * Extensions/ipy_stock_completers.py.py: fix cd completer
73 82 to translate /'s to \'s again.
74 83
75 84 * completer.py: prevent traceback on file completions w/
76 85 backslash.
77 86
78 87 * Release.py: Update release number to 0.7.3b3 for release
79 88
80 89 2006-12-07 Ville Vainio <vivainio@gmail.com>
81 90
82 91 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
83 92 while executing external code. Provides more shell-like behaviour
84 93 and overall better response to ctrl + C / ctrl + break.
85 94
86 95 * tools/make_tarball.py: new script to create tarball straight from svn
87 96 (setup.py sdist doesn't work on win32).
88 97
89 98 * Extensions/ipy_stock_completers.py: fix cd completer to give up
90 99 on dirnames with spaces and use the default completer instead.
91 100
92 101 * Revision.py: Change version to 0.7.3b2 for release.
93 102
94 103 2006-12-05 Ville Vainio <vivainio@gmail.com>
95 104
96 105 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
97 106 pydb patch 4 (rm debug printing, py 2.5 checking)
98 107
99 108 2006-11-30 Walter Doerwald <walter@livinglogic.de>
100 109 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
101 110 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
102 111 "refreshfind" (mapped to "R") does the same but tries to go back to the same
103 112 object the cursor was on before the refresh. The command "markrange" is
104 113 mapped to "%" now.
105 114 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
106 115
107 116 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
108 117
109 118 * IPython/Magic.py (magic_debug): new %debug magic to activate the
110 119 interactive debugger on the last traceback, without having to call
111 120 %pdb and rerun your code. Made minor changes in various modules,
112 121 should automatically recognize pydb if available.
113 122
114 123 2006-11-28 Ville Vainio <vivainio@gmail.com>
115 124
116 125 * completer.py: If the text start with !, show file completions
117 126 properly. This helps when trying to complete command name
118 127 for shell escapes.
119 128
120 129 2006-11-27 Ville Vainio <vivainio@gmail.com>
121 130
122 131 * ipy_stock_completers.py: bzr completer submitted by Stefan van
123 132 der Walt. Clean up svn and hg completers by using a common
124 133 vcs_completer.
125 134
126 135 2006-11-26 Ville Vainio <vivainio@gmail.com>
127 136
128 137 * Remove ipconfig and %config; you should use _ip.options structure
129 138 directly instead!
130 139
131 140 * genutils.py: add wrap_deprecated function for deprecating callables
132 141
133 142 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
134 143 _ip.system instead. ipalias is redundant.
135 144
136 145 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
137 146 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
138 147 explicit.
139 148
140 149 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
141 150 completer. Try it by entering 'hg ' and pressing tab.
142 151
143 152 * macro.py: Give Macro a useful __repr__ method
144 153
145 154 * Magic.py: %whos abbreviates the typename of Macro for brevity.
146 155
147 156 2006-11-24 Walter Doerwald <walter@livinglogic.de>
148 157 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
149 158 we don't get a duplicate ipipe module, where registration of the xrepr
150 159 implementation for Text is useless.
151 160
152 161 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
153 162
154 163 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
155 164
156 165 2006-11-24 Ville Vainio <vivainio@gmail.com>
157 166
158 167 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
159 168 try to use "cProfile" instead of the slower pure python
160 169 "profile"
161 170
162 171 2006-11-23 Ville Vainio <vivainio@gmail.com>
163 172
164 173 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
165 174 Qt+IPython+Designer link in documentation.
166 175
167 176 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
168 177 correct Pdb object to %pydb.
169 178
170 179
171 180 2006-11-22 Walter Doerwald <walter@livinglogic.de>
172 181 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
173 182 generic xrepr(), otherwise the list implementation would kick in.
174 183
175 184 2006-11-21 Ville Vainio <vivainio@gmail.com>
176 185
177 186 * upgrade_dir.py: Now actually overwrites a nonmodified user file
178 187 with one from UserConfig.
179 188
180 189 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
181 190 it was missing which broke the sh profile.
182 191
183 192 * completer.py: file completer now uses explicit '/' instead
184 193 of os.path.join, expansion of 'foo' was broken on win32
185 194 if there was one directory with name 'foobar'.
186 195
187 196 * A bunch of patches from Kirill Smelkov:
188 197
189 198 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
190 199
191 200 * [patch 7/9] Implement %page -r (page in raw mode) -
192 201
193 202 * [patch 5/9] ScientificPython webpage has moved
194 203
195 204 * [patch 4/9] The manual mentions %ds, should be %dhist
196 205
197 206 * [patch 3/9] Kill old bits from %prun doc.
198 207
199 208 * [patch 1/9] Fix typos here and there.
200 209
201 210 2006-11-08 Ville Vainio <vivainio@gmail.com>
202 211
203 212 * completer.py (attr_matches): catch all exceptions raised
204 213 by eval of expr with dots.
205 214
206 215 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
207 216
208 217 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
209 218 input if it starts with whitespace. This allows you to paste
210 219 indented input from any editor without manually having to type in
211 220 the 'if 1:', which is convenient when working interactively.
212 221 Slightly modifed version of a patch by Bo Peng
213 222 <bpeng-AT-rice.edu>.
214 223
215 224 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
216 225
217 226 * IPython/irunner.py (main): modified irunner so it automatically
218 227 recognizes the right runner to use based on the extension (.py for
219 228 python, .ipy for ipython and .sage for sage).
220 229
221 230 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
222 231 visible in ipapi as ip.config(), to programatically control the
223 232 internal rc object. There's an accompanying %config magic for
224 233 interactive use, which has been enhanced to match the
225 234 funtionality in ipconfig.
226 235
227 236 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
228 237 so it's not just a toggle, it now takes an argument. Add support
229 238 for a customizable header when making system calls, as the new
230 239 system_header variable in the ipythonrc file.
231 240
232 241 2006-11-03 Walter Doerwald <walter@livinglogic.de>
233 242
234 243 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
235 244 generic functions (using Philip J. Eby's simplegeneric package).
236 245 This makes it possible to customize the display of third-party classes
237 246 without having to monkeypatch them. xiter() no longer supports a mode
238 247 argument and the XMode class has been removed. The same functionality can
239 248 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
240 249 One consequence of the switch to generic functions is that xrepr() and
241 250 xattrs() implementation must define the default value for the mode
242 251 argument themselves and xattrs() implementations must return real
243 252 descriptors.
244 253
245 254 * IPython/external: This new subpackage will contain all third-party
246 255 packages that are bundled with IPython. (The first one is simplegeneric).
247 256
248 257 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
249 258 directory which as been dropped in r1703.
250 259
251 260 * IPython/Extensions/ipipe.py (iless): Fixed.
252 261
253 262 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
254 263
255 264 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
256 265
257 266 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
258 267 handling in variable expansion so that shells and magics recognize
259 268 function local scopes correctly. Bug reported by Brian.
260 269
261 270 * scripts/ipython: remove the very first entry in sys.path which
262 271 Python auto-inserts for scripts, so that sys.path under IPython is
263 272 as similar as possible to that under plain Python.
264 273
265 274 * IPython/completer.py (IPCompleter.file_matches): Fix
266 275 tab-completion so that quotes are not closed unless the completion
267 276 is unambiguous. After a request by Stefan. Minor cleanups in
268 277 ipy_stock_completers.
269 278
270 279 2006-11-02 Ville Vainio <vivainio@gmail.com>
271 280
272 281 * ipy_stock_completers.py: Add %run and %cd completers.
273 282
274 283 * completer.py: Try running custom completer for both
275 284 "foo" and "%foo" if the command is just "foo". Ignore case
276 285 when filtering possible completions.
277 286
278 287 * UserConfig/ipy_user_conf.py: install stock completers as default
279 288
280 289 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
281 290 simplified readline history save / restore through a wrapper
282 291 function
283 292
284 293
285 294 2006-10-31 Ville Vainio <vivainio@gmail.com>
286 295
287 296 * strdispatch.py, completer.py, ipy_stock_completers.py:
288 297 Allow str_key ("command") in completer hooks. Implement
289 298 trivial completer for 'import' (stdlib modules only). Rename
290 299 ipy_linux_package_managers.py to ipy_stock_completers.py.
291 300 SVN completer.
292 301
293 302 * Extensions/ledit.py: %magic line editor for easily and
294 303 incrementally manipulating lists of strings. The magic command
295 304 name is %led.
296 305
297 306 2006-10-30 Ville Vainio <vivainio@gmail.com>
298 307
299 308 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
300 309 Bernsteins's patches for pydb integration.
301 310 http://bashdb.sourceforge.net/pydb/
302 311
303 312 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
304 313 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
305 314 custom completer hook to allow the users to implement their own
306 315 completers. See ipy_linux_package_managers.py for example. The
307 316 hook name is 'complete_command'.
308 317
309 318 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
310 319
311 320 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
312 321 Numeric leftovers.
313 322
314 323 * ipython.el (py-execute-region): apply Stefan's patch to fix
315 324 garbled results if the python shell hasn't been previously started.
316 325
317 326 * IPython/genutils.py (arg_split): moved to genutils, since it's a
318 327 pretty generic function and useful for other things.
319 328
320 329 * IPython/OInspect.py (getsource): Add customizable source
321 330 extractor. After a request/patch form W. Stein (SAGE).
322 331
323 332 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
324 333 window size to a more reasonable value from what pexpect does,
325 334 since their choice causes wrapping bugs with long input lines.
326 335
327 336 2006-10-28 Ville Vainio <vivainio@gmail.com>
328 337
329 338 * Magic.py (%run): Save and restore the readline history from
330 339 file around %run commands to prevent side effects from
331 340 %runned programs that might use readline (e.g. pydb).
332 341
333 342 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
334 343 invoking the pydb enhanced debugger.
335 344
336 345 2006-10-23 Walter Doerwald <walter@livinglogic.de>
337 346
338 347 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
339 348 call the base class method and propagate the return value to
340 349 ifile. This is now done by path itself.
341 350
342 351 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
343 352
344 353 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
345 354 api: set_crash_handler(), to expose the ability to change the
346 355 internal crash handler.
347 356
348 357 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
349 358 the various parameters of the crash handler so that apps using
350 359 IPython as their engine can customize crash handling. Ipmlemented
351 360 at the request of SAGE.
352 361
353 362 2006-10-14 Ville Vainio <vivainio@gmail.com>
354 363
355 364 * Magic.py, ipython.el: applied first "safe" part of Rocky
356 365 Bernstein's patch set for pydb integration.
357 366
358 367 * Magic.py (%unalias, %alias): %store'd aliases can now be
359 368 removed with '%unalias'. %alias w/o args now shows most
360 369 interesting (stored / manually defined) aliases last
361 370 where they catch the eye w/o scrolling.
362 371
363 372 * Magic.py (%rehashx), ext_rehashdir.py: files with
364 373 'py' extension are always considered executable, even
365 374 when not in PATHEXT environment variable.
366 375
367 376 2006-10-12 Ville Vainio <vivainio@gmail.com>
368 377
369 378 * jobctrl.py: Add new "jobctrl" extension for spawning background
370 379 processes with "&find /". 'import jobctrl' to try it out. Requires
371 380 'subprocess' module, standard in python 2.4+.
372 381
373 382 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
374 383 so if foo -> bar and bar -> baz, then foo -> baz.
375 384
376 385 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
377 386
378 387 * IPython/Magic.py (Magic.parse_options): add a new posix option
379 388 to allow parsing of input args in magics that doesn't strip quotes
380 389 (if posix=False). This also closes %timeit bug reported by
381 390 Stefan.
382 391
383 392 2006-10-03 Ville Vainio <vivainio@gmail.com>
384 393
385 394 * iplib.py (raw_input, interact): Return ValueError catching for
386 395 raw_input. Fixes infinite loop for sys.stdin.close() or
387 396 sys.stdout.close().
388 397
389 398 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
390 399
391 400 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
392 401 to help in handling doctests. irunner is now pretty useful for
393 402 running standalone scripts and simulate a full interactive session
394 403 in a format that can be then pasted as a doctest.
395 404
396 405 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
397 406 on top of the default (useless) ones. This also fixes the nasty
398 407 way in which 2.5's Quitter() exits (reverted [1785]).
399 408
400 409 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
401 410 2.5.
402 411
403 412 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
404 413 color scheme is updated as well when color scheme is changed
405 414 interactively.
406 415
407 416 2006-09-27 Ville Vainio <vivainio@gmail.com>
408 417
409 418 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
410 419 infinite loop and just exit. It's a hack, but will do for a while.
411 420
412 421 2006-08-25 Walter Doerwald <walter@livinglogic.de>
413 422
414 423 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
415 424 the constructor, this makes it possible to get a list of only directories
416 425 or only files.
417 426
418 427 2006-08-12 Ville Vainio <vivainio@gmail.com>
419 428
420 429 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
421 430 they broke unittest
422 431
423 432 2006-08-11 Ville Vainio <vivainio@gmail.com>
424 433
425 434 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
426 435 by resolving issue properly, i.e. by inheriting FakeModule
427 436 from types.ModuleType. Pickling ipython interactive data
428 437 should still work as usual (testing appreciated).
429 438
430 439 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
431 440
432 441 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
433 442 running under python 2.3 with code from 2.4 to fix a bug with
434 443 help(). Reported by the Debian maintainers, Norbert Tretkowski
435 444 <norbert-AT-tretkowski.de> and Alexandre Fayolle
436 445 <afayolle-AT-debian.org>.
437 446
438 447 2006-08-04 Walter Doerwald <walter@livinglogic.de>
439 448
440 449 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
441 450 (which was displaying "quit" twice).
442 451
443 452 2006-07-28 Walter Doerwald <walter@livinglogic.de>
444 453
445 454 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
446 455 the mode argument).
447 456
448 457 2006-07-27 Walter Doerwald <walter@livinglogic.de>
449 458
450 459 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
451 460 not running under IPython.
452 461
453 462 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
454 463 and make it iterable (iterating over the attribute itself). Add two new
455 464 magic strings for __xattrs__(): If the string starts with "-", the attribute
456 465 will not be displayed in ibrowse's detail view (but it can still be
457 466 iterated over). This makes it possible to add attributes that are large
458 467 lists or generator methods to the detail view. Replace magic attribute names
459 468 and _attrname() and _getattr() with "descriptors": For each type of magic
460 469 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
461 470 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
462 471 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
463 472 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
464 473 are still supported.
465 474
466 475 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
467 476 fails in ibrowse.fetch(), the exception object is added as the last item
468 477 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
469 478 a generator throws an exception midway through execution.
470 479
471 480 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
472 481 encoding into methods.
473 482
474 483 2006-07-26 Ville Vainio <vivainio@gmail.com>
475 484
476 485 * iplib.py: history now stores multiline input as single
477 486 history entries. Patch by Jorgen Cederlof.
478 487
479 488 2006-07-18 Walter Doerwald <walter@livinglogic.de>
480 489
481 490 * IPython/Extensions/ibrowse.py: Make cursor visible over
482 491 non existing attributes.
483 492
484 493 2006-07-14 Walter Doerwald <walter@livinglogic.de>
485 494
486 495 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
487 496 error output of the running command doesn't mess up the screen.
488 497
489 498 2006-07-13 Walter Doerwald <walter@livinglogic.de>
490 499
491 500 * IPython/Extensions/ipipe.py (isort): Make isort usable without
492 501 argument. This sorts the items themselves.
493 502
494 503 2006-07-12 Walter Doerwald <walter@livinglogic.de>
495 504
496 505 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
497 506 Compile expression strings into code objects. This should speed
498 507 up ifilter and friends somewhat.
499 508
500 509 2006-07-08 Ville Vainio <vivainio@gmail.com>
501 510
502 511 * Magic.py: %cpaste now strips > from the beginning of lines
503 512 to ease pasting quoted code from emails. Contributed by
504 513 Stefan van der Walt.
505 514
506 515 2006-06-29 Ville Vainio <vivainio@gmail.com>
507 516
508 517 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
509 518 mode, patch contributed by Darren Dale. NEEDS TESTING!
510 519
511 520 2006-06-28 Walter Doerwald <walter@livinglogic.de>
512 521
513 522 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
514 523 a blue background. Fix fetching new display rows when the browser
515 524 scrolls more than a screenful (e.g. by using the goto command).
516 525
517 526 2006-06-27 Ville Vainio <vivainio@gmail.com>
518 527
519 528 * Magic.py (_inspect, _ofind) Apply David Huard's
520 529 patch for displaying the correct docstring for 'property'
521 530 attributes.
522 531
523 532 2006-06-23 Walter Doerwald <walter@livinglogic.de>
524 533
525 534 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
526 535 commands into the methods implementing them.
527 536
528 537 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
529 538
530 539 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
531 540 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
532 541 autoindent support was authored by Jin Liu.
533 542
534 543 2006-06-22 Walter Doerwald <walter@livinglogic.de>
535 544
536 545 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
537 546 for keymaps with a custom class that simplifies handling.
538 547
539 548 2006-06-19 Walter Doerwald <walter@livinglogic.de>
540 549
541 550 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
542 551 resizing. This requires Python 2.5 to work.
543 552
544 553 2006-06-16 Walter Doerwald <walter@livinglogic.de>
545 554
546 555 * IPython/Extensions/ibrowse.py: Add two new commands to
547 556 ibrowse: "hideattr" (mapped to "h") hides the attribute under
548 557 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
549 558 attributes again. Remapped the help command to "?". Display
550 559 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
551 560 as keys for the "home" and "end" commands. Add three new commands
552 561 to the input mode for "find" and friends: "delend" (CTRL-K)
553 562 deletes to the end of line. "incsearchup" searches upwards in the
554 563 command history for an input that starts with the text before the cursor.
555 564 "incsearchdown" does the same downwards. Removed a bogus mapping of
556 565 the x key to "delete".
557 566
558 567 2006-06-15 Ville Vainio <vivainio@gmail.com>
559 568
560 569 * iplib.py, hooks.py: Added new generate_prompt hook that can be
561 570 used to create prompts dynamically, instead of the "old" way of
562 571 assigning "magic" strings to prompt_in1 and prompt_in2. The old
563 572 way still works (it's invoked by the default hook), of course.
564 573
565 574 * Prompts.py: added generate_output_prompt hook for altering output
566 575 prompt
567 576
568 577 * Release.py: Changed version string to 0.7.3.svn.
569 578
570 579 2006-06-15 Walter Doerwald <walter@livinglogic.de>
571 580
572 581 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
573 582 the call to fetch() always tries to fetch enough data for at least one
574 583 full screen. This makes it possible to simply call moveto(0,0,True) in
575 584 the constructor. Fix typos and removed the obsolete goto attribute.
576 585
577 586 2006-06-12 Ville Vainio <vivainio@gmail.com>
578 587
579 588 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
580 589 allowing $variable interpolation within multiline statements,
581 590 though so far only with "sh" profile for a testing period.
582 591 The patch also enables splitting long commands with \ but it
583 592 doesn't work properly yet.
584 593
585 594 2006-06-12 Walter Doerwald <walter@livinglogic.de>
586 595
587 596 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
588 597 input history and the position of the cursor in the input history for
589 598 the find, findbackwards and goto command.
590 599
591 600 2006-06-10 Walter Doerwald <walter@livinglogic.de>
592 601
593 602 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
594 603 implements the basic functionality of browser commands that require
595 604 input. Reimplement the goto, find and findbackwards commands as
596 605 subclasses of _CommandInput. Add an input history and keymaps to those
597 606 commands. Add "\r" as a keyboard shortcut for the enterdefault and
598 607 execute commands.
599 608
600 609 2006-06-07 Ville Vainio <vivainio@gmail.com>
601 610
602 611 * iplib.py: ipython mybatch.ipy exits ipython immediately after
603 612 running the batch files instead of leaving the session open.
604 613
605 614 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
606 615
607 616 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
608 617 the original fix was incomplete. Patch submitted by W. Maier.
609 618
610 619 2006-06-07 Ville Vainio <vivainio@gmail.com>
611 620
612 621 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
613 622 Confirmation prompts can be supressed by 'quiet' option.
614 623 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
615 624
616 625 2006-06-06 *** Released version 0.7.2
617 626
618 627 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
619 628
620 629 * IPython/Release.py (version): Made 0.7.2 final for release.
621 630 Repo tagged and release cut.
622 631
623 632 2006-06-05 Ville Vainio <vivainio@gmail.com>
624 633
625 634 * Magic.py (magic_rehashx): Honor no_alias list earlier in
626 635 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
627 636
628 637 * upgrade_dir.py: try import 'path' module a bit harder
629 638 (for %upgrade)
630 639
631 640 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
632 641
633 642 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
634 643 instead of looping 20 times.
635 644
636 645 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
637 646 correctly at initialization time. Bug reported by Krishna Mohan
638 647 Gundu <gkmohan-AT-gmail.com> on the user list.
639 648
640 649 * IPython/Release.py (version): Mark 0.7.2 version to start
641 650 testing for release on 06/06.
642 651
643 652 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
644 653
645 654 * scripts/irunner: thin script interface so users don't have to
646 655 find the module and call it as an executable, since modules rarely
647 656 live in people's PATH.
648 657
649 658 * IPython/irunner.py (InteractiveRunner.__init__): added
650 659 delaybeforesend attribute to control delays with newer versions of
651 660 pexpect. Thanks to detailed help from pexpect's author, Noah
652 661 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
653 662 correctly (it works in NoColor mode).
654 663
655 664 * IPython/iplib.py (handle_normal): fix nasty crash reported on
656 665 SAGE list, from improper log() calls.
657 666
658 667 2006-05-31 Ville Vainio <vivainio@gmail.com>
659 668
660 669 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
661 670 with args in parens to work correctly with dirs that have spaces.
662 671
663 672 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
664 673
665 674 * IPython/Logger.py (Logger.logstart): add option to log raw input
666 675 instead of the processed one. A -r flag was added to the
667 676 %logstart magic used for controlling logging.
668 677
669 678 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
670 679
671 680 * IPython/iplib.py (InteractiveShell.__init__): add check for the
672 681 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
673 682 recognize the option. After a bug report by Will Maier. This
674 683 closes #64 (will do it after confirmation from W. Maier).
675 684
676 685 * IPython/irunner.py: New module to run scripts as if manually
677 686 typed into an interactive environment, based on pexpect. After a
678 687 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
679 688 ipython-user list. Simple unittests in the tests/ directory.
680 689
681 690 * tools/release: add Will Maier, OpenBSD port maintainer, to
682 691 recepients list. We are now officially part of the OpenBSD ports:
683 692 http://www.openbsd.org/ports.html ! Many thanks to Will for the
684 693 work.
685 694
686 695 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
687 696
688 697 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
689 698 so that it doesn't break tkinter apps.
690 699
691 700 * IPython/iplib.py (_prefilter): fix bug where aliases would
692 701 shadow variables when autocall was fully off. Reported by SAGE
693 702 author William Stein.
694 703
695 704 * IPython/OInspect.py (Inspector.__init__): add a flag to control
696 705 at what detail level strings are computed when foo? is requested.
697 706 This allows users to ask for example that the string form of an
698 707 object is only computed when foo?? is called, or even never, by
699 708 setting the object_info_string_level >= 2 in the configuration
700 709 file. This new option has been added and documented. After a
701 710 request by SAGE to be able to control the printing of very large
702 711 objects more easily.
703 712
704 713 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
705 714
706 715 * IPython/ipmaker.py (make_IPython): remove the ipython call path
707 716 from sys.argv, to be 100% consistent with how Python itself works
708 717 (as seen for example with python -i file.py). After a bug report
709 718 by Jeffrey Collins.
710 719
711 720 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
712 721 nasty bug which was preventing custom namespaces with -pylab,
713 722 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
714 723 compatibility (long gone from mpl).
715 724
716 725 * IPython/ipapi.py (make_session): name change: create->make. We
717 726 use make in other places (ipmaker,...), it's shorter and easier to
718 727 type and say, etc. I'm trying to clean things before 0.7.2 so
719 728 that I can keep things stable wrt to ipapi in the chainsaw branch.
720 729
721 730 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
722 731 python-mode recognizes our debugger mode. Add support for
723 732 autoindent inside (X)emacs. After a patch sent in by Jin Liu
724 733 <m.liu.jin-AT-gmail.com> originally written by
725 734 doxgen-AT-newsmth.net (with minor modifications for xemacs
726 735 compatibility)
727 736
728 737 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
729 738 tracebacks when walking the stack so that the stack tracking system
730 739 in emacs' python-mode can identify the frames correctly.
731 740
732 741 * IPython/ipmaker.py (make_IPython): make the internal (and
733 742 default config) autoedit_syntax value false by default. Too many
734 743 users have complained to me (both on and off-list) about problems
735 744 with this option being on by default, so I'm making it default to
736 745 off. It can still be enabled by anyone via the usual mechanisms.
737 746
738 747 * IPython/completer.py (Completer.attr_matches): add support for
739 748 PyCrust-style _getAttributeNames magic method. Patch contributed
740 749 by <mscott-AT-goldenspud.com>. Closes #50.
741 750
742 751 * IPython/iplib.py (InteractiveShell.__init__): remove the
743 752 deletion of exit/quit from __builtin__, which can break
744 753 third-party tools like the Zope debugging console. The
745 754 %exit/%quit magics remain. In general, it's probably a good idea
746 755 not to delete anything from __builtin__, since we never know what
747 756 that will break. In any case, python now (for 2.5) will support
748 757 'real' exit/quit, so this issue is moot. Closes #55.
749 758
750 759 * IPython/genutils.py (with_obj): rename the 'with' function to
751 760 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
752 761 becomes a language keyword. Closes #53.
753 762
754 763 * IPython/FakeModule.py (FakeModule.__init__): add a proper
755 764 __file__ attribute to this so it fools more things into thinking
756 765 it is a real module. Closes #59.
757 766
758 767 * IPython/Magic.py (magic_edit): add -n option to open the editor
759 768 at a specific line number. After a patch by Stefan van der Walt.
760 769
761 770 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
762 771
763 772 * IPython/iplib.py (edit_syntax_error): fix crash when for some
764 773 reason the file could not be opened. After automatic crash
765 774 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
766 775 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
767 776 (_should_recompile): Don't fire editor if using %bg, since there
768 777 is no file in the first place. From the same report as above.
769 778 (raw_input): protect against faulty third-party prefilters. After
770 779 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
771 780 while running under SAGE.
772 781
773 782 2006-05-23 Ville Vainio <vivainio@gmail.com>
774 783
775 784 * ipapi.py: Stripped down ip.to_user_ns() to work only as
776 785 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
777 786 now returns None (again), unless dummy is specifically allowed by
778 787 ipapi.get(allow_dummy=True).
779 788
780 789 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
781 790
782 791 * IPython: remove all 2.2-compatibility objects and hacks from
783 792 everywhere, since we only support 2.3 at this point. Docs
784 793 updated.
785 794
786 795 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
787 796 Anything requiring extra validation can be turned into a Python
788 797 property in the future. I used a property for the db one b/c
789 798 there was a nasty circularity problem with the initialization
790 799 order, which right now I don't have time to clean up.
791 800
792 801 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
793 802 another locking bug reported by Jorgen. I'm not 100% sure though,
794 803 so more testing is needed...
795 804
796 805 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
797 806
798 807 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
799 808 local variables from any routine in user code (typically executed
800 809 with %run) directly into the interactive namespace. Very useful
801 810 when doing complex debugging.
802 811 (IPythonNotRunning): Changed the default None object to a dummy
803 812 whose attributes can be queried as well as called without
804 813 exploding, to ease writing code which works transparently both in
805 814 and out of ipython and uses some of this API.
806 815
807 816 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
808 817
809 818 * IPython/hooks.py (result_display): Fix the fact that our display
810 819 hook was using str() instead of repr(), as the default python
811 820 console does. This had gone unnoticed b/c it only happened if
812 821 %Pprint was off, but the inconsistency was there.
813 822
814 823 2006-05-15 Ville Vainio <vivainio@gmail.com>
815 824
816 825 * Oinspect.py: Only show docstring for nonexisting/binary files
817 826 when doing object??, closing ticket #62
818 827
819 828 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
820 829
821 830 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
822 831 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
823 832 was being released in a routine which hadn't checked if it had
824 833 been the one to acquire it.
825 834
826 835 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
827 836
828 837 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
829 838
830 839 2006-04-11 Ville Vainio <vivainio@gmail.com>
831 840
832 841 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
833 842 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
834 843 prefilters, allowing stuff like magics and aliases in the file.
835 844
836 845 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
837 846 added. Supported now are "%clear in" and "%clear out" (clear input and
838 847 output history, respectively). Also fixed CachedOutput.flush to
839 848 properly flush the output cache.
840 849
841 850 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
842 851 half-success (and fail explicitly).
843 852
844 853 2006-03-28 Ville Vainio <vivainio@gmail.com>
845 854
846 855 * iplib.py: Fix quoting of aliases so that only argless ones
847 856 are quoted
848 857
849 858 2006-03-28 Ville Vainio <vivainio@gmail.com>
850 859
851 860 * iplib.py: Quote aliases with spaces in the name.
852 861 "c:\program files\blah\bin" is now legal alias target.
853 862
854 863 * ext_rehashdir.py: Space no longer allowed as arg
855 864 separator, since space is legal in path names.
856 865
857 866 2006-03-16 Ville Vainio <vivainio@gmail.com>
858 867
859 868 * upgrade_dir.py: Take path.py from Extensions, correcting
860 869 %upgrade magic
861 870
862 871 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
863 872
864 873 * hooks.py: Only enclose editor binary in quotes if legal and
865 874 necessary (space in the name, and is an existing file). Fixes a bug
866 875 reported by Zachary Pincus.
867 876
868 877 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
869 878
870 879 * Manual: thanks to a tip on proper color handling for Emacs, by
871 880 Eric J Haywiser <ejh1-AT-MIT.EDU>.
872 881
873 882 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
874 883 by applying the provided patch. Thanks to Liu Jin
875 884 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
876 885 XEmacs/Linux, I'm trusting the submitter that it actually helps
877 886 under win32/GNU Emacs. Will revisit if any problems are reported.
878 887
879 888 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
880 889
881 890 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
882 891 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
883 892
884 893 2006-03-12 Ville Vainio <vivainio@gmail.com>
885 894
886 895 * Magic.py (magic_timeit): Added %timeit magic, contributed by
887 896 Torsten Marek.
888 897
889 898 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
890 899
891 900 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
892 901 line ranges works again.
893 902
894 903 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
895 904
896 905 * IPython/iplib.py (showtraceback): add back sys.last_traceback
897 906 and friends, after a discussion with Zach Pincus on ipython-user.
898 907 I'm not 100% sure, but after thinking about it quite a bit, it may
899 908 be OK. Testing with the multithreaded shells didn't reveal any
900 909 problems, but let's keep an eye out.
901 910
902 911 In the process, I fixed a few things which were calling
903 912 self.InteractiveTB() directly (like safe_execfile), which is a
904 913 mistake: ALL exception reporting should be done by calling
905 914 self.showtraceback(), which handles state and tab-completion and
906 915 more.
907 916
908 917 2006-03-01 Ville Vainio <vivainio@gmail.com>
909 918
910 919 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
911 920 To use, do "from ipipe import *".
912 921
913 922 2006-02-24 Ville Vainio <vivainio@gmail.com>
914 923
915 924 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
916 925 "cleanly" and safely than the older upgrade mechanism.
917 926
918 927 2006-02-21 Ville Vainio <vivainio@gmail.com>
919 928
920 929 * Magic.py: %save works again.
921 930
922 931 2006-02-15 Ville Vainio <vivainio@gmail.com>
923 932
924 933 * Magic.py: %Pprint works again
925 934
926 935 * Extensions/ipy_sane_defaults.py: Provide everything provided
927 936 in default ipythonrc, to make it possible to have a completely empty
928 937 ipythonrc (and thus completely rc-file free configuration)
929 938
930 939 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
931 940
932 941 * IPython/hooks.py (editor): quote the call to the editor command,
933 942 to allow commands with spaces in them. Problem noted by watching
934 943 Ian Oswald's video about textpad under win32 at
935 944 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
936 945
937 946 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
938 947 describing magics (we haven't used @ for a loong time).
939 948
940 949 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
941 950 contributed by marienz to close
942 951 http://www.scipy.net/roundup/ipython/issue53.
943 952
944 953 2006-02-10 Ville Vainio <vivainio@gmail.com>
945 954
946 955 * genutils.py: getoutput now works in win32 too
947 956
948 957 * completer.py: alias and magic completion only invoked
949 958 at the first "item" in the line, to avoid "cd %store"
950 959 nonsense.
951 960
952 961 2006-02-09 Ville Vainio <vivainio@gmail.com>
953 962
954 963 * test/*: Added a unit testing framework (finally).
955 964 '%run runtests.py' to run test_*.
956 965
957 966 * ipapi.py: Exposed runlines and set_custom_exc
958 967
959 968 2006-02-07 Ville Vainio <vivainio@gmail.com>
960 969
961 970 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
962 971 instead use "f(1 2)" as before.
963 972
964 973 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
965 974
966 975 * IPython/demo.py (IPythonDemo): Add new classes to the demo
967 976 facilities, for demos processed by the IPython input filter
968 977 (IPythonDemo), and for running a script one-line-at-a-time as a
969 978 demo, both for pure Python (LineDemo) and for IPython-processed
970 979 input (IPythonLineDemo). After a request by Dave Kohel, from the
971 980 SAGE team.
972 981 (Demo.edit): added an edit() method to the demo objects, to edit
973 982 the in-memory copy of the last executed block.
974 983
975 984 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
976 985 processing to %edit, %macro and %save. These commands can now be
977 986 invoked on the unprocessed input as it was typed by the user
978 987 (without any prefilters applied). After requests by the SAGE team
979 988 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
980 989
981 990 2006-02-01 Ville Vainio <vivainio@gmail.com>
982 991
983 992 * setup.py, eggsetup.py: easy_install ipython==dev works
984 993 correctly now (on Linux)
985 994
986 995 * ipy_user_conf,ipmaker: user config changes, removed spurious
987 996 warnings
988 997
989 998 * iplib: if rc.banner is string, use it as is.
990 999
991 1000 * Magic: %pycat accepts a string argument and pages it's contents.
992 1001
993 1002
994 1003 2006-01-30 Ville Vainio <vivainio@gmail.com>
995 1004
996 1005 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
997 1006 Now %store and bookmarks work through PickleShare, meaning that
998 1007 concurrent access is possible and all ipython sessions see the
999 1008 same database situation all the time, instead of snapshot of
1000 1009 the situation when the session was started. Hence, %bookmark
1001 1010 results are immediately accessible from othes sessions. The database
1002 1011 is also available for use by user extensions. See:
1003 1012 http://www.python.org/pypi/pickleshare
1004 1013
1005 1014 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1006 1015
1007 1016 * aliases can now be %store'd
1008 1017
1009 1018 * path.py moved to Extensions so that pickleshare does not need
1010 1019 IPython-specific import. Extensions added to pythonpath right
1011 1020 at __init__.
1012 1021
1013 1022 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1014 1023 called with _ip.system and the pre-transformed command string.
1015 1024
1016 1025 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1017 1026
1018 1027 * IPython/iplib.py (interact): Fix that we were not catching
1019 1028 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1020 1029 logic here had to change, but it's fixed now.
1021 1030
1022 1031 2006-01-29 Ville Vainio <vivainio@gmail.com>
1023 1032
1024 1033 * iplib.py: Try to import pyreadline on Windows.
1025 1034
1026 1035 2006-01-27 Ville Vainio <vivainio@gmail.com>
1027 1036
1028 1037 * iplib.py: Expose ipapi as _ip in builtin namespace.
1029 1038 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1030 1039 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1031 1040 syntax now produce _ip.* variant of the commands.
1032 1041
1033 1042 * "_ip.options().autoedit_syntax = 2" automatically throws
1034 1043 user to editor for syntax error correction without prompting.
1035 1044
1036 1045 2006-01-27 Ville Vainio <vivainio@gmail.com>
1037 1046
1038 1047 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1039 1048 'ipython' at argv[0]) executed through command line.
1040 1049 NOTE: this DEPRECATES calling ipython with multiple scripts
1041 1050 ("ipython a.py b.py c.py")
1042 1051
1043 1052 * iplib.py, hooks.py: Added configurable input prefilter,
1044 1053 named 'input_prefilter'. See ext_rescapture.py for example
1045 1054 usage.
1046 1055
1047 1056 * ext_rescapture.py, Magic.py: Better system command output capture
1048 1057 through 'var = !ls' (deprecates user-visible %sc). Same notation
1049 1058 applies for magics, 'var = %alias' assigns alias list to var.
1050 1059
1051 1060 * ipapi.py: added meta() for accessing extension-usable data store.
1052 1061
1053 1062 * iplib.py: added InteractiveShell.getapi(). New magics should be
1054 1063 written doing self.getapi() instead of using the shell directly.
1055 1064
1056 1065 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1057 1066 %store foo >> ~/myfoo.txt to store variables to files (in clean
1058 1067 textual form, not a restorable pickle).
1059 1068
1060 1069 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1061 1070
1062 1071 * usage.py, Magic.py: added %quickref
1063 1072
1064 1073 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1065 1074
1066 1075 * GetoptErrors when invoking magics etc. with wrong args
1067 1076 are now more helpful:
1068 1077 GetoptError: option -l not recognized (allowed: "qb" )
1069 1078
1070 1079 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1071 1080
1072 1081 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1073 1082 computationally intensive blocks don't appear to stall the demo.
1074 1083
1075 1084 2006-01-24 Ville Vainio <vivainio@gmail.com>
1076 1085
1077 1086 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1078 1087 value to manipulate resulting history entry.
1079 1088
1080 1089 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1081 1090 to instance methods of IPApi class, to make extending an embedded
1082 1091 IPython feasible. See ext_rehashdir.py for example usage.
1083 1092
1084 1093 * Merged 1071-1076 from branches/0.7.1
1085 1094
1086 1095
1087 1096 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1088 1097
1089 1098 * tools/release (daystamp): Fix build tools to use the new
1090 1099 eggsetup.py script to build lightweight eggs.
1091 1100
1092 1101 * Applied changesets 1062 and 1064 before 0.7.1 release.
1093 1102
1094 1103 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1095 1104 see the raw input history (without conversions like %ls ->
1096 1105 ipmagic("ls")). After a request from W. Stein, SAGE
1097 1106 (http://modular.ucsd.edu/sage) developer. This information is
1098 1107 stored in the input_hist_raw attribute of the IPython instance, so
1099 1108 developers can access it if needed (it's an InputList instance).
1100 1109
1101 1110 * Versionstring = 0.7.2.svn
1102 1111
1103 1112 * eggsetup.py: A separate script for constructing eggs, creates
1104 1113 proper launch scripts even on Windows (an .exe file in
1105 1114 \python24\scripts).
1106 1115
1107 1116 * ipapi.py: launch_new_instance, launch entry point needed for the
1108 1117 egg.
1109 1118
1110 1119 2006-01-23 Ville Vainio <vivainio@gmail.com>
1111 1120
1112 1121 * Added %cpaste magic for pasting python code
1113 1122
1114 1123 2006-01-22 Ville Vainio <vivainio@gmail.com>
1115 1124
1116 1125 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1117 1126
1118 1127 * Versionstring = 0.7.2.svn
1119 1128
1120 1129 * eggsetup.py: A separate script for constructing eggs, creates
1121 1130 proper launch scripts even on Windows (an .exe file in
1122 1131 \python24\scripts).
1123 1132
1124 1133 * ipapi.py: launch_new_instance, launch entry point needed for the
1125 1134 egg.
1126 1135
1127 1136 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1128 1137
1129 1138 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1130 1139 %pfile foo would print the file for foo even if it was a binary.
1131 1140 Now, extensions '.so' and '.dll' are skipped.
1132 1141
1133 1142 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1134 1143 bug, where macros would fail in all threaded modes. I'm not 100%
1135 1144 sure, so I'm going to put out an rc instead of making a release
1136 1145 today, and wait for feedback for at least a few days.
1137 1146
1138 1147 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1139 1148 it...) the handling of pasting external code with autoindent on.
1140 1149 To get out of a multiline input, the rule will appear for most
1141 1150 users unchanged: two blank lines or change the indent level
1142 1151 proposed by IPython. But there is a twist now: you can
1143 1152 add/subtract only *one or two spaces*. If you add/subtract three
1144 1153 or more (unless you completely delete the line), IPython will
1145 1154 accept that line, and you'll need to enter a second one of pure
1146 1155 whitespace. I know it sounds complicated, but I can't find a
1147 1156 different solution that covers all the cases, with the right
1148 1157 heuristics. Hopefully in actual use, nobody will really notice
1149 1158 all these strange rules and things will 'just work'.
1150 1159
1151 1160 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1152 1161
1153 1162 * IPython/iplib.py (interact): catch exceptions which can be
1154 1163 triggered asynchronously by signal handlers. Thanks to an
1155 1164 automatic crash report, submitted by Colin Kingsley
1156 1165 <tercel-AT-gentoo.org>.
1157 1166
1158 1167 2006-01-20 Ville Vainio <vivainio@gmail.com>
1159 1168
1160 1169 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1161 1170 (%rehashdir, very useful, try it out) of how to extend ipython
1162 1171 with new magics. Also added Extensions dir to pythonpath to make
1163 1172 importing extensions easy.
1164 1173
1165 1174 * %store now complains when trying to store interactively declared
1166 1175 classes / instances of those classes.
1167 1176
1168 1177 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1169 1178 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1170 1179 if they exist, and ipy_user_conf.py with some defaults is created for
1171 1180 the user.
1172 1181
1173 1182 * Startup rehashing done by the config file, not InterpreterExec.
1174 1183 This means system commands are available even without selecting the
1175 1184 pysh profile. It's the sensible default after all.
1176 1185
1177 1186 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1178 1187
1179 1188 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1180 1189 multiline code with autoindent on working. But I am really not
1181 1190 sure, so this needs more testing. Will commit a debug-enabled
1182 1191 version for now, while I test it some more, so that Ville and
1183 1192 others may also catch any problems. Also made
1184 1193 self.indent_current_str() a method, to ensure that there's no
1185 1194 chance of the indent space count and the corresponding string
1186 1195 falling out of sync. All code needing the string should just call
1187 1196 the method.
1188 1197
1189 1198 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1190 1199
1191 1200 * IPython/Magic.py (magic_edit): fix check for when users don't
1192 1201 save their output files, the try/except was in the wrong section.
1193 1202
1194 1203 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1195 1204
1196 1205 * IPython/Magic.py (magic_run): fix __file__ global missing from
1197 1206 script's namespace when executed via %run. After a report by
1198 1207 Vivian.
1199 1208
1200 1209 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1201 1210 when using python 2.4. The parent constructor changed in 2.4, and
1202 1211 we need to track it directly (we can't call it, as it messes up
1203 1212 readline and tab-completion inside our pdb would stop working).
1204 1213 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1205 1214
1206 1215 2006-01-16 Ville Vainio <vivainio@gmail.com>
1207 1216
1208 1217 * Ipython/magic.py: Reverted back to old %edit functionality
1209 1218 that returns file contents on exit.
1210 1219
1211 1220 * IPython/path.py: Added Jason Orendorff's "path" module to
1212 1221 IPython tree, http://www.jorendorff.com/articles/python/path/.
1213 1222 You can get path objects conveniently through %sc, and !!, e.g.:
1214 1223 sc files=ls
1215 1224 for p in files.paths: # or files.p
1216 1225 print p,p.mtime
1217 1226
1218 1227 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1219 1228 now work again without considering the exclusion regexp -
1220 1229 hence, things like ',foo my/path' turn to 'foo("my/path")'
1221 1230 instead of syntax error.
1222 1231
1223 1232
1224 1233 2006-01-14 Ville Vainio <vivainio@gmail.com>
1225 1234
1226 1235 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1227 1236 ipapi decorators for python 2.4 users, options() provides access to rc
1228 1237 data.
1229 1238
1230 1239 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1231 1240 as path separators (even on Linux ;-). Space character after
1232 1241 backslash (as yielded by tab completer) is still space;
1233 1242 "%cd long\ name" works as expected.
1234 1243
1235 1244 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1236 1245 as "chain of command", with priority. API stays the same,
1237 1246 TryNext exception raised by a hook function signals that
1238 1247 current hook failed and next hook should try handling it, as
1239 1248 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
1240 1249 requested configurable display hook, which is now implemented.
1241 1250
1242 1251 2006-01-13 Ville Vainio <vivainio@gmail.com>
1243 1252
1244 1253 * IPython/platutils*.py: platform specific utility functions,
1245 1254 so far only set_term_title is implemented (change terminal
1246 1255 label in windowing systems). %cd now changes the title to
1247 1256 current dir.
1248 1257
1249 1258 * IPython/Release.py: Added myself to "authors" list,
1250 1259 had to create new files.
1251 1260
1252 1261 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1253 1262 shell escape; not a known bug but had potential to be one in the
1254 1263 future.
1255 1264
1256 1265 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1257 1266 extension API for IPython! See the module for usage example. Fix
1258 1267 OInspect for docstring-less magic functions.
1259 1268
1260 1269
1261 1270 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1262 1271
1263 1272 * IPython/iplib.py (raw_input): temporarily deactivate all
1264 1273 attempts at allowing pasting of code with autoindent on. It
1265 1274 introduced bugs (reported by Prabhu) and I can't seem to find a
1266 1275 robust combination which works in all cases. Will have to revisit
1267 1276 later.
1268 1277
1269 1278 * IPython/genutils.py: remove isspace() function. We've dropped
1270 1279 2.2 compatibility, so it's OK to use the string method.
1271 1280
1272 1281 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1273 1282
1274 1283 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1275 1284 matching what NOT to autocall on, to include all python binary
1276 1285 operators (including things like 'and', 'or', 'is' and 'in').
1277 1286 Prompted by a bug report on 'foo & bar', but I realized we had
1278 1287 many more potential bug cases with other operators. The regexp is
1279 1288 self.re_exclude_auto, it's fairly commented.
1280 1289
1281 1290 2006-01-12 Ville Vainio <vivainio@gmail.com>
1282 1291
1283 1292 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1284 1293 Prettified and hardened string/backslash quoting with ipsystem(),
1285 1294 ipalias() and ipmagic(). Now even \ characters are passed to
1286 1295 %magics, !shell escapes and aliases exactly as they are in the
1287 1296 ipython command line. Should improve backslash experience,
1288 1297 particularly in Windows (path delimiter for some commands that
1289 1298 won't understand '/'), but Unix benefits as well (regexps). %cd
1290 1299 magic still doesn't support backslash path delimiters, though. Also
1291 1300 deleted all pretense of supporting multiline command strings in
1292 1301 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1293 1302
1294 1303 * doc/build_doc_instructions.txt added. Documentation on how to
1295 1304 use doc/update_manual.py, added yesterday. Both files contributed
1296 1305 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1297 1306 doc/*.sh for deprecation at a later date.
1298 1307
1299 1308 * /ipython.py Added ipython.py to root directory for
1300 1309 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1301 1310 ipython.py) and development convenience (no need to keep doing
1302 1311 "setup.py install" between changes).
1303 1312
1304 1313 * Made ! and !! shell escapes work (again) in multiline expressions:
1305 1314 if 1:
1306 1315 !ls
1307 1316 !!ls
1308 1317
1309 1318 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1310 1319
1311 1320 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1312 1321 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1313 1322 module in case-insensitive installation. Was causing crashes
1314 1323 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1315 1324
1316 1325 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1317 1326 <marienz-AT-gentoo.org>, closes
1318 1327 http://www.scipy.net/roundup/ipython/issue51.
1319 1328
1320 1329 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1321 1330
1322 1331 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1323 1332 problem of excessive CPU usage under *nix and keyboard lag under
1324 1333 win32.
1325 1334
1326 1335 2006-01-10 *** Released version 0.7.0
1327 1336
1328 1337 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1329 1338
1330 1339 * IPython/Release.py (revision): tag version number to 0.7.0,
1331 1340 ready for release.
1332 1341
1333 1342 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1334 1343 it informs the user of the name of the temp. file used. This can
1335 1344 help if you decide later to reuse that same file, so you know
1336 1345 where to copy the info from.
1337 1346
1338 1347 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1339 1348
1340 1349 * setup_bdist_egg.py: little script to build an egg. Added
1341 1350 support in the release tools as well.
1342 1351
1343 1352 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1344 1353
1345 1354 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1346 1355 version selection (new -wxversion command line and ipythonrc
1347 1356 parameter). Patch contributed by Arnd Baecker
1348 1357 <arnd.baecker-AT-web.de>.
1349 1358
1350 1359 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1351 1360 embedded instances, for variables defined at the interactive
1352 1361 prompt of the embedded ipython. Reported by Arnd.
1353 1362
1354 1363 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1355 1364 it can be used as a (stateful) toggle, or with a direct parameter.
1356 1365
1357 1366 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1358 1367 could be triggered in certain cases and cause the traceback
1359 1368 printer not to work.
1360 1369
1361 1370 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1362 1371
1363 1372 * IPython/iplib.py (_should_recompile): Small fix, closes
1364 1373 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1365 1374
1366 1375 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1367 1376
1368 1377 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1369 1378 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1370 1379 Moad for help with tracking it down.
1371 1380
1372 1381 * IPython/iplib.py (handle_auto): fix autocall handling for
1373 1382 objects which support BOTH __getitem__ and __call__ (so that f [x]
1374 1383 is left alone, instead of becoming f([x]) automatically).
1375 1384
1376 1385 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1377 1386 Ville's patch.
1378 1387
1379 1388 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1380 1389
1381 1390 * IPython/iplib.py (handle_auto): changed autocall semantics to
1382 1391 include 'smart' mode, where the autocall transformation is NOT
1383 1392 applied if there are no arguments on the line. This allows you to
1384 1393 just type 'foo' if foo is a callable to see its internal form,
1385 1394 instead of having it called with no arguments (typically a
1386 1395 mistake). The old 'full' autocall still exists: for that, you
1387 1396 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1388 1397
1389 1398 * IPython/completer.py (Completer.attr_matches): add
1390 1399 tab-completion support for Enthoughts' traits. After a report by
1391 1400 Arnd and a patch by Prabhu.
1392 1401
1393 1402 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1394 1403
1395 1404 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1396 1405 Schmolck's patch to fix inspect.getinnerframes().
1397 1406
1398 1407 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1399 1408 for embedded instances, regarding handling of namespaces and items
1400 1409 added to the __builtin__ one. Multiple embedded instances and
1401 1410 recursive embeddings should work better now (though I'm not sure
1402 1411 I've got all the corner cases fixed, that code is a bit of a brain
1403 1412 twister).
1404 1413
1405 1414 * IPython/Magic.py (magic_edit): added support to edit in-memory
1406 1415 macros (automatically creates the necessary temp files). %edit
1407 1416 also doesn't return the file contents anymore, it's just noise.
1408 1417
1409 1418 * IPython/completer.py (Completer.attr_matches): revert change to
1410 1419 complete only on attributes listed in __all__. I realized it
1411 1420 cripples the tab-completion system as a tool for exploring the
1412 1421 internals of unknown libraries (it renders any non-__all__
1413 1422 attribute off-limits). I got bit by this when trying to see
1414 1423 something inside the dis module.
1415 1424
1416 1425 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1417 1426
1418 1427 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1419 1428 namespace for users and extension writers to hold data in. This
1420 1429 follows the discussion in
1421 1430 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1422 1431
1423 1432 * IPython/completer.py (IPCompleter.complete): small patch to help
1424 1433 tab-completion under Emacs, after a suggestion by John Barnard
1425 1434 <barnarj-AT-ccf.org>.
1426 1435
1427 1436 * IPython/Magic.py (Magic.extract_input_slices): added support for
1428 1437 the slice notation in magics to use N-M to represent numbers N...M
1429 1438 (closed endpoints). This is used by %macro and %save.
1430 1439
1431 1440 * IPython/completer.py (Completer.attr_matches): for modules which
1432 1441 define __all__, complete only on those. After a patch by Jeffrey
1433 1442 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1434 1443 speed up this routine.
1435 1444
1436 1445 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1437 1446 don't know if this is the end of it, but the behavior now is
1438 1447 certainly much more correct. Note that coupled with macros,
1439 1448 slightly surprising (at first) behavior may occur: a macro will in
1440 1449 general expand to multiple lines of input, so upon exiting, the
1441 1450 in/out counters will both be bumped by the corresponding amount
1442 1451 (as if the macro's contents had been typed interactively). Typing
1443 1452 %hist will reveal the intermediate (silently processed) lines.
1444 1453
1445 1454 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1446 1455 pickle to fail (%run was overwriting __main__ and not restoring
1447 1456 it, but pickle relies on __main__ to operate).
1448 1457
1449 1458 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1450 1459 using properties, but forgot to make the main InteractiveShell
1451 1460 class a new-style class. Properties fail silently, and
1452 1461 mysteriously, with old-style class (getters work, but
1453 1462 setters don't do anything).
1454 1463
1455 1464 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1456 1465
1457 1466 * IPython/Magic.py (magic_history): fix history reporting bug (I
1458 1467 know some nasties are still there, I just can't seem to find a
1459 1468 reproducible test case to track them down; the input history is
1460 1469 falling out of sync...)
1461 1470
1462 1471 * IPython/iplib.py (handle_shell_escape): fix bug where both
1463 1472 aliases and system accesses where broken for indented code (such
1464 1473 as loops).
1465 1474
1466 1475 * IPython/genutils.py (shell): fix small but critical bug for
1467 1476 win32 system access.
1468 1477
1469 1478 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1470 1479
1471 1480 * IPython/iplib.py (showtraceback): remove use of the
1472 1481 sys.last_{type/value/traceback} structures, which are non
1473 1482 thread-safe.
1474 1483 (_prefilter): change control flow to ensure that we NEVER
1475 1484 introspect objects when autocall is off. This will guarantee that
1476 1485 having an input line of the form 'x.y', where access to attribute
1477 1486 'y' has side effects, doesn't trigger the side effect TWICE. It
1478 1487 is important to note that, with autocall on, these side effects
1479 1488 can still happen.
1480 1489 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1481 1490 trio. IPython offers these three kinds of special calls which are
1482 1491 not python code, and it's a good thing to have their call method
1483 1492 be accessible as pure python functions (not just special syntax at
1484 1493 the command line). It gives us a better internal implementation
1485 1494 structure, as well as exposing these for user scripting more
1486 1495 cleanly.
1487 1496
1488 1497 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1489 1498 file. Now that they'll be more likely to be used with the
1490 1499 persistance system (%store), I want to make sure their module path
1491 1500 doesn't change in the future, so that we don't break things for
1492 1501 users' persisted data.
1493 1502
1494 1503 * IPython/iplib.py (autoindent_update): move indentation
1495 1504 management into the _text_ processing loop, not the keyboard
1496 1505 interactive one. This is necessary to correctly process non-typed
1497 1506 multiline input (such as macros).
1498 1507
1499 1508 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1500 1509 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1501 1510 which was producing problems in the resulting manual.
1502 1511 (magic_whos): improve reporting of instances (show their class,
1503 1512 instead of simply printing 'instance' which isn't terribly
1504 1513 informative).
1505 1514
1506 1515 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1507 1516 (minor mods) to support network shares under win32.
1508 1517
1509 1518 * IPython/winconsole.py (get_console_size): add new winconsole
1510 1519 module and fixes to page_dumb() to improve its behavior under
1511 1520 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1512 1521
1513 1522 * IPython/Magic.py (Macro): simplified Macro class to just
1514 1523 subclass list. We've had only 2.2 compatibility for a very long
1515 1524 time, yet I was still avoiding subclassing the builtin types. No
1516 1525 more (I'm also starting to use properties, though I won't shift to
1517 1526 2.3-specific features quite yet).
1518 1527 (magic_store): added Ville's patch for lightweight variable
1519 1528 persistence, after a request on the user list by Matt Wilkie
1520 1529 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1521 1530 details.
1522 1531
1523 1532 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1524 1533 changed the default logfile name from 'ipython.log' to
1525 1534 'ipython_log.py'. These logs are real python files, and now that
1526 1535 we have much better multiline support, people are more likely to
1527 1536 want to use them as such. Might as well name them correctly.
1528 1537
1529 1538 * IPython/Magic.py: substantial cleanup. While we can't stop
1530 1539 using magics as mixins, due to the existing customizations 'out
1531 1540 there' which rely on the mixin naming conventions, at least I
1532 1541 cleaned out all cross-class name usage. So once we are OK with
1533 1542 breaking compatibility, the two systems can be separated.
1534 1543
1535 1544 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1536 1545 anymore, and the class is a fair bit less hideous as well. New
1537 1546 features were also introduced: timestamping of input, and logging
1538 1547 of output results. These are user-visible with the -t and -o
1539 1548 options to %logstart. Closes
1540 1549 http://www.scipy.net/roundup/ipython/issue11 and a request by
1541 1550 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1542 1551
1543 1552 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1544 1553
1545 1554 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1546 1555 better handle backslashes in paths. See the thread 'More Windows
1547 1556 questions part 2 - \/ characters revisited' on the iypthon user
1548 1557 list:
1549 1558 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1550 1559
1551 1560 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1552 1561
1553 1562 (InteractiveShell.__init__): change threaded shells to not use the
1554 1563 ipython crash handler. This was causing more problems than not,
1555 1564 as exceptions in the main thread (GUI code, typically) would
1556 1565 always show up as a 'crash', when they really weren't.
1557 1566
1558 1567 The colors and exception mode commands (%colors/%xmode) have been
1559 1568 synchronized to also take this into account, so users can get
1560 1569 verbose exceptions for their threaded code as well. I also added
1561 1570 support for activating pdb inside this exception handler as well,
1562 1571 so now GUI authors can use IPython's enhanced pdb at runtime.
1563 1572
1564 1573 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1565 1574 true by default, and add it to the shipped ipythonrc file. Since
1566 1575 this asks the user before proceeding, I think it's OK to make it
1567 1576 true by default.
1568 1577
1569 1578 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1570 1579 of the previous special-casing of input in the eval loop. I think
1571 1580 this is cleaner, as they really are commands and shouldn't have
1572 1581 a special role in the middle of the core code.
1573 1582
1574 1583 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1575 1584
1576 1585 * IPython/iplib.py (edit_syntax_error): added support for
1577 1586 automatically reopening the editor if the file had a syntax error
1578 1587 in it. Thanks to scottt who provided the patch at:
1579 1588 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1580 1589 version committed).
1581 1590
1582 1591 * IPython/iplib.py (handle_normal): add suport for multi-line
1583 1592 input with emtpy lines. This fixes
1584 1593 http://www.scipy.net/roundup/ipython/issue43 and a similar
1585 1594 discussion on the user list.
1586 1595
1587 1596 WARNING: a behavior change is necessarily introduced to support
1588 1597 blank lines: now a single blank line with whitespace does NOT
1589 1598 break the input loop, which means that when autoindent is on, by
1590 1599 default hitting return on the next (indented) line does NOT exit.
1591 1600
1592 1601 Instead, to exit a multiline input you can either have:
1593 1602
1594 1603 - TWO whitespace lines (just hit return again), or
1595 1604 - a single whitespace line of a different length than provided
1596 1605 by the autoindent (add or remove a space).
1597 1606
1598 1607 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1599 1608 module to better organize all readline-related functionality.
1600 1609 I've deleted FlexCompleter and put all completion clases here.
1601 1610
1602 1611 * IPython/iplib.py (raw_input): improve indentation management.
1603 1612 It is now possible to paste indented code with autoindent on, and
1604 1613 the code is interpreted correctly (though it still looks bad on
1605 1614 screen, due to the line-oriented nature of ipython).
1606 1615 (MagicCompleter.complete): change behavior so that a TAB key on an
1607 1616 otherwise empty line actually inserts a tab, instead of completing
1608 1617 on the entire global namespace. This makes it easier to use the
1609 1618 TAB key for indentation. After a request by Hans Meine
1610 1619 <hans_meine-AT-gmx.net>
1611 1620 (_prefilter): add support so that typing plain 'exit' or 'quit'
1612 1621 does a sensible thing. Originally I tried to deviate as little as
1613 1622 possible from the default python behavior, but even that one may
1614 1623 change in this direction (thread on python-dev to that effect).
1615 1624 Regardless, ipython should do the right thing even if CPython's
1616 1625 '>>>' prompt doesn't.
1617 1626 (InteractiveShell): removed subclassing code.InteractiveConsole
1618 1627 class. By now we'd overridden just about all of its methods: I've
1619 1628 copied the remaining two over, and now ipython is a standalone
1620 1629 class. This will provide a clearer picture for the chainsaw
1621 1630 branch refactoring.
1622 1631
1623 1632 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1624 1633
1625 1634 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1626 1635 failures for objects which break when dir() is called on them.
1627 1636
1628 1637 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1629 1638 distinct local and global namespaces in the completer API. This
1630 1639 change allows us to properly handle completion with distinct
1631 1640 scopes, including in embedded instances (this had never really
1632 1641 worked correctly).
1633 1642
1634 1643 Note: this introduces a change in the constructor for
1635 1644 MagicCompleter, as a new global_namespace parameter is now the
1636 1645 second argument (the others were bumped one position).
1637 1646
1638 1647 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1639 1648
1640 1649 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1641 1650 embedded instances (which can be done now thanks to Vivian's
1642 1651 frame-handling fixes for pdb).
1643 1652 (InteractiveShell.__init__): Fix namespace handling problem in
1644 1653 embedded instances. We were overwriting __main__ unconditionally,
1645 1654 and this should only be done for 'full' (non-embedded) IPython;
1646 1655 embedded instances must respect the caller's __main__. Thanks to
1647 1656 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1648 1657
1649 1658 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1650 1659
1651 1660 * setup.py: added download_url to setup(). This registers the
1652 1661 download address at PyPI, which is not only useful to humans
1653 1662 browsing the site, but is also picked up by setuptools (the Eggs
1654 1663 machinery). Thanks to Ville and R. Kern for the info/discussion
1655 1664 on this.
1656 1665
1657 1666 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1658 1667
1659 1668 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1660 1669 This brings a lot of nice functionality to the pdb mode, which now
1661 1670 has tab-completion, syntax highlighting, and better stack handling
1662 1671 than before. Many thanks to Vivian De Smedt
1663 1672 <vivian-AT-vdesmedt.com> for the original patches.
1664 1673
1665 1674 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1666 1675
1667 1676 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1668 1677 sequence to consistently accept the banner argument. The
1669 1678 inconsistency was tripping SAGE, thanks to Gary Zablackis
1670 1679 <gzabl-AT-yahoo.com> for the report.
1671 1680
1672 1681 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1673 1682
1674 1683 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1675 1684 Fix bug where a naked 'alias' call in the ipythonrc file would
1676 1685 cause a crash. Bug reported by Jorgen Stenarson.
1677 1686
1678 1687 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1679 1688
1680 1689 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1681 1690 startup time.
1682 1691
1683 1692 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1684 1693 instances had introduced a bug with globals in normal code. Now
1685 1694 it's working in all cases.
1686 1695
1687 1696 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1688 1697 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1689 1698 has been introduced to set the default case sensitivity of the
1690 1699 searches. Users can still select either mode at runtime on a
1691 1700 per-search basis.
1692 1701
1693 1702 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1694 1703
1695 1704 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1696 1705 attributes in wildcard searches for subclasses. Modified version
1697 1706 of a patch by Jorgen.
1698 1707
1699 1708 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1700 1709
1701 1710 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1702 1711 embedded instances. I added a user_global_ns attribute to the
1703 1712 InteractiveShell class to handle this.
1704 1713
1705 1714 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1706 1715
1707 1716 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1708 1717 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1709 1718 (reported under win32, but may happen also in other platforms).
1710 1719 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1711 1720
1712 1721 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1713 1722
1714 1723 * IPython/Magic.py (magic_psearch): new support for wildcard
1715 1724 patterns. Now, typing ?a*b will list all names which begin with a
1716 1725 and end in b, for example. The %psearch magic has full
1717 1726 docstrings. Many thanks to Jörgen Stenarson
1718 1727 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1719 1728 implementing this functionality.
1720 1729
1721 1730 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1722 1731
1723 1732 * Manual: fixed long-standing annoyance of double-dashes (as in
1724 1733 --prefix=~, for example) being stripped in the HTML version. This
1725 1734 is a latex2html bug, but a workaround was provided. Many thanks
1726 1735 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1727 1736 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1728 1737 rolling. This seemingly small issue had tripped a number of users
1729 1738 when first installing, so I'm glad to see it gone.
1730 1739
1731 1740 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1732 1741
1733 1742 * IPython/Extensions/numeric_formats.py: fix missing import,
1734 1743 reported by Stephen Walton.
1735 1744
1736 1745 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1737 1746
1738 1747 * IPython/demo.py: finish demo module, fully documented now.
1739 1748
1740 1749 * IPython/genutils.py (file_read): simple little utility to read a
1741 1750 file and ensure it's closed afterwards.
1742 1751
1743 1752 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1744 1753
1745 1754 * IPython/demo.py (Demo.__init__): added support for individually
1746 1755 tagging blocks for automatic execution.
1747 1756
1748 1757 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1749 1758 syntax-highlighted python sources, requested by John.
1750 1759
1751 1760 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1752 1761
1753 1762 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1754 1763 finishing.
1755 1764
1756 1765 * IPython/genutils.py (shlex_split): moved from Magic to here,
1757 1766 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1758 1767
1759 1768 * IPython/demo.py (Demo.__init__): added support for silent
1760 1769 blocks, improved marks as regexps, docstrings written.
1761 1770 (Demo.__init__): better docstring, added support for sys.argv.
1762 1771
1763 1772 * IPython/genutils.py (marquee): little utility used by the demo
1764 1773 code, handy in general.
1765 1774
1766 1775 * IPython/demo.py (Demo.__init__): new class for interactive
1767 1776 demos. Not documented yet, I just wrote it in a hurry for
1768 1777 scipy'05. Will docstring later.
1769 1778
1770 1779 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1771 1780
1772 1781 * IPython/Shell.py (sigint_handler): Drastic simplification which
1773 1782 also seems to make Ctrl-C work correctly across threads! This is
1774 1783 so simple, that I can't beleive I'd missed it before. Needs more
1775 1784 testing, though.
1776 1785 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1777 1786 like this before...
1778 1787
1779 1788 * IPython/genutils.py (get_home_dir): add protection against
1780 1789 non-dirs in win32 registry.
1781 1790
1782 1791 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1783 1792 bug where dict was mutated while iterating (pysh crash).
1784 1793
1785 1794 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1786 1795
1787 1796 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1788 1797 spurious newlines added by this routine. After a report by
1789 1798 F. Mantegazza.
1790 1799
1791 1800 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1792 1801
1793 1802 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1794 1803 calls. These were a leftover from the GTK 1.x days, and can cause
1795 1804 problems in certain cases (after a report by John Hunter).
1796 1805
1797 1806 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1798 1807 os.getcwd() fails at init time. Thanks to patch from David Remahl
1799 1808 <chmod007-AT-mac.com>.
1800 1809 (InteractiveShell.__init__): prevent certain special magics from
1801 1810 being shadowed by aliases. Closes
1802 1811 http://www.scipy.net/roundup/ipython/issue41.
1803 1812
1804 1813 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1805 1814
1806 1815 * IPython/iplib.py (InteractiveShell.complete): Added new
1807 1816 top-level completion method to expose the completion mechanism
1808 1817 beyond readline-based environments.
1809 1818
1810 1819 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1811 1820
1812 1821 * tools/ipsvnc (svnversion): fix svnversion capture.
1813 1822
1814 1823 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1815 1824 attribute to self, which was missing. Before, it was set by a
1816 1825 routine which in certain cases wasn't being called, so the
1817 1826 instance could end up missing the attribute. This caused a crash.
1818 1827 Closes http://www.scipy.net/roundup/ipython/issue40.
1819 1828
1820 1829 2005-08-16 Fernando Perez <fperez@colorado.edu>
1821 1830
1822 1831 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1823 1832 contains non-string attribute. Closes
1824 1833 http://www.scipy.net/roundup/ipython/issue38.
1825 1834
1826 1835 2005-08-14 Fernando Perez <fperez@colorado.edu>
1827 1836
1828 1837 * tools/ipsvnc: Minor improvements, to add changeset info.
1829 1838
1830 1839 2005-08-12 Fernando Perez <fperez@colorado.edu>
1831 1840
1832 1841 * IPython/iplib.py (runsource): remove self.code_to_run_src
1833 1842 attribute. I realized this is nothing more than
1834 1843 '\n'.join(self.buffer), and having the same data in two different
1835 1844 places is just asking for synchronization bugs. This may impact
1836 1845 people who have custom exception handlers, so I need to warn
1837 1846 ipython-dev about it (F. Mantegazza may use them).
1838 1847
1839 1848 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1840 1849
1841 1850 * IPython/genutils.py: fix 2.2 compatibility (generators)
1842 1851
1843 1852 2005-07-18 Fernando Perez <fperez@colorado.edu>
1844 1853
1845 1854 * IPython/genutils.py (get_home_dir): fix to help users with
1846 1855 invalid $HOME under win32.
1847 1856
1848 1857 2005-07-17 Fernando Perez <fperez@colorado.edu>
1849 1858
1850 1859 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1851 1860 some old hacks and clean up a bit other routines; code should be
1852 1861 simpler and a bit faster.
1853 1862
1854 1863 * IPython/iplib.py (interact): removed some last-resort attempts
1855 1864 to survive broken stdout/stderr. That code was only making it
1856 1865 harder to abstract out the i/o (necessary for gui integration),
1857 1866 and the crashes it could prevent were extremely rare in practice
1858 1867 (besides being fully user-induced in a pretty violent manner).
1859 1868
1860 1869 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1861 1870 Nothing major yet, but the code is simpler to read; this should
1862 1871 make it easier to do more serious modifications in the future.
1863 1872
1864 1873 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1865 1874 which broke in .15 (thanks to a report by Ville).
1866 1875
1867 1876 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1868 1877 be quite correct, I know next to nothing about unicode). This
1869 1878 will allow unicode strings to be used in prompts, amongst other
1870 1879 cases. It also will prevent ipython from crashing when unicode
1871 1880 shows up unexpectedly in many places. If ascii encoding fails, we
1872 1881 assume utf_8. Currently the encoding is not a user-visible
1873 1882 setting, though it could be made so if there is demand for it.
1874 1883
1875 1884 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1876 1885
1877 1886 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1878 1887
1879 1888 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1880 1889
1881 1890 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1882 1891 code can work transparently for 2.2/2.3.
1883 1892
1884 1893 2005-07-16 Fernando Perez <fperez@colorado.edu>
1885 1894
1886 1895 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1887 1896 out of the color scheme table used for coloring exception
1888 1897 tracebacks. This allows user code to add new schemes at runtime.
1889 1898 This is a minimally modified version of the patch at
1890 1899 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1891 1900 for the contribution.
1892 1901
1893 1902 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1894 1903 slightly modified version of the patch in
1895 1904 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1896 1905 to remove the previous try/except solution (which was costlier).
1897 1906 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1898 1907
1899 1908 2005-06-08 Fernando Perez <fperez@colorado.edu>
1900 1909
1901 1910 * IPython/iplib.py (write/write_err): Add methods to abstract all
1902 1911 I/O a bit more.
1903 1912
1904 1913 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1905 1914 warning, reported by Aric Hagberg, fix by JD Hunter.
1906 1915
1907 1916 2005-06-02 *** Released version 0.6.15
1908 1917
1909 1918 2005-06-01 Fernando Perez <fperez@colorado.edu>
1910 1919
1911 1920 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1912 1921 tab-completion of filenames within open-quoted strings. Note that
1913 1922 this requires that in ~/.ipython/ipythonrc, users change the
1914 1923 readline delimiters configuration to read:
1915 1924
1916 1925 readline_remove_delims -/~
1917 1926
1918 1927
1919 1928 2005-05-31 *** Released version 0.6.14
1920 1929
1921 1930 2005-05-29 Fernando Perez <fperez@colorado.edu>
1922 1931
1923 1932 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1924 1933 with files not on the filesystem. Reported by Eliyahu Sandler
1925 1934 <eli@gondolin.net>
1926 1935
1927 1936 2005-05-22 Fernando Perez <fperez@colorado.edu>
1928 1937
1929 1938 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1930 1939 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1931 1940
1932 1941 2005-05-19 Fernando Perez <fperez@colorado.edu>
1933 1942
1934 1943 * IPython/iplib.py (safe_execfile): close a file which could be
1935 1944 left open (causing problems in win32, which locks open files).
1936 1945 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1937 1946
1938 1947 2005-05-18 Fernando Perez <fperez@colorado.edu>
1939 1948
1940 1949 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1941 1950 keyword arguments correctly to safe_execfile().
1942 1951
1943 1952 2005-05-13 Fernando Perez <fperez@colorado.edu>
1944 1953
1945 1954 * ipython.1: Added info about Qt to manpage, and threads warning
1946 1955 to usage page (invoked with --help).
1947 1956
1948 1957 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1949 1958 new matcher (it goes at the end of the priority list) to do
1950 1959 tab-completion on named function arguments. Submitted by George
1951 1960 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1952 1961 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1953 1962 for more details.
1954 1963
1955 1964 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1956 1965 SystemExit exceptions in the script being run. Thanks to a report
1957 1966 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1958 1967 producing very annoying behavior when running unit tests.
1959 1968
1960 1969 2005-05-12 Fernando Perez <fperez@colorado.edu>
1961 1970
1962 1971 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1963 1972 which I'd broken (again) due to a changed regexp. In the process,
1964 1973 added ';' as an escape to auto-quote the whole line without
1965 1974 splitting its arguments. Thanks to a report by Jerry McRae
1966 1975 <qrs0xyc02-AT-sneakemail.com>.
1967 1976
1968 1977 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1969 1978 possible crashes caused by a TokenError. Reported by Ed Schofield
1970 1979 <schofield-AT-ftw.at>.
1971 1980
1972 1981 2005-05-06 Fernando Perez <fperez@colorado.edu>
1973 1982
1974 1983 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1975 1984
1976 1985 2005-04-29 Fernando Perez <fperez@colorado.edu>
1977 1986
1978 1987 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1979 1988 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1980 1989 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1981 1990 which provides support for Qt interactive usage (similar to the
1982 1991 existing one for WX and GTK). This had been often requested.
1983 1992
1984 1993 2005-04-14 *** Released version 0.6.13
1985 1994
1986 1995 2005-04-08 Fernando Perez <fperez@colorado.edu>
1987 1996
1988 1997 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1989 1998 from _ofind, which gets called on almost every input line. Now,
1990 1999 we only try to get docstrings if they are actually going to be
1991 2000 used (the overhead of fetching unnecessary docstrings can be
1992 2001 noticeable for certain objects, such as Pyro proxies).
1993 2002
1994 2003 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1995 2004 for completers. For some reason I had been passing them the state
1996 2005 variable, which completers never actually need, and was in
1997 2006 conflict with the rlcompleter API. Custom completers ONLY need to
1998 2007 take the text parameter.
1999 2008
2000 2009 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2001 2010 work correctly in pysh. I've also moved all the logic which used
2002 2011 to be in pysh.py here, which will prevent problems with future
2003 2012 upgrades. However, this time I must warn users to update their
2004 2013 pysh profile to include the line
2005 2014
2006 2015 import_all IPython.Extensions.InterpreterExec
2007 2016
2008 2017 because otherwise things won't work for them. They MUST also
2009 2018 delete pysh.py and the line
2010 2019
2011 2020 execfile pysh.py
2012 2021
2013 2022 from their ipythonrc-pysh.
2014 2023
2015 2024 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2016 2025 robust in the face of objects whose dir() returns non-strings
2017 2026 (which it shouldn't, but some broken libs like ITK do). Thanks to
2018 2027 a patch by John Hunter (implemented differently, though). Also
2019 2028 minor improvements by using .extend instead of + on lists.
2020 2029
2021 2030 * pysh.py:
2022 2031
2023 2032 2005-04-06 Fernando Perez <fperez@colorado.edu>
2024 2033
2025 2034 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2026 2035 by default, so that all users benefit from it. Those who don't
2027 2036 want it can still turn it off.
2028 2037
2029 2038 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2030 2039 config file, I'd forgotten about this, so users were getting it
2031 2040 off by default.
2032 2041
2033 2042 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2034 2043 consistency. Now magics can be called in multiline statements,
2035 2044 and python variables can be expanded in magic calls via $var.
2036 2045 This makes the magic system behave just like aliases or !system
2037 2046 calls.
2038 2047
2039 2048 2005-03-28 Fernando Perez <fperez@colorado.edu>
2040 2049
2041 2050 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2042 2051 expensive string additions for building command. Add support for
2043 2052 trailing ';' when autocall is used.
2044 2053
2045 2054 2005-03-26 Fernando Perez <fperez@colorado.edu>
2046 2055
2047 2056 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2048 2057 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2049 2058 ipython.el robust against prompts with any number of spaces
2050 2059 (including 0) after the ':' character.
2051 2060
2052 2061 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2053 2062 continuation prompt, which misled users to think the line was
2054 2063 already indented. Closes debian Bug#300847, reported to me by
2055 2064 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2056 2065
2057 2066 2005-03-23 Fernando Perez <fperez@colorado.edu>
2058 2067
2059 2068 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2060 2069 properly aligned if they have embedded newlines.
2061 2070
2062 2071 * IPython/iplib.py (runlines): Add a public method to expose
2063 2072 IPython's code execution machinery, so that users can run strings
2064 2073 as if they had been typed at the prompt interactively.
2065 2074 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2066 2075 methods which can call the system shell, but with python variable
2067 2076 expansion. The three such methods are: __IPYTHON__.system,
2068 2077 .getoutput and .getoutputerror. These need to be documented in a
2069 2078 'public API' section (to be written) of the manual.
2070 2079
2071 2080 2005-03-20 Fernando Perez <fperez@colorado.edu>
2072 2081
2073 2082 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2074 2083 for custom exception handling. This is quite powerful, and it
2075 2084 allows for user-installable exception handlers which can trap
2076 2085 custom exceptions at runtime and treat them separately from
2077 2086 IPython's default mechanisms. At the request of Frédéric
2078 2087 Mantegazza <mantegazza-AT-ill.fr>.
2079 2088 (InteractiveShell.set_custom_completer): public API function to
2080 2089 add new completers at runtime.
2081 2090
2082 2091 2005-03-19 Fernando Perez <fperez@colorado.edu>
2083 2092
2084 2093 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2085 2094 allow objects which provide their docstrings via non-standard
2086 2095 mechanisms (like Pyro proxies) to still be inspected by ipython's
2087 2096 ? system.
2088 2097
2089 2098 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2090 2099 automatic capture system. I tried quite hard to make it work
2091 2100 reliably, and simply failed. I tried many combinations with the
2092 2101 subprocess module, but eventually nothing worked in all needed
2093 2102 cases (not blocking stdin for the child, duplicating stdout
2094 2103 without blocking, etc). The new %sc/%sx still do capture to these
2095 2104 magical list/string objects which make shell use much more
2096 2105 conveninent, so not all is lost.
2097 2106
2098 2107 XXX - FIX MANUAL for the change above!
2099 2108
2100 2109 (runsource): I copied code.py's runsource() into ipython to modify
2101 2110 it a bit. Now the code object and source to be executed are
2102 2111 stored in ipython. This makes this info accessible to third-party
2103 2112 tools, like custom exception handlers. After a request by Frédéric
2104 2113 Mantegazza <mantegazza-AT-ill.fr>.
2105 2114
2106 2115 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2107 2116 history-search via readline (like C-p/C-n). I'd wanted this for a
2108 2117 long time, but only recently found out how to do it. For users
2109 2118 who already have their ipythonrc files made and want this, just
2110 2119 add:
2111 2120
2112 2121 readline_parse_and_bind "\e[A": history-search-backward
2113 2122 readline_parse_and_bind "\e[B": history-search-forward
2114 2123
2115 2124 2005-03-18 Fernando Perez <fperez@colorado.edu>
2116 2125
2117 2126 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2118 2127 LSString and SList classes which allow transparent conversions
2119 2128 between list mode and whitespace-separated string.
2120 2129 (magic_r): Fix recursion problem in %r.
2121 2130
2122 2131 * IPython/genutils.py (LSString): New class to be used for
2123 2132 automatic storage of the results of all alias/system calls in _o
2124 2133 and _e (stdout/err). These provide a .l/.list attribute which
2125 2134 does automatic splitting on newlines. This means that for most
2126 2135 uses, you'll never need to do capturing of output with %sc/%sx
2127 2136 anymore, since ipython keeps this always done for you. Note that
2128 2137 only the LAST results are stored, the _o/e variables are
2129 2138 overwritten on each call. If you need to save their contents
2130 2139 further, simply bind them to any other name.
2131 2140
2132 2141 2005-03-17 Fernando Perez <fperez@colorado.edu>
2133 2142
2134 2143 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2135 2144 prompt namespace handling.
2136 2145
2137 2146 2005-03-16 Fernando Perez <fperez@colorado.edu>
2138 2147
2139 2148 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2140 2149 classic prompts to be '>>> ' (final space was missing, and it
2141 2150 trips the emacs python mode).
2142 2151 (BasePrompt.__str__): Added safe support for dynamic prompt
2143 2152 strings. Now you can set your prompt string to be '$x', and the
2144 2153 value of x will be printed from your interactive namespace. The
2145 2154 interpolation syntax includes the full Itpl support, so
2146 2155 ${foo()+x+bar()} is a valid prompt string now, and the function
2147 2156 calls will be made at runtime.
2148 2157
2149 2158 2005-03-15 Fernando Perez <fperez@colorado.edu>
2150 2159
2151 2160 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2152 2161 avoid name clashes in pylab. %hist still works, it just forwards
2153 2162 the call to %history.
2154 2163
2155 2164 2005-03-02 *** Released version 0.6.12
2156 2165
2157 2166 2005-03-02 Fernando Perez <fperez@colorado.edu>
2158 2167
2159 2168 * IPython/iplib.py (handle_magic): log magic calls properly as
2160 2169 ipmagic() function calls.
2161 2170
2162 2171 * IPython/Magic.py (magic_time): Improved %time to support
2163 2172 statements and provide wall-clock as well as CPU time.
2164 2173
2165 2174 2005-02-27 Fernando Perez <fperez@colorado.edu>
2166 2175
2167 2176 * IPython/hooks.py: New hooks module, to expose user-modifiable
2168 2177 IPython functionality in a clean manner. For now only the editor
2169 2178 hook is actually written, and other thigns which I intend to turn
2170 2179 into proper hooks aren't yet there. The display and prefilter
2171 2180 stuff, for example, should be hooks. But at least now the
2172 2181 framework is in place, and the rest can be moved here with more
2173 2182 time later. IPython had had a .hooks variable for a long time for
2174 2183 this purpose, but I'd never actually used it for anything.
2175 2184
2176 2185 2005-02-26 Fernando Perez <fperez@colorado.edu>
2177 2186
2178 2187 * IPython/ipmaker.py (make_IPython): make the default ipython
2179 2188 directory be called _ipython under win32, to follow more the
2180 2189 naming peculiarities of that platform (where buggy software like
2181 2190 Visual Sourcesafe breaks with .named directories). Reported by
2182 2191 Ville Vainio.
2183 2192
2184 2193 2005-02-23 Fernando Perez <fperez@colorado.edu>
2185 2194
2186 2195 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2187 2196 auto_aliases for win32 which were causing problems. Users can
2188 2197 define the ones they personally like.
2189 2198
2190 2199 2005-02-21 Fernando Perez <fperez@colorado.edu>
2191 2200
2192 2201 * IPython/Magic.py (magic_time): new magic to time execution of
2193 2202 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2194 2203
2195 2204 2005-02-19 Fernando Perez <fperez@colorado.edu>
2196 2205
2197 2206 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2198 2207 into keys (for prompts, for example).
2199 2208
2200 2209 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2201 2210 prompts in case users want them. This introduces a small behavior
2202 2211 change: ipython does not automatically add a space to all prompts
2203 2212 anymore. To get the old prompts with a space, users should add it
2204 2213 manually to their ipythonrc file, so for example prompt_in1 should
2205 2214 now read 'In [\#]: ' instead of 'In [\#]:'.
2206 2215 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2207 2216 file) to control left-padding of secondary prompts.
2208 2217
2209 2218 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2210 2219 the profiler can't be imported. Fix for Debian, which removed
2211 2220 profile.py because of License issues. I applied a slightly
2212 2221 modified version of the original Debian patch at
2213 2222 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2214 2223
2215 2224 2005-02-17 Fernando Perez <fperez@colorado.edu>
2216 2225
2217 2226 * IPython/genutils.py (native_line_ends): Fix bug which would
2218 2227 cause improper line-ends under win32 b/c I was not opening files
2219 2228 in binary mode. Bug report and fix thanks to Ville.
2220 2229
2221 2230 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2222 2231 trying to catch spurious foo[1] autocalls. My fix actually broke
2223 2232 ',/' autoquote/call with explicit escape (bad regexp).
2224 2233
2225 2234 2005-02-15 *** Released version 0.6.11
2226 2235
2227 2236 2005-02-14 Fernando Perez <fperez@colorado.edu>
2228 2237
2229 2238 * IPython/background_jobs.py: New background job management
2230 2239 subsystem. This is implemented via a new set of classes, and
2231 2240 IPython now provides a builtin 'jobs' object for background job
2232 2241 execution. A convenience %bg magic serves as a lightweight
2233 2242 frontend for starting the more common type of calls. This was
2234 2243 inspired by discussions with B. Granger and the BackgroundCommand
2235 2244 class described in the book Python Scripting for Computational
2236 2245 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2237 2246 (although ultimately no code from this text was used, as IPython's
2238 2247 system is a separate implementation).
2239 2248
2240 2249 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2241 2250 to control the completion of single/double underscore names
2242 2251 separately. As documented in the example ipytonrc file, the
2243 2252 readline_omit__names variable can now be set to 2, to omit even
2244 2253 single underscore names. Thanks to a patch by Brian Wong
2245 2254 <BrianWong-AT-AirgoNetworks.Com>.
2246 2255 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2247 2256 be autocalled as foo([1]) if foo were callable. A problem for
2248 2257 things which are both callable and implement __getitem__.
2249 2258 (init_readline): Fix autoindentation for win32. Thanks to a patch
2250 2259 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2251 2260
2252 2261 2005-02-12 Fernando Perez <fperez@colorado.edu>
2253 2262
2254 2263 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2255 2264 which I had written long ago to sort out user error messages which
2256 2265 may occur during startup. This seemed like a good idea initially,
2257 2266 but it has proven a disaster in retrospect. I don't want to
2258 2267 change much code for now, so my fix is to set the internal 'debug'
2259 2268 flag to true everywhere, whose only job was precisely to control
2260 2269 this subsystem. This closes issue 28 (as well as avoiding all
2261 2270 sorts of strange hangups which occur from time to time).
2262 2271
2263 2272 2005-02-07 Fernando Perez <fperez@colorado.edu>
2264 2273
2265 2274 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2266 2275 previous call produced a syntax error.
2267 2276
2268 2277 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2269 2278 classes without constructor.
2270 2279
2271 2280 2005-02-06 Fernando Perez <fperez@colorado.edu>
2272 2281
2273 2282 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2274 2283 completions with the results of each matcher, so we return results
2275 2284 to the user from all namespaces. This breaks with ipython
2276 2285 tradition, but I think it's a nicer behavior. Now you get all
2277 2286 possible completions listed, from all possible namespaces (python,
2278 2287 filesystem, magics...) After a request by John Hunter
2279 2288 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2280 2289
2281 2290 2005-02-05 Fernando Perez <fperez@colorado.edu>
2282 2291
2283 2292 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2284 2293 the call had quote characters in it (the quotes were stripped).
2285 2294
2286 2295 2005-01-31 Fernando Perez <fperez@colorado.edu>
2287 2296
2288 2297 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2289 2298 Itpl.itpl() to make the code more robust against psyco
2290 2299 optimizations.
2291 2300
2292 2301 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2293 2302 of causing an exception. Quicker, cleaner.
2294 2303
2295 2304 2005-01-28 Fernando Perez <fperez@colorado.edu>
2296 2305
2297 2306 * scripts/ipython_win_post_install.py (install): hardcode
2298 2307 sys.prefix+'python.exe' as the executable path. It turns out that
2299 2308 during the post-installation run, sys.executable resolves to the
2300 2309 name of the binary installer! I should report this as a distutils
2301 2310 bug, I think. I updated the .10 release with this tiny fix, to
2302 2311 avoid annoying the lists further.
2303 2312
2304 2313 2005-01-27 *** Released version 0.6.10
2305 2314
2306 2315 2005-01-27 Fernando Perez <fperez@colorado.edu>
2307 2316
2308 2317 * IPython/numutils.py (norm): Added 'inf' as optional name for
2309 2318 L-infinity norm, included references to mathworld.com for vector
2310 2319 norm definitions.
2311 2320 (amin/amax): added amin/amax for array min/max. Similar to what
2312 2321 pylab ships with after the recent reorganization of names.
2313 2322 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2314 2323
2315 2324 * ipython.el: committed Alex's recent fixes and improvements.
2316 2325 Tested with python-mode from CVS, and it looks excellent. Since
2317 2326 python-mode hasn't released anything in a while, I'm temporarily
2318 2327 putting a copy of today's CVS (v 4.70) of python-mode in:
2319 2328 http://ipython.scipy.org/tmp/python-mode.el
2320 2329
2321 2330 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2322 2331 sys.executable for the executable name, instead of assuming it's
2323 2332 called 'python.exe' (the post-installer would have produced broken
2324 2333 setups on systems with a differently named python binary).
2325 2334
2326 2335 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2327 2336 references to os.linesep, to make the code more
2328 2337 platform-independent. This is also part of the win32 coloring
2329 2338 fixes.
2330 2339
2331 2340 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2332 2341 lines, which actually cause coloring bugs because the length of
2333 2342 the line is very difficult to correctly compute with embedded
2334 2343 escapes. This was the source of all the coloring problems under
2335 2344 Win32. I think that _finally_, Win32 users have a properly
2336 2345 working ipython in all respects. This would never have happened
2337 2346 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2338 2347
2339 2348 2005-01-26 *** Released version 0.6.9
2340 2349
2341 2350 2005-01-25 Fernando Perez <fperez@colorado.edu>
2342 2351
2343 2352 * setup.py: finally, we have a true Windows installer, thanks to
2344 2353 the excellent work of Viktor Ransmayr
2345 2354 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2346 2355 Windows users. The setup routine is quite a bit cleaner thanks to
2347 2356 this, and the post-install script uses the proper functions to
2348 2357 allow a clean de-installation using the standard Windows Control
2349 2358 Panel.
2350 2359
2351 2360 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2352 2361 environment variable under all OSes (including win32) if
2353 2362 available. This will give consistency to win32 users who have set
2354 2363 this variable for any reason. If os.environ['HOME'] fails, the
2355 2364 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2356 2365
2357 2366 2005-01-24 Fernando Perez <fperez@colorado.edu>
2358 2367
2359 2368 * IPython/numutils.py (empty_like): add empty_like(), similar to
2360 2369 zeros_like() but taking advantage of the new empty() Numeric routine.
2361 2370
2362 2371 2005-01-23 *** Released version 0.6.8
2363 2372
2364 2373 2005-01-22 Fernando Perez <fperez@colorado.edu>
2365 2374
2366 2375 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2367 2376 automatic show() calls. After discussing things with JDH, it
2368 2377 turns out there are too many corner cases where this can go wrong.
2369 2378 It's best not to try to be 'too smart', and simply have ipython
2370 2379 reproduce as much as possible the default behavior of a normal
2371 2380 python shell.
2372 2381
2373 2382 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2374 2383 line-splitting regexp and _prefilter() to avoid calling getattr()
2375 2384 on assignments. This closes
2376 2385 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2377 2386 readline uses getattr(), so a simple <TAB> keypress is still
2378 2387 enough to trigger getattr() calls on an object.
2379 2388
2380 2389 2005-01-21 Fernando Perez <fperez@colorado.edu>
2381 2390
2382 2391 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2383 2392 docstring under pylab so it doesn't mask the original.
2384 2393
2385 2394 2005-01-21 *** Released version 0.6.7
2386 2395
2387 2396 2005-01-21 Fernando Perez <fperez@colorado.edu>
2388 2397
2389 2398 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2390 2399 signal handling for win32 users in multithreaded mode.
2391 2400
2392 2401 2005-01-17 Fernando Perez <fperez@colorado.edu>
2393 2402
2394 2403 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2395 2404 instances with no __init__. After a crash report by Norbert Nemec
2396 2405 <Norbert-AT-nemec-online.de>.
2397 2406
2398 2407 2005-01-14 Fernando Perez <fperez@colorado.edu>
2399 2408
2400 2409 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2401 2410 names for verbose exceptions, when multiple dotted names and the
2402 2411 'parent' object were present on the same line.
2403 2412
2404 2413 2005-01-11 Fernando Perez <fperez@colorado.edu>
2405 2414
2406 2415 * IPython/genutils.py (flag_calls): new utility to trap and flag
2407 2416 calls in functions. I need it to clean up matplotlib support.
2408 2417 Also removed some deprecated code in genutils.
2409 2418
2410 2419 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2411 2420 that matplotlib scripts called with %run, which don't call show()
2412 2421 themselves, still have their plotting windows open.
2413 2422
2414 2423 2005-01-05 Fernando Perez <fperez@colorado.edu>
2415 2424
2416 2425 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2417 2426 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2418 2427
2419 2428 2004-12-19 Fernando Perez <fperez@colorado.edu>
2420 2429
2421 2430 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2422 2431 parent_runcode, which was an eyesore. The same result can be
2423 2432 obtained with Python's regular superclass mechanisms.
2424 2433
2425 2434 2004-12-17 Fernando Perez <fperez@colorado.edu>
2426 2435
2427 2436 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2428 2437 reported by Prabhu.
2429 2438 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2430 2439 sys.stderr) instead of explicitly calling sys.stderr. This helps
2431 2440 maintain our I/O abstractions clean, for future GUI embeddings.
2432 2441
2433 2442 * IPython/genutils.py (info): added new utility for sys.stderr
2434 2443 unified info message handling (thin wrapper around warn()).
2435 2444
2436 2445 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2437 2446 composite (dotted) names on verbose exceptions.
2438 2447 (VerboseTB.nullrepr): harden against another kind of errors which
2439 2448 Python's inspect module can trigger, and which were crashing
2440 2449 IPython. Thanks to a report by Marco Lombardi
2441 2450 <mlombard-AT-ma010192.hq.eso.org>.
2442 2451
2443 2452 2004-12-13 *** Released version 0.6.6
2444 2453
2445 2454 2004-12-12 Fernando Perez <fperez@colorado.edu>
2446 2455
2447 2456 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2448 2457 generated by pygtk upon initialization if it was built without
2449 2458 threads (for matplotlib users). After a crash reported by
2450 2459 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2451 2460
2452 2461 * IPython/ipmaker.py (make_IPython): fix small bug in the
2453 2462 import_some parameter for multiple imports.
2454 2463
2455 2464 * IPython/iplib.py (ipmagic): simplified the interface of
2456 2465 ipmagic() to take a single string argument, just as it would be
2457 2466 typed at the IPython cmd line.
2458 2467 (ipalias): Added new ipalias() with an interface identical to
2459 2468 ipmagic(). This completes exposing a pure python interface to the
2460 2469 alias and magic system, which can be used in loops or more complex
2461 2470 code where IPython's automatic line mangling is not active.
2462 2471
2463 2472 * IPython/genutils.py (timing): changed interface of timing to
2464 2473 simply run code once, which is the most common case. timings()
2465 2474 remains unchanged, for the cases where you want multiple runs.
2466 2475
2467 2476 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2468 2477 bug where Python2.2 crashes with exec'ing code which does not end
2469 2478 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2470 2479 before.
2471 2480
2472 2481 2004-12-10 Fernando Perez <fperez@colorado.edu>
2473 2482
2474 2483 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2475 2484 -t to -T, to accomodate the new -t flag in %run (the %run and
2476 2485 %prun options are kind of intermixed, and it's not easy to change
2477 2486 this with the limitations of python's getopt).
2478 2487
2479 2488 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2480 2489 the execution of scripts. It's not as fine-tuned as timeit.py,
2481 2490 but it works from inside ipython (and under 2.2, which lacks
2482 2491 timeit.py). Optionally a number of runs > 1 can be given for
2483 2492 timing very short-running code.
2484 2493
2485 2494 * IPython/genutils.py (uniq_stable): new routine which returns a
2486 2495 list of unique elements in any iterable, but in stable order of
2487 2496 appearance. I needed this for the ultraTB fixes, and it's a handy
2488 2497 utility.
2489 2498
2490 2499 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2491 2500 dotted names in Verbose exceptions. This had been broken since
2492 2501 the very start, now x.y will properly be printed in a Verbose
2493 2502 traceback, instead of x being shown and y appearing always as an
2494 2503 'undefined global'. Getting this to work was a bit tricky,
2495 2504 because by default python tokenizers are stateless. Saved by
2496 2505 python's ability to easily add a bit of state to an arbitrary
2497 2506 function (without needing to build a full-blown callable object).
2498 2507
2499 2508 Also big cleanup of this code, which had horrendous runtime
2500 2509 lookups of zillions of attributes for colorization. Moved all
2501 2510 this code into a few templates, which make it cleaner and quicker.
2502 2511
2503 2512 Printout quality was also improved for Verbose exceptions: one
2504 2513 variable per line, and memory addresses are printed (this can be
2505 2514 quite handy in nasty debugging situations, which is what Verbose
2506 2515 is for).
2507 2516
2508 2517 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2509 2518 the command line as scripts to be loaded by embedded instances.
2510 2519 Doing so has the potential for an infinite recursion if there are
2511 2520 exceptions thrown in the process. This fixes a strange crash
2512 2521 reported by Philippe MULLER <muller-AT-irit.fr>.
2513 2522
2514 2523 2004-12-09 Fernando Perez <fperez@colorado.edu>
2515 2524
2516 2525 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2517 2526 to reflect new names in matplotlib, which now expose the
2518 2527 matlab-compatible interface via a pylab module instead of the
2519 2528 'matlab' name. The new code is backwards compatible, so users of
2520 2529 all matplotlib versions are OK. Patch by J. Hunter.
2521 2530
2522 2531 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2523 2532 of __init__ docstrings for instances (class docstrings are already
2524 2533 automatically printed). Instances with customized docstrings
2525 2534 (indep. of the class) are also recognized and all 3 separate
2526 2535 docstrings are printed (instance, class, constructor). After some
2527 2536 comments/suggestions by J. Hunter.
2528 2537
2529 2538 2004-12-05 Fernando Perez <fperez@colorado.edu>
2530 2539
2531 2540 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2532 2541 warnings when tab-completion fails and triggers an exception.
2533 2542
2534 2543 2004-12-03 Fernando Perez <fperez@colorado.edu>
2535 2544
2536 2545 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2537 2546 be triggered when using 'run -p'. An incorrect option flag was
2538 2547 being set ('d' instead of 'D').
2539 2548 (manpage): fix missing escaped \- sign.
2540 2549
2541 2550 2004-11-30 *** Released version 0.6.5
2542 2551
2543 2552 2004-11-30 Fernando Perez <fperez@colorado.edu>
2544 2553
2545 2554 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2546 2555 setting with -d option.
2547 2556
2548 2557 * setup.py (docfiles): Fix problem where the doc glob I was using
2549 2558 was COMPLETELY BROKEN. It was giving the right files by pure
2550 2559 accident, but failed once I tried to include ipython.el. Note:
2551 2560 glob() does NOT allow you to do exclusion on multiple endings!
2552 2561
2553 2562 2004-11-29 Fernando Perez <fperez@colorado.edu>
2554 2563
2555 2564 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2556 2565 the manpage as the source. Better formatting & consistency.
2557 2566
2558 2567 * IPython/Magic.py (magic_run): Added new -d option, to run
2559 2568 scripts under the control of the python pdb debugger. Note that
2560 2569 this required changing the %prun option -d to -D, to avoid a clash
2561 2570 (since %run must pass options to %prun, and getopt is too dumb to
2562 2571 handle options with string values with embedded spaces). Thanks
2563 2572 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2564 2573 (magic_who_ls): added type matching to %who and %whos, so that one
2565 2574 can filter their output to only include variables of certain
2566 2575 types. Another suggestion by Matthew.
2567 2576 (magic_whos): Added memory summaries in kb and Mb for arrays.
2568 2577 (magic_who): Improve formatting (break lines every 9 vars).
2569 2578
2570 2579 2004-11-28 Fernando Perez <fperez@colorado.edu>
2571 2580
2572 2581 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2573 2582 cache when empty lines were present.
2574 2583
2575 2584 2004-11-24 Fernando Perez <fperez@colorado.edu>
2576 2585
2577 2586 * IPython/usage.py (__doc__): document the re-activated threading
2578 2587 options for WX and GTK.
2579 2588
2580 2589 2004-11-23 Fernando Perez <fperez@colorado.edu>
2581 2590
2582 2591 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2583 2592 the -wthread and -gthread options, along with a new -tk one to try
2584 2593 and coordinate Tk threading with wx/gtk. The tk support is very
2585 2594 platform dependent, since it seems to require Tcl and Tk to be
2586 2595 built with threads (Fedora1/2 appears NOT to have it, but in
2587 2596 Prabhu's Debian boxes it works OK). But even with some Tk
2588 2597 limitations, this is a great improvement.
2589 2598
2590 2599 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2591 2600 info in user prompts. Patch by Prabhu.
2592 2601
2593 2602 2004-11-18 Fernando Perez <fperez@colorado.edu>
2594 2603
2595 2604 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2596 2605 EOFErrors and bail, to avoid infinite loops if a non-terminating
2597 2606 file is fed into ipython. Patch submitted in issue 19 by user,
2598 2607 many thanks.
2599 2608
2600 2609 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2601 2610 autoquote/parens in continuation prompts, which can cause lots of
2602 2611 problems. Closes roundup issue 20.
2603 2612
2604 2613 2004-11-17 Fernando Perez <fperez@colorado.edu>
2605 2614
2606 2615 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2607 2616 reported as debian bug #280505. I'm not sure my local changelog
2608 2617 entry has the proper debian format (Jack?).
2609 2618
2610 2619 2004-11-08 *** Released version 0.6.4
2611 2620
2612 2621 2004-11-08 Fernando Perez <fperez@colorado.edu>
2613 2622
2614 2623 * IPython/iplib.py (init_readline): Fix exit message for Windows
2615 2624 when readline is active. Thanks to a report by Eric Jones
2616 2625 <eric-AT-enthought.com>.
2617 2626
2618 2627 2004-11-07 Fernando Perez <fperez@colorado.edu>
2619 2628
2620 2629 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2621 2630 sometimes seen by win2k/cygwin users.
2622 2631
2623 2632 2004-11-06 Fernando Perez <fperez@colorado.edu>
2624 2633
2625 2634 * IPython/iplib.py (interact): Change the handling of %Exit from
2626 2635 trying to propagate a SystemExit to an internal ipython flag.
2627 2636 This is less elegant than using Python's exception mechanism, but
2628 2637 I can't get that to work reliably with threads, so under -pylab
2629 2638 %Exit was hanging IPython. Cross-thread exception handling is
2630 2639 really a bitch. Thaks to a bug report by Stephen Walton
2631 2640 <stephen.walton-AT-csun.edu>.
2632 2641
2633 2642 2004-11-04 Fernando Perez <fperez@colorado.edu>
2634 2643
2635 2644 * IPython/iplib.py (raw_input_original): store a pointer to the
2636 2645 true raw_input to harden against code which can modify it
2637 2646 (wx.py.PyShell does this and would otherwise crash ipython).
2638 2647 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2639 2648
2640 2649 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2641 2650 Ctrl-C problem, which does not mess up the input line.
2642 2651
2643 2652 2004-11-03 Fernando Perez <fperez@colorado.edu>
2644 2653
2645 2654 * IPython/Release.py: Changed licensing to BSD, in all files.
2646 2655 (name): lowercase name for tarball/RPM release.
2647 2656
2648 2657 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2649 2658 use throughout ipython.
2650 2659
2651 2660 * IPython/Magic.py (Magic._ofind): Switch to using the new
2652 2661 OInspect.getdoc() function.
2653 2662
2654 2663 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2655 2664 of the line currently being canceled via Ctrl-C. It's extremely
2656 2665 ugly, but I don't know how to do it better (the problem is one of
2657 2666 handling cross-thread exceptions).
2658 2667
2659 2668 2004-10-28 Fernando Perez <fperez@colorado.edu>
2660 2669
2661 2670 * IPython/Shell.py (signal_handler): add signal handlers to trap
2662 2671 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2663 2672 report by Francesc Alted.
2664 2673
2665 2674 2004-10-21 Fernando Perez <fperez@colorado.edu>
2666 2675
2667 2676 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2668 2677 to % for pysh syntax extensions.
2669 2678
2670 2679 2004-10-09 Fernando Perez <fperez@colorado.edu>
2671 2680
2672 2681 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2673 2682 arrays to print a more useful summary, without calling str(arr).
2674 2683 This avoids the problem of extremely lengthy computations which
2675 2684 occur if arr is large, and appear to the user as a system lockup
2676 2685 with 100% cpu activity. After a suggestion by Kristian Sandberg
2677 2686 <Kristian.Sandberg@colorado.edu>.
2678 2687 (Magic.__init__): fix bug in global magic escapes not being
2679 2688 correctly set.
2680 2689
2681 2690 2004-10-08 Fernando Perez <fperez@colorado.edu>
2682 2691
2683 2692 * IPython/Magic.py (__license__): change to absolute imports of
2684 2693 ipython's own internal packages, to start adapting to the absolute
2685 2694 import requirement of PEP-328.
2686 2695
2687 2696 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2688 2697 files, and standardize author/license marks through the Release
2689 2698 module instead of having per/file stuff (except for files with
2690 2699 particular licenses, like the MIT/PSF-licensed codes).
2691 2700
2692 2701 * IPython/Debugger.py: remove dead code for python 2.1
2693 2702
2694 2703 2004-10-04 Fernando Perez <fperez@colorado.edu>
2695 2704
2696 2705 * IPython/iplib.py (ipmagic): New function for accessing magics
2697 2706 via a normal python function call.
2698 2707
2699 2708 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2700 2709 from '@' to '%', to accomodate the new @decorator syntax of python
2701 2710 2.4.
2702 2711
2703 2712 2004-09-29 Fernando Perez <fperez@colorado.edu>
2704 2713
2705 2714 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2706 2715 matplotlib.use to prevent running scripts which try to switch
2707 2716 interactive backends from within ipython. This will just crash
2708 2717 the python interpreter, so we can't allow it (but a detailed error
2709 2718 is given to the user).
2710 2719
2711 2720 2004-09-28 Fernando Perez <fperez@colorado.edu>
2712 2721
2713 2722 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2714 2723 matplotlib-related fixes so that using @run with non-matplotlib
2715 2724 scripts doesn't pop up spurious plot windows. This requires
2716 2725 matplotlib >= 0.63, where I had to make some changes as well.
2717 2726
2718 2727 * IPython/ipmaker.py (make_IPython): update version requirement to
2719 2728 python 2.2.
2720 2729
2721 2730 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2722 2731 banner arg for embedded customization.
2723 2732
2724 2733 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2725 2734 explicit uses of __IP as the IPython's instance name. Now things
2726 2735 are properly handled via the shell.name value. The actual code
2727 2736 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2728 2737 is much better than before. I'll clean things completely when the
2729 2738 magic stuff gets a real overhaul.
2730 2739
2731 2740 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2732 2741 minor changes to debian dir.
2733 2742
2734 2743 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2735 2744 pointer to the shell itself in the interactive namespace even when
2736 2745 a user-supplied dict is provided. This is needed for embedding
2737 2746 purposes (found by tests with Michel Sanner).
2738 2747
2739 2748 2004-09-27 Fernando Perez <fperez@colorado.edu>
2740 2749
2741 2750 * IPython/UserConfig/ipythonrc: remove []{} from
2742 2751 readline_remove_delims, so that things like [modname.<TAB> do
2743 2752 proper completion. This disables [].TAB, but that's a less common
2744 2753 case than module names in list comprehensions, for example.
2745 2754 Thanks to a report by Andrea Riciputi.
2746 2755
2747 2756 2004-09-09 Fernando Perez <fperez@colorado.edu>
2748 2757
2749 2758 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2750 2759 blocking problems in win32 and osx. Fix by John.
2751 2760
2752 2761 2004-09-08 Fernando Perez <fperez@colorado.edu>
2753 2762
2754 2763 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2755 2764 for Win32 and OSX. Fix by John Hunter.
2756 2765
2757 2766 2004-08-30 *** Released version 0.6.3
2758 2767
2759 2768 2004-08-30 Fernando Perez <fperez@colorado.edu>
2760 2769
2761 2770 * setup.py (isfile): Add manpages to list of dependent files to be
2762 2771 updated.
2763 2772
2764 2773 2004-08-27 Fernando Perez <fperez@colorado.edu>
2765 2774
2766 2775 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2767 2776 for now. They don't really work with standalone WX/GTK code
2768 2777 (though matplotlib IS working fine with both of those backends).
2769 2778 This will neeed much more testing. I disabled most things with
2770 2779 comments, so turning it back on later should be pretty easy.
2771 2780
2772 2781 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2773 2782 autocalling of expressions like r'foo', by modifying the line
2774 2783 split regexp. Closes
2775 2784 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2776 2785 Riley <ipythonbugs-AT-sabi.net>.
2777 2786 (InteractiveShell.mainloop): honor --nobanner with banner
2778 2787 extensions.
2779 2788
2780 2789 * IPython/Shell.py: Significant refactoring of all classes, so
2781 2790 that we can really support ALL matplotlib backends and threading
2782 2791 models (John spotted a bug with Tk which required this). Now we
2783 2792 should support single-threaded, WX-threads and GTK-threads, both
2784 2793 for generic code and for matplotlib.
2785 2794
2786 2795 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2787 2796 -pylab, to simplify things for users. Will also remove the pylab
2788 2797 profile, since now all of matplotlib configuration is directly
2789 2798 handled here. This also reduces startup time.
2790 2799
2791 2800 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2792 2801 shell wasn't being correctly called. Also in IPShellWX.
2793 2802
2794 2803 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2795 2804 fine-tune banner.
2796 2805
2797 2806 * IPython/numutils.py (spike): Deprecate these spike functions,
2798 2807 delete (long deprecated) gnuplot_exec handler.
2799 2808
2800 2809 2004-08-26 Fernando Perez <fperez@colorado.edu>
2801 2810
2802 2811 * ipython.1: Update for threading options, plus some others which
2803 2812 were missing.
2804 2813
2805 2814 * IPython/ipmaker.py (__call__): Added -wthread option for
2806 2815 wxpython thread handling. Make sure threading options are only
2807 2816 valid at the command line.
2808 2817
2809 2818 * scripts/ipython: moved shell selection into a factory function
2810 2819 in Shell.py, to keep the starter script to a minimum.
2811 2820
2812 2821 2004-08-25 Fernando Perez <fperez@colorado.edu>
2813 2822
2814 2823 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2815 2824 John. Along with some recent changes he made to matplotlib, the
2816 2825 next versions of both systems should work very well together.
2817 2826
2818 2827 2004-08-24 Fernando Perez <fperez@colorado.edu>
2819 2828
2820 2829 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2821 2830 tried to switch the profiling to using hotshot, but I'm getting
2822 2831 strange errors from prof.runctx() there. I may be misreading the
2823 2832 docs, but it looks weird. For now the profiling code will
2824 2833 continue to use the standard profiler.
2825 2834
2826 2835 2004-08-23 Fernando Perez <fperez@colorado.edu>
2827 2836
2828 2837 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2829 2838 threaded shell, by John Hunter. It's not quite ready yet, but
2830 2839 close.
2831 2840
2832 2841 2004-08-22 Fernando Perez <fperez@colorado.edu>
2833 2842
2834 2843 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2835 2844 in Magic and ultraTB.
2836 2845
2837 2846 * ipython.1: document threading options in manpage.
2838 2847
2839 2848 * scripts/ipython: Changed name of -thread option to -gthread,
2840 2849 since this is GTK specific. I want to leave the door open for a
2841 2850 -wthread option for WX, which will most likely be necessary. This
2842 2851 change affects usage and ipmaker as well.
2843 2852
2844 2853 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2845 2854 handle the matplotlib shell issues. Code by John Hunter
2846 2855 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2847 2856 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2848 2857 broken (and disabled for end users) for now, but it puts the
2849 2858 infrastructure in place.
2850 2859
2851 2860 2004-08-21 Fernando Perez <fperez@colorado.edu>
2852 2861
2853 2862 * ipythonrc-pylab: Add matplotlib support.
2854 2863
2855 2864 * matplotlib_config.py: new files for matplotlib support, part of
2856 2865 the pylab profile.
2857 2866
2858 2867 * IPython/usage.py (__doc__): documented the threading options.
2859 2868
2860 2869 2004-08-20 Fernando Perez <fperez@colorado.edu>
2861 2870
2862 2871 * ipython: Modified the main calling routine to handle the -thread
2863 2872 and -mpthread options. This needs to be done as a top-level hack,
2864 2873 because it determines which class to instantiate for IPython
2865 2874 itself.
2866 2875
2867 2876 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2868 2877 classes to support multithreaded GTK operation without blocking,
2869 2878 and matplotlib with all backends. This is a lot of still very
2870 2879 experimental code, and threads are tricky. So it may still have a
2871 2880 few rough edges... This code owes a lot to
2872 2881 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2873 2882 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2874 2883 to John Hunter for all the matplotlib work.
2875 2884
2876 2885 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2877 2886 options for gtk thread and matplotlib support.
2878 2887
2879 2888 2004-08-16 Fernando Perez <fperez@colorado.edu>
2880 2889
2881 2890 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2882 2891 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2883 2892 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2884 2893
2885 2894 2004-08-11 Fernando Perez <fperez@colorado.edu>
2886 2895
2887 2896 * setup.py (isfile): Fix build so documentation gets updated for
2888 2897 rpms (it was only done for .tgz builds).
2889 2898
2890 2899 2004-08-10 Fernando Perez <fperez@colorado.edu>
2891 2900
2892 2901 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2893 2902
2894 2903 * iplib.py : Silence syntax error exceptions in tab-completion.
2895 2904
2896 2905 2004-08-05 Fernando Perez <fperez@colorado.edu>
2897 2906
2898 2907 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2899 2908 'color off' mark for continuation prompts. This was causing long
2900 2909 continuation lines to mis-wrap.
2901 2910
2902 2911 2004-08-01 Fernando Perez <fperez@colorado.edu>
2903 2912
2904 2913 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2905 2914 for building ipython to be a parameter. All this is necessary
2906 2915 right now to have a multithreaded version, but this insane
2907 2916 non-design will be cleaned up soon. For now, it's a hack that
2908 2917 works.
2909 2918
2910 2919 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2911 2920 args in various places. No bugs so far, but it's a dangerous
2912 2921 practice.
2913 2922
2914 2923 2004-07-31 Fernando Perez <fperez@colorado.edu>
2915 2924
2916 2925 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2917 2926 fix completion of files with dots in their names under most
2918 2927 profiles (pysh was OK because the completion order is different).
2919 2928
2920 2929 2004-07-27 Fernando Perez <fperez@colorado.edu>
2921 2930
2922 2931 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2923 2932 keywords manually, b/c the one in keyword.py was removed in python
2924 2933 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2925 2934 This is NOT a bug under python 2.3 and earlier.
2926 2935
2927 2936 2004-07-26 Fernando Perez <fperez@colorado.edu>
2928 2937
2929 2938 * IPython/ultraTB.py (VerboseTB.text): Add another
2930 2939 linecache.checkcache() call to try to prevent inspect.py from
2931 2940 crashing under python 2.3. I think this fixes
2932 2941 http://www.scipy.net/roundup/ipython/issue17.
2933 2942
2934 2943 2004-07-26 *** Released version 0.6.2
2935 2944
2936 2945 2004-07-26 Fernando Perez <fperez@colorado.edu>
2937 2946
2938 2947 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2939 2948 fail for any number.
2940 2949 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2941 2950 empty bookmarks.
2942 2951
2943 2952 2004-07-26 *** Released version 0.6.1
2944 2953
2945 2954 2004-07-26 Fernando Perez <fperez@colorado.edu>
2946 2955
2947 2956 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2948 2957
2949 2958 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2950 2959 escaping '()[]{}' in filenames.
2951 2960
2952 2961 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2953 2962 Python 2.2 users who lack a proper shlex.split.
2954 2963
2955 2964 2004-07-19 Fernando Perez <fperez@colorado.edu>
2956 2965
2957 2966 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2958 2967 for reading readline's init file. I follow the normal chain:
2959 2968 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2960 2969 report by Mike Heeter. This closes
2961 2970 http://www.scipy.net/roundup/ipython/issue16.
2962 2971
2963 2972 2004-07-18 Fernando Perez <fperez@colorado.edu>
2964 2973
2965 2974 * IPython/iplib.py (__init__): Add better handling of '\' under
2966 2975 Win32 for filenames. After a patch by Ville.
2967 2976
2968 2977 2004-07-17 Fernando Perez <fperez@colorado.edu>
2969 2978
2970 2979 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2971 2980 autocalling would be triggered for 'foo is bar' if foo is
2972 2981 callable. I also cleaned up the autocall detection code to use a
2973 2982 regexp, which is faster. Bug reported by Alexander Schmolck.
2974 2983
2975 2984 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2976 2985 '?' in them would confuse the help system. Reported by Alex
2977 2986 Schmolck.
2978 2987
2979 2988 2004-07-16 Fernando Perez <fperez@colorado.edu>
2980 2989
2981 2990 * IPython/GnuplotInteractive.py (__all__): added plot2.
2982 2991
2983 2992 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2984 2993 plotting dictionaries, lists or tuples of 1d arrays.
2985 2994
2986 2995 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2987 2996 optimizations.
2988 2997
2989 2998 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2990 2999 the information which was there from Janko's original IPP code:
2991 3000
2992 3001 03.05.99 20:53 porto.ifm.uni-kiel.de
2993 3002 --Started changelog.
2994 3003 --make clear do what it say it does
2995 3004 --added pretty output of lines from inputcache
2996 3005 --Made Logger a mixin class, simplifies handling of switches
2997 3006 --Added own completer class. .string<TAB> expands to last history
2998 3007 line which starts with string. The new expansion is also present
2999 3008 with Ctrl-r from the readline library. But this shows, who this
3000 3009 can be done for other cases.
3001 3010 --Added convention that all shell functions should accept a
3002 3011 parameter_string This opens the door for different behaviour for
3003 3012 each function. @cd is a good example of this.
3004 3013
3005 3014 04.05.99 12:12 porto.ifm.uni-kiel.de
3006 3015 --added logfile rotation
3007 3016 --added new mainloop method which freezes first the namespace
3008 3017
3009 3018 07.05.99 21:24 porto.ifm.uni-kiel.de
3010 3019 --added the docreader classes. Now there is a help system.
3011 3020 -This is only a first try. Currently it's not easy to put new
3012 3021 stuff in the indices. But this is the way to go. Info would be
3013 3022 better, but HTML is every where and not everybody has an info
3014 3023 system installed and it's not so easy to change html-docs to info.
3015 3024 --added global logfile option
3016 3025 --there is now a hook for object inspection method pinfo needs to
3017 3026 be provided for this. Can be reached by two '??'.
3018 3027
3019 3028 08.05.99 20:51 porto.ifm.uni-kiel.de
3020 3029 --added a README
3021 3030 --bug in rc file. Something has changed so functions in the rc
3022 3031 file need to reference the shell and not self. Not clear if it's a
3023 3032 bug or feature.
3024 3033 --changed rc file for new behavior
3025 3034
3026 3035 2004-07-15 Fernando Perez <fperez@colorado.edu>
3027 3036
3028 3037 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3029 3038 cache was falling out of sync in bizarre manners when multi-line
3030 3039 input was present. Minor optimizations and cleanup.
3031 3040
3032 3041 (Logger): Remove old Changelog info for cleanup. This is the
3033 3042 information which was there from Janko's original code:
3034 3043
3035 3044 Changes to Logger: - made the default log filename a parameter
3036 3045
3037 3046 - put a check for lines beginning with !@? in log(). Needed
3038 3047 (even if the handlers properly log their lines) for mid-session
3039 3048 logging activation to work properly. Without this, lines logged
3040 3049 in mid session, which get read from the cache, would end up
3041 3050 'bare' (with !@? in the open) in the log. Now they are caught
3042 3051 and prepended with a #.
3043 3052
3044 3053 * IPython/iplib.py (InteractiveShell.init_readline): added check
3045 3054 in case MagicCompleter fails to be defined, so we don't crash.
3046 3055
3047 3056 2004-07-13 Fernando Perez <fperez@colorado.edu>
3048 3057
3049 3058 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3050 3059 of EPS if the requested filename ends in '.eps'.
3051 3060
3052 3061 2004-07-04 Fernando Perez <fperez@colorado.edu>
3053 3062
3054 3063 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3055 3064 escaping of quotes when calling the shell.
3056 3065
3057 3066 2004-07-02 Fernando Perez <fperez@colorado.edu>
3058 3067
3059 3068 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3060 3069 gettext not working because we were clobbering '_'. Fixes
3061 3070 http://www.scipy.net/roundup/ipython/issue6.
3062 3071
3063 3072 2004-07-01 Fernando Perez <fperez@colorado.edu>
3064 3073
3065 3074 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3066 3075 into @cd. Patch by Ville.
3067 3076
3068 3077 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3069 3078 new function to store things after ipmaker runs. Patch by Ville.
3070 3079 Eventually this will go away once ipmaker is removed and the class
3071 3080 gets cleaned up, but for now it's ok. Key functionality here is
3072 3081 the addition of the persistent storage mechanism, a dict for
3073 3082 keeping data across sessions (for now just bookmarks, but more can
3074 3083 be implemented later).
3075 3084
3076 3085 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3077 3086 persistent across sections. Patch by Ville, I modified it
3078 3087 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3079 3088 added a '-l' option to list all bookmarks.
3080 3089
3081 3090 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3082 3091 center for cleanup. Registered with atexit.register(). I moved
3083 3092 here the old exit_cleanup(). After a patch by Ville.
3084 3093
3085 3094 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3086 3095 characters in the hacked shlex_split for python 2.2.
3087 3096
3088 3097 * IPython/iplib.py (file_matches): more fixes to filenames with
3089 3098 whitespace in them. It's not perfect, but limitations in python's
3090 3099 readline make it impossible to go further.
3091 3100
3092 3101 2004-06-29 Fernando Perez <fperez@colorado.edu>
3093 3102
3094 3103 * IPython/iplib.py (file_matches): escape whitespace correctly in
3095 3104 filename completions. Bug reported by Ville.
3096 3105
3097 3106 2004-06-28 Fernando Perez <fperez@colorado.edu>
3098 3107
3099 3108 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3100 3109 the history file will be called 'history-PROFNAME' (or just
3101 3110 'history' if no profile is loaded). I was getting annoyed at
3102 3111 getting my Numerical work history clobbered by pysh sessions.
3103 3112
3104 3113 * IPython/iplib.py (InteractiveShell.__init__): Internal
3105 3114 getoutputerror() function so that we can honor the system_verbose
3106 3115 flag for _all_ system calls. I also added escaping of #
3107 3116 characters here to avoid confusing Itpl.
3108 3117
3109 3118 * IPython/Magic.py (shlex_split): removed call to shell in
3110 3119 parse_options and replaced it with shlex.split(). The annoying
3111 3120 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3112 3121 to backport it from 2.3, with several frail hacks (the shlex
3113 3122 module is rather limited in 2.2). Thanks to a suggestion by Ville
3114 3123 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3115 3124 problem.
3116 3125
3117 3126 (Magic.magic_system_verbose): new toggle to print the actual
3118 3127 system calls made by ipython. Mainly for debugging purposes.
3119 3128
3120 3129 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3121 3130 doesn't support persistence. Reported (and fix suggested) by
3122 3131 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3123 3132
3124 3133 2004-06-26 Fernando Perez <fperez@colorado.edu>
3125 3134
3126 3135 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3127 3136 continue prompts.
3128 3137
3129 3138 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3130 3139 function (basically a big docstring) and a few more things here to
3131 3140 speedup startup. pysh.py is now very lightweight. We want because
3132 3141 it gets execfile'd, while InterpreterExec gets imported, so
3133 3142 byte-compilation saves time.
3134 3143
3135 3144 2004-06-25 Fernando Perez <fperez@colorado.edu>
3136 3145
3137 3146 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3138 3147 -NUM', which was recently broken.
3139 3148
3140 3149 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3141 3150 in multi-line input (but not !!, which doesn't make sense there).
3142 3151
3143 3152 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3144 3153 It's just too useful, and people can turn it off in the less
3145 3154 common cases where it's a problem.
3146 3155
3147 3156 2004-06-24 Fernando Perez <fperez@colorado.edu>
3148 3157
3149 3158 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3150 3159 special syntaxes (like alias calling) is now allied in multi-line
3151 3160 input. This is still _very_ experimental, but it's necessary for
3152 3161 efficient shell usage combining python looping syntax with system
3153 3162 calls. For now it's restricted to aliases, I don't think it
3154 3163 really even makes sense to have this for magics.
3155 3164
3156 3165 2004-06-23 Fernando Perez <fperez@colorado.edu>
3157 3166
3158 3167 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3159 3168 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3160 3169
3161 3170 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3162 3171 extensions under Windows (after code sent by Gary Bishop). The
3163 3172 extensions considered 'executable' are stored in IPython's rc
3164 3173 structure as win_exec_ext.
3165 3174
3166 3175 * IPython/genutils.py (shell): new function, like system() but
3167 3176 without return value. Very useful for interactive shell work.
3168 3177
3169 3178 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3170 3179 delete aliases.
3171 3180
3172 3181 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3173 3182 sure that the alias table doesn't contain python keywords.
3174 3183
3175 3184 2004-06-21 Fernando Perez <fperez@colorado.edu>
3176 3185
3177 3186 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3178 3187 non-existent items are found in $PATH. Reported by Thorsten.
3179 3188
3180 3189 2004-06-20 Fernando Perez <fperez@colorado.edu>
3181 3190
3182 3191 * IPython/iplib.py (complete): modified the completer so that the
3183 3192 order of priorities can be easily changed at runtime.
3184 3193
3185 3194 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3186 3195 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3187 3196
3188 3197 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3189 3198 expand Python variables prepended with $ in all system calls. The
3190 3199 same was done to InteractiveShell.handle_shell_escape. Now all
3191 3200 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3192 3201 expansion of python variables and expressions according to the
3193 3202 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3194 3203
3195 3204 Though PEP-215 has been rejected, a similar (but simpler) one
3196 3205 seems like it will go into Python 2.4, PEP-292 -
3197 3206 http://www.python.org/peps/pep-0292.html.
3198 3207
3199 3208 I'll keep the full syntax of PEP-215, since IPython has since the
3200 3209 start used Ka-Ping Yee's reference implementation discussed there
3201 3210 (Itpl), and I actually like the powerful semantics it offers.
3202 3211
3203 3212 In order to access normal shell variables, the $ has to be escaped
3204 3213 via an extra $. For example:
3205 3214
3206 3215 In [7]: PATH='a python variable'
3207 3216
3208 3217 In [8]: !echo $PATH
3209 3218 a python variable
3210 3219
3211 3220 In [9]: !echo $$PATH
3212 3221 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3213 3222
3214 3223 (Magic.parse_options): escape $ so the shell doesn't evaluate
3215 3224 things prematurely.
3216 3225
3217 3226 * IPython/iplib.py (InteractiveShell.call_alias): added the
3218 3227 ability for aliases to expand python variables via $.
3219 3228
3220 3229 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3221 3230 system, now there's a @rehash/@rehashx pair of magics. These work
3222 3231 like the csh rehash command, and can be invoked at any time. They
3223 3232 build a table of aliases to everything in the user's $PATH
3224 3233 (@rehash uses everything, @rehashx is slower but only adds
3225 3234 executable files). With this, the pysh.py-based shell profile can
3226 3235 now simply call rehash upon startup, and full access to all
3227 3236 programs in the user's path is obtained.
3228 3237
3229 3238 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3230 3239 functionality is now fully in place. I removed the old dynamic
3231 3240 code generation based approach, in favor of a much lighter one
3232 3241 based on a simple dict. The advantage is that this allows me to
3233 3242 now have thousands of aliases with negligible cost (unthinkable
3234 3243 with the old system).
3235 3244
3236 3245 2004-06-19 Fernando Perez <fperez@colorado.edu>
3237 3246
3238 3247 * IPython/iplib.py (__init__): extended MagicCompleter class to
3239 3248 also complete (last in priority) on user aliases.
3240 3249
3241 3250 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3242 3251 call to eval.
3243 3252 (ItplNS.__init__): Added a new class which functions like Itpl,
3244 3253 but allows configuring the namespace for the evaluation to occur
3245 3254 in.
3246 3255
3247 3256 2004-06-18 Fernando Perez <fperez@colorado.edu>
3248 3257
3249 3258 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3250 3259 better message when 'exit' or 'quit' are typed (a common newbie
3251 3260 confusion).
3252 3261
3253 3262 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3254 3263 check for Windows users.
3255 3264
3256 3265 * IPython/iplib.py (InteractiveShell.user_setup): removed
3257 3266 disabling of colors for Windows. I'll test at runtime and issue a
3258 3267 warning if Gary's readline isn't found, as to nudge users to
3259 3268 download it.
3260 3269
3261 3270 2004-06-16 Fernando Perez <fperez@colorado.edu>
3262 3271
3263 3272 * IPython/genutils.py (Stream.__init__): changed to print errors
3264 3273 to sys.stderr. I had a circular dependency here. Now it's
3265 3274 possible to run ipython as IDLE's shell (consider this pre-alpha,
3266 3275 since true stdout things end up in the starting terminal instead
3267 3276 of IDLE's out).
3268 3277
3269 3278 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3270 3279 users who haven't # updated their prompt_in2 definitions. Remove
3271 3280 eventually.
3272 3281 (multiple_replace): added credit to original ASPN recipe.
3273 3282
3274 3283 2004-06-15 Fernando Perez <fperez@colorado.edu>
3275 3284
3276 3285 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3277 3286 list of auto-defined aliases.
3278 3287
3279 3288 2004-06-13 Fernando Perez <fperez@colorado.edu>
3280 3289
3281 3290 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3282 3291 install was really requested (so setup.py can be used for other
3283 3292 things under Windows).
3284 3293
3285 3294 2004-06-10 Fernando Perez <fperez@colorado.edu>
3286 3295
3287 3296 * IPython/Logger.py (Logger.create_log): Manually remove any old
3288 3297 backup, since os.remove may fail under Windows. Fixes bug
3289 3298 reported by Thorsten.
3290 3299
3291 3300 2004-06-09 Fernando Perez <fperez@colorado.edu>
3292 3301
3293 3302 * examples/example-embed.py: fixed all references to %n (replaced
3294 3303 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3295 3304 for all examples and the manual as well.
3296 3305
3297 3306 2004-06-08 Fernando Perez <fperez@colorado.edu>
3298 3307
3299 3308 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3300 3309 alignment and color management. All 3 prompt subsystems now
3301 3310 inherit from BasePrompt.
3302 3311
3303 3312 * tools/release: updates for windows installer build and tag rpms
3304 3313 with python version (since paths are fixed).
3305 3314
3306 3315 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3307 3316 which will become eventually obsolete. Also fixed the default
3308 3317 prompt_in2 to use \D, so at least new users start with the correct
3309 3318 defaults.
3310 3319 WARNING: Users with existing ipythonrc files will need to apply
3311 3320 this fix manually!
3312 3321
3313 3322 * setup.py: make windows installer (.exe). This is finally the
3314 3323 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3315 3324 which I hadn't included because it required Python 2.3 (or recent
3316 3325 distutils).
3317 3326
3318 3327 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3319 3328 usage of new '\D' escape.
3320 3329
3321 3330 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3322 3331 lacks os.getuid())
3323 3332 (CachedOutput.set_colors): Added the ability to turn coloring
3324 3333 on/off with @colors even for manually defined prompt colors. It
3325 3334 uses a nasty global, but it works safely and via the generic color
3326 3335 handling mechanism.
3327 3336 (Prompt2.__init__): Introduced new escape '\D' for continuation
3328 3337 prompts. It represents the counter ('\#') as dots.
3329 3338 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3330 3339 need to update their ipythonrc files and replace '%n' with '\D' in
3331 3340 their prompt_in2 settings everywhere. Sorry, but there's
3332 3341 otherwise no clean way to get all prompts to properly align. The
3333 3342 ipythonrc shipped with IPython has been updated.
3334 3343
3335 3344 2004-06-07 Fernando Perez <fperez@colorado.edu>
3336 3345
3337 3346 * setup.py (isfile): Pass local_icons option to latex2html, so the
3338 3347 resulting HTML file is self-contained. Thanks to
3339 3348 dryice-AT-liu.com.cn for the tip.
3340 3349
3341 3350 * pysh.py: I created a new profile 'shell', which implements a
3342 3351 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3343 3352 system shell, nor will it become one anytime soon. It's mainly
3344 3353 meant to illustrate the use of the new flexible bash-like prompts.
3345 3354 I guess it could be used by hardy souls for true shell management,
3346 3355 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3347 3356 profile. This uses the InterpreterExec extension provided by
3348 3357 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3349 3358
3350 3359 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3351 3360 auto-align itself with the length of the previous input prompt
3352 3361 (taking into account the invisible color escapes).
3353 3362 (CachedOutput.__init__): Large restructuring of this class. Now
3354 3363 all three prompts (primary1, primary2, output) are proper objects,
3355 3364 managed by the 'parent' CachedOutput class. The code is still a
3356 3365 bit hackish (all prompts share state via a pointer to the cache),
3357 3366 but it's overall far cleaner than before.
3358 3367
3359 3368 * IPython/genutils.py (getoutputerror): modified to add verbose,
3360 3369 debug and header options. This makes the interface of all getout*
3361 3370 functions uniform.
3362 3371 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3363 3372
3364 3373 * IPython/Magic.py (Magic.default_option): added a function to
3365 3374 allow registering default options for any magic command. This
3366 3375 makes it easy to have profiles which customize the magics globally
3367 3376 for a certain use. The values set through this function are
3368 3377 picked up by the parse_options() method, which all magics should
3369 3378 use to parse their options.
3370 3379
3371 3380 * IPython/genutils.py (warn): modified the warnings framework to
3372 3381 use the Term I/O class. I'm trying to slowly unify all of
3373 3382 IPython's I/O operations to pass through Term.
3374 3383
3375 3384 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3376 3385 the secondary prompt to correctly match the length of the primary
3377 3386 one for any prompt. Now multi-line code will properly line up
3378 3387 even for path dependent prompts, such as the new ones available
3379 3388 via the prompt_specials.
3380 3389
3381 3390 2004-06-06 Fernando Perez <fperez@colorado.edu>
3382 3391
3383 3392 * IPython/Prompts.py (prompt_specials): Added the ability to have
3384 3393 bash-like special sequences in the prompts, which get
3385 3394 automatically expanded. Things like hostname, current working
3386 3395 directory and username are implemented already, but it's easy to
3387 3396 add more in the future. Thanks to a patch by W.J. van der Laan
3388 3397 <gnufnork-AT-hetdigitalegat.nl>
3389 3398 (prompt_specials): Added color support for prompt strings, so
3390 3399 users can define arbitrary color setups for their prompts.
3391 3400
3392 3401 2004-06-05 Fernando Perez <fperez@colorado.edu>
3393 3402
3394 3403 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3395 3404 code to load Gary Bishop's readline and configure it
3396 3405 automatically. Thanks to Gary for help on this.
3397 3406
3398 3407 2004-06-01 Fernando Perez <fperez@colorado.edu>
3399 3408
3400 3409 * IPython/Logger.py (Logger.create_log): fix bug for logging
3401 3410 with no filename (previous fix was incomplete).
3402 3411
3403 3412 2004-05-25 Fernando Perez <fperez@colorado.edu>
3404 3413
3405 3414 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3406 3415 parens would get passed to the shell.
3407 3416
3408 3417 2004-05-20 Fernando Perez <fperez@colorado.edu>
3409 3418
3410 3419 * IPython/Magic.py (Magic.magic_prun): changed default profile
3411 3420 sort order to 'time' (the more common profiling need).
3412 3421
3413 3422 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3414 3423 so that source code shown is guaranteed in sync with the file on
3415 3424 disk (also changed in psource). Similar fix to the one for
3416 3425 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3417 3426 <yann.ledu-AT-noos.fr>.
3418 3427
3419 3428 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3420 3429 with a single option would not be correctly parsed. Closes
3421 3430 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3422 3431 introduced in 0.6.0 (on 2004-05-06).
3423 3432
3424 3433 2004-05-13 *** Released version 0.6.0
3425 3434
3426 3435 2004-05-13 Fernando Perez <fperez@colorado.edu>
3427 3436
3428 3437 * debian/: Added debian/ directory to CVS, so that debian support
3429 3438 is publicly accessible. The debian package is maintained by Jack
3430 3439 Moffit <jack-AT-xiph.org>.
3431 3440
3432 3441 * Documentation: included the notes about an ipython-based system
3433 3442 shell (the hypothetical 'pysh') into the new_design.pdf document,
3434 3443 so that these ideas get distributed to users along with the
3435 3444 official documentation.
3436 3445
3437 3446 2004-05-10 Fernando Perez <fperez@colorado.edu>
3438 3447
3439 3448 * IPython/Logger.py (Logger.create_log): fix recently introduced
3440 3449 bug (misindented line) where logstart would fail when not given an
3441 3450 explicit filename.
3442 3451
3443 3452 2004-05-09 Fernando Perez <fperez@colorado.edu>
3444 3453
3445 3454 * IPython/Magic.py (Magic.parse_options): skip system call when
3446 3455 there are no options to look for. Faster, cleaner for the common
3447 3456 case.
3448 3457
3449 3458 * Documentation: many updates to the manual: describing Windows
3450 3459 support better, Gnuplot updates, credits, misc small stuff. Also
3451 3460 updated the new_design doc a bit.
3452 3461
3453 3462 2004-05-06 *** Released version 0.6.0.rc1
3454 3463
3455 3464 2004-05-06 Fernando Perez <fperez@colorado.edu>
3456 3465
3457 3466 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3458 3467 operations to use the vastly more efficient list/''.join() method.
3459 3468 (FormattedTB.text): Fix
3460 3469 http://www.scipy.net/roundup/ipython/issue12 - exception source
3461 3470 extract not updated after reload. Thanks to Mike Salib
3462 3471 <msalib-AT-mit.edu> for pinning the source of the problem.
3463 3472 Fortunately, the solution works inside ipython and doesn't require
3464 3473 any changes to python proper.
3465 3474
3466 3475 * IPython/Magic.py (Magic.parse_options): Improved to process the
3467 3476 argument list as a true shell would (by actually using the
3468 3477 underlying system shell). This way, all @magics automatically get
3469 3478 shell expansion for variables. Thanks to a comment by Alex
3470 3479 Schmolck.
3471 3480
3472 3481 2004-04-04 Fernando Perez <fperez@colorado.edu>
3473 3482
3474 3483 * IPython/iplib.py (InteractiveShell.interact): Added a special
3475 3484 trap for a debugger quit exception, which is basically impossible
3476 3485 to handle by normal mechanisms, given what pdb does to the stack.
3477 3486 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3478 3487
3479 3488 2004-04-03 Fernando Perez <fperez@colorado.edu>
3480 3489
3481 3490 * IPython/genutils.py (Term): Standardized the names of the Term
3482 3491 class streams to cin/cout/cerr, following C++ naming conventions
3483 3492 (I can't use in/out/err because 'in' is not a valid attribute
3484 3493 name).
3485 3494
3486 3495 * IPython/iplib.py (InteractiveShell.interact): don't increment
3487 3496 the prompt if there's no user input. By Daniel 'Dang' Griffith
3488 3497 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3489 3498 Francois Pinard.
3490 3499
3491 3500 2004-04-02 Fernando Perez <fperez@colorado.edu>
3492 3501
3493 3502 * IPython/genutils.py (Stream.__init__): Modified to survive at
3494 3503 least importing in contexts where stdin/out/err aren't true file
3495 3504 objects, such as PyCrust (they lack fileno() and mode). However,
3496 3505 the recovery facilities which rely on these things existing will
3497 3506 not work.
3498 3507
3499 3508 2004-04-01 Fernando Perez <fperez@colorado.edu>
3500 3509
3501 3510 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3502 3511 use the new getoutputerror() function, so it properly
3503 3512 distinguishes stdout/err.
3504 3513
3505 3514 * IPython/genutils.py (getoutputerror): added a function to
3506 3515 capture separately the standard output and error of a command.
3507 3516 After a comment from dang on the mailing lists. This code is
3508 3517 basically a modified version of commands.getstatusoutput(), from
3509 3518 the standard library.
3510 3519
3511 3520 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3512 3521 '!!' as a special syntax (shorthand) to access @sx.
3513 3522
3514 3523 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3515 3524 command and return its output as a list split on '\n'.
3516 3525
3517 3526 2004-03-31 Fernando Perez <fperez@colorado.edu>
3518 3527
3519 3528 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3520 3529 method to dictionaries used as FakeModule instances if they lack
3521 3530 it. At least pydoc in python2.3 breaks for runtime-defined
3522 3531 functions without this hack. At some point I need to _really_
3523 3532 understand what FakeModule is doing, because it's a gross hack.
3524 3533 But it solves Arnd's problem for now...
3525 3534
3526 3535 2004-02-27 Fernando Perez <fperez@colorado.edu>
3527 3536
3528 3537 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3529 3538 mode would behave erratically. Also increased the number of
3530 3539 possible logs in rotate mod to 999. Thanks to Rod Holland
3531 3540 <rhh@StructureLABS.com> for the report and fixes.
3532 3541
3533 3542 2004-02-26 Fernando Perez <fperez@colorado.edu>
3534 3543
3535 3544 * IPython/genutils.py (page): Check that the curses module really
3536 3545 has the initscr attribute before trying to use it. For some
3537 3546 reason, the Solaris curses module is missing this. I think this
3538 3547 should be considered a Solaris python bug, but I'm not sure.
3539 3548
3540 3549 2004-01-17 Fernando Perez <fperez@colorado.edu>
3541 3550
3542 3551 * IPython/genutils.py (Stream.__init__): Changes to try to make
3543 3552 ipython robust against stdin/out/err being closed by the user.
3544 3553 This is 'user error' (and blocks a normal python session, at least
3545 3554 the stdout case). However, Ipython should be able to survive such
3546 3555 instances of abuse as gracefully as possible. To simplify the
3547 3556 coding and maintain compatibility with Gary Bishop's Term
3548 3557 contributions, I've made use of classmethods for this. I think
3549 3558 this introduces a dependency on python 2.2.
3550 3559
3551 3560 2004-01-13 Fernando Perez <fperez@colorado.edu>
3552 3561
3553 3562 * IPython/numutils.py (exp_safe): simplified the code a bit and
3554 3563 removed the need for importing the kinds module altogether.
3555 3564
3556 3565 2004-01-06 Fernando Perez <fperez@colorado.edu>
3557 3566
3558 3567 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3559 3568 a magic function instead, after some community feedback. No
3560 3569 special syntax will exist for it, but its name is deliberately
3561 3570 very short.
3562 3571
3563 3572 2003-12-20 Fernando Perez <fperez@colorado.edu>
3564 3573
3565 3574 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3566 3575 new functionality, to automagically assign the result of a shell
3567 3576 command to a variable. I'll solicit some community feedback on
3568 3577 this before making it permanent.
3569 3578
3570 3579 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3571 3580 requested about callables for which inspect couldn't obtain a
3572 3581 proper argspec. Thanks to a crash report sent by Etienne
3573 3582 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3574 3583
3575 3584 2003-12-09 Fernando Perez <fperez@colorado.edu>
3576 3585
3577 3586 * IPython/genutils.py (page): patch for the pager to work across
3578 3587 various versions of Windows. By Gary Bishop.
3579 3588
3580 3589 2003-12-04 Fernando Perez <fperez@colorado.edu>
3581 3590
3582 3591 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3583 3592 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3584 3593 While I tested this and it looks ok, there may still be corner
3585 3594 cases I've missed.
3586 3595
3587 3596 2003-12-01 Fernando Perez <fperez@colorado.edu>
3588 3597
3589 3598 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3590 3599 where a line like 'p,q=1,2' would fail because the automagic
3591 3600 system would be triggered for @p.
3592 3601
3593 3602 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3594 3603 cleanups, code unmodified.
3595 3604
3596 3605 * IPython/genutils.py (Term): added a class for IPython to handle
3597 3606 output. In most cases it will just be a proxy for stdout/err, but
3598 3607 having this allows modifications to be made for some platforms,
3599 3608 such as handling color escapes under Windows. All of this code
3600 3609 was contributed by Gary Bishop, with minor modifications by me.
3601 3610 The actual changes affect many files.
3602 3611
3603 3612 2003-11-30 Fernando Perez <fperez@colorado.edu>
3604 3613
3605 3614 * IPython/iplib.py (file_matches): new completion code, courtesy
3606 3615 of Jeff Collins. This enables filename completion again under
3607 3616 python 2.3, which disabled it at the C level.
3608 3617
3609 3618 2003-11-11 Fernando Perez <fperez@colorado.edu>
3610 3619
3611 3620 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3612 3621 for Numeric.array(map(...)), but often convenient.
3613 3622
3614 3623 2003-11-05 Fernando Perez <fperez@colorado.edu>
3615 3624
3616 3625 * IPython/numutils.py (frange): Changed a call from int() to
3617 3626 int(round()) to prevent a problem reported with arange() in the
3618 3627 numpy list.
3619 3628
3620 3629 2003-10-06 Fernando Perez <fperez@colorado.edu>
3621 3630
3622 3631 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3623 3632 prevent crashes if sys lacks an argv attribute (it happens with
3624 3633 embedded interpreters which build a bare-bones sys module).
3625 3634 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3626 3635
3627 3636 2003-09-24 Fernando Perez <fperez@colorado.edu>
3628 3637
3629 3638 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3630 3639 to protect against poorly written user objects where __getattr__
3631 3640 raises exceptions other than AttributeError. Thanks to a bug
3632 3641 report by Oliver Sander <osander-AT-gmx.de>.
3633 3642
3634 3643 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3635 3644 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3636 3645
3637 3646 2003-09-09 Fernando Perez <fperez@colorado.edu>
3638 3647
3639 3648 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3640 3649 unpacking a list whith a callable as first element would
3641 3650 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3642 3651 Collins.
3643 3652
3644 3653 2003-08-25 *** Released version 0.5.0
3645 3654
3646 3655 2003-08-22 Fernando Perez <fperez@colorado.edu>
3647 3656
3648 3657 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3649 3658 improperly defined user exceptions. Thanks to feedback from Mark
3650 3659 Russell <mrussell-AT-verio.net>.
3651 3660
3652 3661 2003-08-20 Fernando Perez <fperez@colorado.edu>
3653 3662
3654 3663 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3655 3664 printing so that it would print multi-line string forms starting
3656 3665 with a new line. This way the formatting is better respected for
3657 3666 objects which work hard to make nice string forms.
3658 3667
3659 3668 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3660 3669 autocall would overtake data access for objects with both
3661 3670 __getitem__ and __call__.
3662 3671
3663 3672 2003-08-19 *** Released version 0.5.0-rc1
3664 3673
3665 3674 2003-08-19 Fernando Perez <fperez@colorado.edu>
3666 3675
3667 3676 * IPython/deep_reload.py (load_tail): single tiny change here
3668 3677 seems to fix the long-standing bug of dreload() failing to work
3669 3678 for dotted names. But this module is pretty tricky, so I may have
3670 3679 missed some subtlety. Needs more testing!.
3671 3680
3672 3681 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3673 3682 exceptions which have badly implemented __str__ methods.
3674 3683 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3675 3684 which I've been getting reports about from Python 2.3 users. I
3676 3685 wish I had a simple test case to reproduce the problem, so I could
3677 3686 either write a cleaner workaround or file a bug report if
3678 3687 necessary.
3679 3688
3680 3689 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3681 3690 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3682 3691 a bug report by Tjabo Kloppenburg.
3683 3692
3684 3693 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3685 3694 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3686 3695 seems rather unstable. Thanks to a bug report by Tjabo
3687 3696 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3688 3697
3689 3698 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3690 3699 this out soon because of the critical fixes in the inner loop for
3691 3700 generators.
3692 3701
3693 3702 * IPython/Magic.py (Magic.getargspec): removed. This (and
3694 3703 _get_def) have been obsoleted by OInspect for a long time, I
3695 3704 hadn't noticed that they were dead code.
3696 3705 (Magic._ofind): restored _ofind functionality for a few literals
3697 3706 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3698 3707 for things like "hello".capitalize?, since that would require a
3699 3708 potentially dangerous eval() again.
3700 3709
3701 3710 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3702 3711 logic a bit more to clean up the escapes handling and minimize the
3703 3712 use of _ofind to only necessary cases. The interactive 'feel' of
3704 3713 IPython should have improved quite a bit with the changes in
3705 3714 _prefilter and _ofind (besides being far safer than before).
3706 3715
3707 3716 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3708 3717 obscure, never reported). Edit would fail to find the object to
3709 3718 edit under some circumstances.
3710 3719 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3711 3720 which were causing double-calling of generators. Those eval calls
3712 3721 were _very_ dangerous, since code with side effects could be
3713 3722 triggered. As they say, 'eval is evil'... These were the
3714 3723 nastiest evals in IPython. Besides, _ofind is now far simpler,
3715 3724 and it should also be quite a bit faster. Its use of inspect is
3716 3725 also safer, so perhaps some of the inspect-related crashes I've
3717 3726 seen lately with Python 2.3 might be taken care of. That will
3718 3727 need more testing.
3719 3728
3720 3729 2003-08-17 Fernando Perez <fperez@colorado.edu>
3721 3730
3722 3731 * IPython/iplib.py (InteractiveShell._prefilter): significant
3723 3732 simplifications to the logic for handling user escapes. Faster
3724 3733 and simpler code.
3725 3734
3726 3735 2003-08-14 Fernando Perez <fperez@colorado.edu>
3727 3736
3728 3737 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3729 3738 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3730 3739 but it should be quite a bit faster. And the recursive version
3731 3740 generated O(log N) intermediate storage for all rank>1 arrays,
3732 3741 even if they were contiguous.
3733 3742 (l1norm): Added this function.
3734 3743 (norm): Added this function for arbitrary norms (including
3735 3744 l-infinity). l1 and l2 are still special cases for convenience
3736 3745 and speed.
3737 3746
3738 3747 2003-08-03 Fernando Perez <fperez@colorado.edu>
3739 3748
3740 3749 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3741 3750 exceptions, which now raise PendingDeprecationWarnings in Python
3742 3751 2.3. There were some in Magic and some in Gnuplot2.
3743 3752
3744 3753 2003-06-30 Fernando Perez <fperez@colorado.edu>
3745 3754
3746 3755 * IPython/genutils.py (page): modified to call curses only for
3747 3756 terminals where TERM=='xterm'. After problems under many other
3748 3757 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3749 3758
3750 3759 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3751 3760 would be triggered when readline was absent. This was just an old
3752 3761 debugging statement I'd forgotten to take out.
3753 3762
3754 3763 2003-06-20 Fernando Perez <fperez@colorado.edu>
3755 3764
3756 3765 * IPython/genutils.py (clock): modified to return only user time
3757 3766 (not counting system time), after a discussion on scipy. While
3758 3767 system time may be a useful quantity occasionally, it may much
3759 3768 more easily be skewed by occasional swapping or other similar
3760 3769 activity.
3761 3770
3762 3771 2003-06-05 Fernando Perez <fperez@colorado.edu>
3763 3772
3764 3773 * IPython/numutils.py (identity): new function, for building
3765 3774 arbitrary rank Kronecker deltas (mostly backwards compatible with
3766 3775 Numeric.identity)
3767 3776
3768 3777 2003-06-03 Fernando Perez <fperez@colorado.edu>
3769 3778
3770 3779 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3771 3780 arguments passed to magics with spaces, to allow trailing '\' to
3772 3781 work normally (mainly for Windows users).
3773 3782
3774 3783 2003-05-29 Fernando Perez <fperez@colorado.edu>
3775 3784
3776 3785 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3777 3786 instead of pydoc.help. This fixes a bizarre behavior where
3778 3787 printing '%s' % locals() would trigger the help system. Now
3779 3788 ipython behaves like normal python does.
3780 3789
3781 3790 Note that if one does 'from pydoc import help', the bizarre
3782 3791 behavior returns, but this will also happen in normal python, so
3783 3792 it's not an ipython bug anymore (it has to do with how pydoc.help
3784 3793 is implemented).
3785 3794
3786 3795 2003-05-22 Fernando Perez <fperez@colorado.edu>
3787 3796
3788 3797 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3789 3798 return [] instead of None when nothing matches, also match to end
3790 3799 of line. Patch by Gary Bishop.
3791 3800
3792 3801 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3793 3802 protection as before, for files passed on the command line. This
3794 3803 prevents the CrashHandler from kicking in if user files call into
3795 3804 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3796 3805 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3797 3806
3798 3807 2003-05-20 *** Released version 0.4.0
3799 3808
3800 3809 2003-05-20 Fernando Perez <fperez@colorado.edu>
3801 3810
3802 3811 * setup.py: added support for manpages. It's a bit hackish b/c of
3803 3812 a bug in the way the bdist_rpm distutils target handles gzipped
3804 3813 manpages, but it works. After a patch by Jack.
3805 3814
3806 3815 2003-05-19 Fernando Perez <fperez@colorado.edu>
3807 3816
3808 3817 * IPython/numutils.py: added a mockup of the kinds module, since
3809 3818 it was recently removed from Numeric. This way, numutils will
3810 3819 work for all users even if they are missing kinds.
3811 3820
3812 3821 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3813 3822 failure, which can occur with SWIG-wrapped extensions. After a
3814 3823 crash report from Prabhu.
3815 3824
3816 3825 2003-05-16 Fernando Perez <fperez@colorado.edu>
3817 3826
3818 3827 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3819 3828 protect ipython from user code which may call directly
3820 3829 sys.excepthook (this looks like an ipython crash to the user, even
3821 3830 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3822 3831 This is especially important to help users of WxWindows, but may
3823 3832 also be useful in other cases.
3824 3833
3825 3834 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3826 3835 an optional tb_offset to be specified, and to preserve exception
3827 3836 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3828 3837
3829 3838 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3830 3839
3831 3840 2003-05-15 Fernando Perez <fperez@colorado.edu>
3832 3841
3833 3842 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3834 3843 installing for a new user under Windows.
3835 3844
3836 3845 2003-05-12 Fernando Perez <fperez@colorado.edu>
3837 3846
3838 3847 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3839 3848 handler for Emacs comint-based lines. Currently it doesn't do
3840 3849 much (but importantly, it doesn't update the history cache). In
3841 3850 the future it may be expanded if Alex needs more functionality
3842 3851 there.
3843 3852
3844 3853 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3845 3854 info to crash reports.
3846 3855
3847 3856 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3848 3857 just like Python's -c. Also fixed crash with invalid -color
3849 3858 option value at startup. Thanks to Will French
3850 3859 <wfrench-AT-bestweb.net> for the bug report.
3851 3860
3852 3861 2003-05-09 Fernando Perez <fperez@colorado.edu>
3853 3862
3854 3863 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3855 3864 to EvalDict (it's a mapping, after all) and simplified its code
3856 3865 quite a bit, after a nice discussion on c.l.py where Gustavo
3857 3866 Córdova <gcordova-AT-sismex.com> suggested the new version.
3858 3867
3859 3868 2003-04-30 Fernando Perez <fperez@colorado.edu>
3860 3869
3861 3870 * IPython/genutils.py (timings_out): modified it to reduce its
3862 3871 overhead in the common reps==1 case.
3863 3872
3864 3873 2003-04-29 Fernando Perez <fperez@colorado.edu>
3865 3874
3866 3875 * IPython/genutils.py (timings_out): Modified to use the resource
3867 3876 module, which avoids the wraparound problems of time.clock().
3868 3877
3869 3878 2003-04-17 *** Released version 0.2.15pre4
3870 3879
3871 3880 2003-04-17 Fernando Perez <fperez@colorado.edu>
3872 3881
3873 3882 * setup.py (scriptfiles): Split windows-specific stuff over to a
3874 3883 separate file, in an attempt to have a Windows GUI installer.
3875 3884 That didn't work, but part of the groundwork is done.
3876 3885
3877 3886 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3878 3887 indent/unindent with 4 spaces. Particularly useful in combination
3879 3888 with the new auto-indent option.
3880 3889
3881 3890 2003-04-16 Fernando Perez <fperez@colorado.edu>
3882 3891
3883 3892 * IPython/Magic.py: various replacements of self.rc for
3884 3893 self.shell.rc. A lot more remains to be done to fully disentangle
3885 3894 this class from the main Shell class.
3886 3895
3887 3896 * IPython/GnuplotRuntime.py: added checks for mouse support so
3888 3897 that we don't try to enable it if the current gnuplot doesn't
3889 3898 really support it. Also added checks so that we don't try to
3890 3899 enable persist under Windows (where Gnuplot doesn't recognize the
3891 3900 option).
3892 3901
3893 3902 * IPython/iplib.py (InteractiveShell.interact): Added optional
3894 3903 auto-indenting code, after a patch by King C. Shu
3895 3904 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3896 3905 get along well with pasting indented code. If I ever figure out
3897 3906 how to make that part go well, it will become on by default.
3898 3907
3899 3908 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3900 3909 crash ipython if there was an unmatched '%' in the user's prompt
3901 3910 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3902 3911
3903 3912 * IPython/iplib.py (InteractiveShell.interact): removed the
3904 3913 ability to ask the user whether he wants to crash or not at the
3905 3914 'last line' exception handler. Calling functions at that point
3906 3915 changes the stack, and the error reports would have incorrect
3907 3916 tracebacks.
3908 3917
3909 3918 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3910 3919 pass through a peger a pretty-printed form of any object. After a
3911 3920 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3912 3921
3913 3922 2003-04-14 Fernando Perez <fperez@colorado.edu>
3914 3923
3915 3924 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3916 3925 all files in ~ would be modified at first install (instead of
3917 3926 ~/.ipython). This could be potentially disastrous, as the
3918 3927 modification (make line-endings native) could damage binary files.
3919 3928
3920 3929 2003-04-10 Fernando Perez <fperez@colorado.edu>
3921 3930
3922 3931 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3923 3932 handle only lines which are invalid python. This now means that
3924 3933 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3925 3934 for the bug report.
3926 3935
3927 3936 2003-04-01 Fernando Perez <fperez@colorado.edu>
3928 3937
3929 3938 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3930 3939 where failing to set sys.last_traceback would crash pdb.pm().
3931 3940 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3932 3941 report.
3933 3942
3934 3943 2003-03-25 Fernando Perez <fperez@colorado.edu>
3935 3944
3936 3945 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3937 3946 before printing it (it had a lot of spurious blank lines at the
3938 3947 end).
3939 3948
3940 3949 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3941 3950 output would be sent 21 times! Obviously people don't use this
3942 3951 too often, or I would have heard about it.
3943 3952
3944 3953 2003-03-24 Fernando Perez <fperez@colorado.edu>
3945 3954
3946 3955 * setup.py (scriptfiles): renamed the data_files parameter from
3947 3956 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3948 3957 for the patch.
3949 3958
3950 3959 2003-03-20 Fernando Perez <fperez@colorado.edu>
3951 3960
3952 3961 * IPython/genutils.py (error): added error() and fatal()
3953 3962 functions.
3954 3963
3955 3964 2003-03-18 *** Released version 0.2.15pre3
3956 3965
3957 3966 2003-03-18 Fernando Perez <fperez@colorado.edu>
3958 3967
3959 3968 * setupext/install_data_ext.py
3960 3969 (install_data_ext.initialize_options): Class contributed by Jack
3961 3970 Moffit for fixing the old distutils hack. He is sending this to
3962 3971 the distutils folks so in the future we may not need it as a
3963 3972 private fix.
3964 3973
3965 3974 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3966 3975 changes for Debian packaging. See his patch for full details.
3967 3976 The old distutils hack of making the ipythonrc* files carry a
3968 3977 bogus .py extension is gone, at last. Examples were moved to a
3969 3978 separate subdir under doc/, and the separate executable scripts
3970 3979 now live in their own directory. Overall a great cleanup. The
3971 3980 manual was updated to use the new files, and setup.py has been
3972 3981 fixed for this setup.
3973 3982
3974 3983 * IPython/PyColorize.py (Parser.usage): made non-executable and
3975 3984 created a pycolor wrapper around it to be included as a script.
3976 3985
3977 3986 2003-03-12 *** Released version 0.2.15pre2
3978 3987
3979 3988 2003-03-12 Fernando Perez <fperez@colorado.edu>
3980 3989
3981 3990 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3982 3991 long-standing problem with garbage characters in some terminals.
3983 3992 The issue was really that the \001 and \002 escapes must _only_ be
3984 3993 passed to input prompts (which call readline), but _never_ to
3985 3994 normal text to be printed on screen. I changed ColorANSI to have
3986 3995 two classes: TermColors and InputTermColors, each with the
3987 3996 appropriate escapes for input prompts or normal text. The code in
3988 3997 Prompts.py got slightly more complicated, but this very old and
3989 3998 annoying bug is finally fixed.
3990 3999
3991 4000 All the credit for nailing down the real origin of this problem
3992 4001 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3993 4002 *Many* thanks to him for spending quite a bit of effort on this.
3994 4003
3995 4004 2003-03-05 *** Released version 0.2.15pre1
3996 4005
3997 4006 2003-03-03 Fernando Perez <fperez@colorado.edu>
3998 4007
3999 4008 * IPython/FakeModule.py: Moved the former _FakeModule to a
4000 4009 separate file, because it's also needed by Magic (to fix a similar
4001 4010 pickle-related issue in @run).
4002 4011
4003 4012 2003-03-02 Fernando Perez <fperez@colorado.edu>
4004 4013
4005 4014 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4006 4015 the autocall option at runtime.
4007 4016 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4008 4017 across Magic.py to start separating Magic from InteractiveShell.
4009 4018 (Magic._ofind): Fixed to return proper namespace for dotted
4010 4019 names. Before, a dotted name would always return 'not currently
4011 4020 defined', because it would find the 'parent'. s.x would be found,
4012 4021 but since 'x' isn't defined by itself, it would get confused.
4013 4022 (Magic.magic_run): Fixed pickling problems reported by Ralf
4014 4023 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4015 4024 that I'd used when Mike Heeter reported similar issues at the
4016 4025 top-level, but now for @run. It boils down to injecting the
4017 4026 namespace where code is being executed with something that looks
4018 4027 enough like a module to fool pickle.dump(). Since a pickle stores
4019 4028 a named reference to the importing module, we need this for
4020 4029 pickles to save something sensible.
4021 4030
4022 4031 * IPython/ipmaker.py (make_IPython): added an autocall option.
4023 4032
4024 4033 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4025 4034 the auto-eval code. Now autocalling is an option, and the code is
4026 4035 also vastly safer. There is no more eval() involved at all.
4027 4036
4028 4037 2003-03-01 Fernando Perez <fperez@colorado.edu>
4029 4038
4030 4039 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4031 4040 dict with named keys instead of a tuple.
4032 4041
4033 4042 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4034 4043
4035 4044 * setup.py (make_shortcut): Fixed message about directories
4036 4045 created during Windows installation (the directories were ok, just
4037 4046 the printed message was misleading). Thanks to Chris Liechti
4038 4047 <cliechti-AT-gmx.net> for the heads up.
4039 4048
4040 4049 2003-02-21 Fernando Perez <fperez@colorado.edu>
4041 4050
4042 4051 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4043 4052 of ValueError exception when checking for auto-execution. This
4044 4053 one is raised by things like Numeric arrays arr.flat when the
4045 4054 array is non-contiguous.
4046 4055
4047 4056 2003-01-31 Fernando Perez <fperez@colorado.edu>
4048 4057
4049 4058 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4050 4059 not return any value at all (even though the command would get
4051 4060 executed).
4052 4061 (xsys): Flush stdout right after printing the command to ensure
4053 4062 proper ordering of commands and command output in the total
4054 4063 output.
4055 4064 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4056 4065 system/getoutput as defaults. The old ones are kept for
4057 4066 compatibility reasons, so no code which uses this library needs
4058 4067 changing.
4059 4068
4060 4069 2003-01-27 *** Released version 0.2.14
4061 4070
4062 4071 2003-01-25 Fernando Perez <fperez@colorado.edu>
4063 4072
4064 4073 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4065 4074 functions defined in previous edit sessions could not be re-edited
4066 4075 (because the temp files were immediately removed). Now temp files
4067 4076 are removed only at IPython's exit.
4068 4077 (Magic.magic_run): Improved @run to perform shell-like expansions
4069 4078 on its arguments (~users and $VARS). With this, @run becomes more
4070 4079 like a normal command-line.
4071 4080
4072 4081 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4073 4082 bugs related to embedding and cleaned up that code. A fairly
4074 4083 important one was the impossibility to access the global namespace
4075 4084 through the embedded IPython (only local variables were visible).
4076 4085
4077 4086 2003-01-14 Fernando Perez <fperez@colorado.edu>
4078 4087
4079 4088 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4080 4089 auto-calling to be a bit more conservative. Now it doesn't get
4081 4090 triggered if any of '!=()<>' are in the rest of the input line, to
4082 4091 allow comparing callables. Thanks to Alex for the heads up.
4083 4092
4084 4093 2003-01-07 Fernando Perez <fperez@colorado.edu>
4085 4094
4086 4095 * IPython/genutils.py (page): fixed estimation of the number of
4087 4096 lines in a string to be paged to simply count newlines. This
4088 4097 prevents over-guessing due to embedded escape sequences. A better
4089 4098 long-term solution would involve stripping out the control chars
4090 4099 for the count, but it's potentially so expensive I just don't
4091 4100 think it's worth doing.
4092 4101
4093 4102 2002-12-19 *** Released version 0.2.14pre50
4094 4103
4095 4104 2002-12-19 Fernando Perez <fperez@colorado.edu>
4096 4105
4097 4106 * tools/release (version): Changed release scripts to inform
4098 4107 Andrea and build a NEWS file with a list of recent changes.
4099 4108
4100 4109 * IPython/ColorANSI.py (__all__): changed terminal detection
4101 4110 code. Seems to work better for xterms without breaking
4102 4111 konsole. Will need more testing to determine if WinXP and Mac OSX
4103 4112 also work ok.
4104 4113
4105 4114 2002-12-18 *** Released version 0.2.14pre49
4106 4115
4107 4116 2002-12-18 Fernando Perez <fperez@colorado.edu>
4108 4117
4109 4118 * Docs: added new info about Mac OSX, from Andrea.
4110 4119
4111 4120 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4112 4121 allow direct plotting of python strings whose format is the same
4113 4122 of gnuplot data files.
4114 4123
4115 4124 2002-12-16 Fernando Perez <fperez@colorado.edu>
4116 4125
4117 4126 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4118 4127 value of exit question to be acknowledged.
4119 4128
4120 4129 2002-12-03 Fernando Perez <fperez@colorado.edu>
4121 4130
4122 4131 * IPython/ipmaker.py: removed generators, which had been added
4123 4132 by mistake in an earlier debugging run. This was causing trouble
4124 4133 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4125 4134 for pointing this out.
4126 4135
4127 4136 2002-11-17 Fernando Perez <fperez@colorado.edu>
4128 4137
4129 4138 * Manual: updated the Gnuplot section.
4130 4139
4131 4140 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4132 4141 a much better split of what goes in Runtime and what goes in
4133 4142 Interactive.
4134 4143
4135 4144 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4136 4145 being imported from iplib.
4137 4146
4138 4147 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4139 4148 for command-passing. Now the global Gnuplot instance is called
4140 4149 'gp' instead of 'g', which was really a far too fragile and
4141 4150 common name.
4142 4151
4143 4152 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4144 4153 bounding boxes generated by Gnuplot for square plots.
4145 4154
4146 4155 * IPython/genutils.py (popkey): new function added. I should
4147 4156 suggest this on c.l.py as a dict method, it seems useful.
4148 4157
4149 4158 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4150 4159 to transparently handle PostScript generation. MUCH better than
4151 4160 the previous plot_eps/replot_eps (which I removed now). The code
4152 4161 is also fairly clean and well documented now (including
4153 4162 docstrings).
4154 4163
4155 4164 2002-11-13 Fernando Perez <fperez@colorado.edu>
4156 4165
4157 4166 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4158 4167 (inconsistent with options).
4159 4168
4160 4169 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4161 4170 manually disabled, I don't know why. Fixed it.
4162 4171 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4163 4172 eps output.
4164 4173
4165 4174 2002-11-12 Fernando Perez <fperez@colorado.edu>
4166 4175
4167 4176 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4168 4177 don't propagate up to caller. Fixes crash reported by François
4169 4178 Pinard.
4170 4179
4171 4180 2002-11-09 Fernando Perez <fperez@colorado.edu>
4172 4181
4173 4182 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4174 4183 history file for new users.
4175 4184 (make_IPython): fixed bug where initial install would leave the
4176 4185 user running in the .ipython dir.
4177 4186 (make_IPython): fixed bug where config dir .ipython would be
4178 4187 created regardless of the given -ipythondir option. Thanks to Cory
4179 4188 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4180 4189
4181 4190 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4182 4191 type confirmations. Will need to use it in all of IPython's code
4183 4192 consistently.
4184 4193
4185 4194 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4186 4195 context to print 31 lines instead of the default 5. This will make
4187 4196 the crash reports extremely detailed in case the problem is in
4188 4197 libraries I don't have access to.
4189 4198
4190 4199 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4191 4200 line of defense' code to still crash, but giving users fair
4192 4201 warning. I don't want internal errors to go unreported: if there's
4193 4202 an internal problem, IPython should crash and generate a full
4194 4203 report.
4195 4204
4196 4205 2002-11-08 Fernando Perez <fperez@colorado.edu>
4197 4206
4198 4207 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4199 4208 otherwise uncaught exceptions which can appear if people set
4200 4209 sys.stdout to something badly broken. Thanks to a crash report
4201 4210 from henni-AT-mail.brainbot.com.
4202 4211
4203 4212 2002-11-04 Fernando Perez <fperez@colorado.edu>
4204 4213
4205 4214 * IPython/iplib.py (InteractiveShell.interact): added
4206 4215 __IPYTHON__active to the builtins. It's a flag which goes on when
4207 4216 the interaction starts and goes off again when it stops. This
4208 4217 allows embedding code to detect being inside IPython. Before this
4209 4218 was done via __IPYTHON__, but that only shows that an IPython
4210 4219 instance has been created.
4211 4220
4212 4221 * IPython/Magic.py (Magic.magic_env): I realized that in a
4213 4222 UserDict, instance.data holds the data as a normal dict. So I
4214 4223 modified @env to return os.environ.data instead of rebuilding a
4215 4224 dict by hand.
4216 4225
4217 4226 2002-11-02 Fernando Perez <fperez@colorado.edu>
4218 4227
4219 4228 * IPython/genutils.py (warn): changed so that level 1 prints no
4220 4229 header. Level 2 is now the default (with 'WARNING' header, as
4221 4230 before). I think I tracked all places where changes were needed in
4222 4231 IPython, but outside code using the old level numbering may have
4223 4232 broken.
4224 4233
4225 4234 * IPython/iplib.py (InteractiveShell.runcode): added this to
4226 4235 handle the tracebacks in SystemExit traps correctly. The previous
4227 4236 code (through interact) was printing more of the stack than
4228 4237 necessary, showing IPython internal code to the user.
4229 4238
4230 4239 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4231 4240 default. Now that the default at the confirmation prompt is yes,
4232 4241 it's not so intrusive. François' argument that ipython sessions
4233 4242 tend to be complex enough not to lose them from an accidental C-d,
4234 4243 is a valid one.
4235 4244
4236 4245 * IPython/iplib.py (InteractiveShell.interact): added a
4237 4246 showtraceback() call to the SystemExit trap, and modified the exit
4238 4247 confirmation to have yes as the default.
4239 4248
4240 4249 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4241 4250 this file. It's been gone from the code for a long time, this was
4242 4251 simply leftover junk.
4243 4252
4244 4253 2002-11-01 Fernando Perez <fperez@colorado.edu>
4245 4254
4246 4255 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4247 4256 added. If set, IPython now traps EOF and asks for
4248 4257 confirmation. After a request by François Pinard.
4249 4258
4250 4259 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4251 4260 of @abort, and with a new (better) mechanism for handling the
4252 4261 exceptions.
4253 4262
4254 4263 2002-10-27 Fernando Perez <fperez@colorado.edu>
4255 4264
4256 4265 * IPython/usage.py (__doc__): updated the --help information and
4257 4266 the ipythonrc file to indicate that -log generates
4258 4267 ./ipython.log. Also fixed the corresponding info in @logstart.
4259 4268 This and several other fixes in the manuals thanks to reports by
4260 4269 François Pinard <pinard-AT-iro.umontreal.ca>.
4261 4270
4262 4271 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4263 4272 refer to @logstart (instead of @log, which doesn't exist).
4264 4273
4265 4274 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4266 4275 AttributeError crash. Thanks to Christopher Armstrong
4267 4276 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4268 4277 introduced recently (in 0.2.14pre37) with the fix to the eval
4269 4278 problem mentioned below.
4270 4279
4271 4280 2002-10-17 Fernando Perez <fperez@colorado.edu>
4272 4281
4273 4282 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4274 4283 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4275 4284
4276 4285 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4277 4286 this function to fix a problem reported by Alex Schmolck. He saw
4278 4287 it with list comprehensions and generators, which were getting
4279 4288 called twice. The real problem was an 'eval' call in testing for
4280 4289 automagic which was evaluating the input line silently.
4281 4290
4282 4291 This is a potentially very nasty bug, if the input has side
4283 4292 effects which must not be repeated. The code is much cleaner now,
4284 4293 without any blanket 'except' left and with a regexp test for
4285 4294 actual function names.
4286 4295
4287 4296 But an eval remains, which I'm not fully comfortable with. I just
4288 4297 don't know how to find out if an expression could be a callable in
4289 4298 the user's namespace without doing an eval on the string. However
4290 4299 that string is now much more strictly checked so that no code
4291 4300 slips by, so the eval should only happen for things that can
4292 4301 really be only function/method names.
4293 4302
4294 4303 2002-10-15 Fernando Perez <fperez@colorado.edu>
4295 4304
4296 4305 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4297 4306 OSX information to main manual, removed README_Mac_OSX file from
4298 4307 distribution. Also updated credits for recent additions.
4299 4308
4300 4309 2002-10-10 Fernando Perez <fperez@colorado.edu>
4301 4310
4302 4311 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4303 4312 terminal-related issues. Many thanks to Andrea Riciputi
4304 4313 <andrea.riciputi-AT-libero.it> for writing it.
4305 4314
4306 4315 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4307 4316 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4308 4317
4309 4318 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4310 4319 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4311 4320 <syver-en-AT-online.no> who both submitted patches for this problem.
4312 4321
4313 4322 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4314 4323 global embedding to make sure that things don't overwrite user
4315 4324 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4316 4325
4317 4326 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4318 4327 compatibility. Thanks to Hayden Callow
4319 4328 <h.callow-AT-elec.canterbury.ac.nz>
4320 4329
4321 4330 2002-10-04 Fernando Perez <fperez@colorado.edu>
4322 4331
4323 4332 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4324 4333 Gnuplot.File objects.
4325 4334
4326 4335 2002-07-23 Fernando Perez <fperez@colorado.edu>
4327 4336
4328 4337 * IPython/genutils.py (timing): Added timings() and timing() for
4329 4338 quick access to the most commonly needed data, the execution
4330 4339 times. Old timing() renamed to timings_out().
4331 4340
4332 4341 2002-07-18 Fernando Perez <fperez@colorado.edu>
4333 4342
4334 4343 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4335 4344 bug with nested instances disrupting the parent's tab completion.
4336 4345
4337 4346 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4338 4347 all_completions code to begin the emacs integration.
4339 4348
4340 4349 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4341 4350 argument to allow titling individual arrays when plotting.
4342 4351
4343 4352 2002-07-15 Fernando Perez <fperez@colorado.edu>
4344 4353
4345 4354 * setup.py (make_shortcut): changed to retrieve the value of
4346 4355 'Program Files' directory from the registry (this value changes in
4347 4356 non-english versions of Windows). Thanks to Thomas Fanslau
4348 4357 <tfanslau-AT-gmx.de> for the report.
4349 4358
4350 4359 2002-07-10 Fernando Perez <fperez@colorado.edu>
4351 4360
4352 4361 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4353 4362 a bug in pdb, which crashes if a line with only whitespace is
4354 4363 entered. Bug report submitted to sourceforge.
4355 4364
4356 4365 2002-07-09 Fernando Perez <fperez@colorado.edu>
4357 4366
4358 4367 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4359 4368 reporting exceptions (it's a bug in inspect.py, I just set a
4360 4369 workaround).
4361 4370
4362 4371 2002-07-08 Fernando Perez <fperez@colorado.edu>
4363 4372
4364 4373 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4365 4374 __IPYTHON__ in __builtins__ to show up in user_ns.
4366 4375
4367 4376 2002-07-03 Fernando Perez <fperez@colorado.edu>
4368 4377
4369 4378 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4370 4379 name from @gp_set_instance to @gp_set_default.
4371 4380
4372 4381 * IPython/ipmaker.py (make_IPython): default editor value set to
4373 4382 '0' (a string), to match the rc file. Otherwise will crash when
4374 4383 .strip() is called on it.
4375 4384
4376 4385
4377 4386 2002-06-28 Fernando Perez <fperez@colorado.edu>
4378 4387
4379 4388 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4380 4389 of files in current directory when a file is executed via
4381 4390 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4382 4391
4383 4392 * setup.py (manfiles): fix for rpm builds, submitted by RA
4384 4393 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4385 4394
4386 4395 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4387 4396 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4388 4397 string!). A. Schmolck caught this one.
4389 4398
4390 4399 2002-06-27 Fernando Perez <fperez@colorado.edu>
4391 4400
4392 4401 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4393 4402 defined files at the cmd line. __name__ wasn't being set to
4394 4403 __main__.
4395 4404
4396 4405 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4397 4406 regular lists and tuples besides Numeric arrays.
4398 4407
4399 4408 * IPython/Prompts.py (CachedOutput.__call__): Added output
4400 4409 supression for input ending with ';'. Similar to Mathematica and
4401 4410 Matlab. The _* vars and Out[] list are still updated, just like
4402 4411 Mathematica behaves.
4403 4412
4404 4413 2002-06-25 Fernando Perez <fperez@colorado.edu>
4405 4414
4406 4415 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4407 4416 .ini extensions for profiels under Windows.
4408 4417
4409 4418 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4410 4419 string form. Fix contributed by Alexander Schmolck
4411 4420 <a.schmolck-AT-gmx.net>
4412 4421
4413 4422 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4414 4423 pre-configured Gnuplot instance.
4415 4424
4416 4425 2002-06-21 Fernando Perez <fperez@colorado.edu>
4417 4426
4418 4427 * IPython/numutils.py (exp_safe): new function, works around the
4419 4428 underflow problems in Numeric.
4420 4429 (log2): New fn. Safe log in base 2: returns exact integer answer
4421 4430 for exact integer powers of 2.
4422 4431
4423 4432 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4424 4433 properly.
4425 4434
4426 4435 2002-06-20 Fernando Perez <fperez@colorado.edu>
4427 4436
4428 4437 * IPython/genutils.py (timing): new function like
4429 4438 Mathematica's. Similar to time_test, but returns more info.
4430 4439
4431 4440 2002-06-18 Fernando Perez <fperez@colorado.edu>
4432 4441
4433 4442 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4434 4443 according to Mike Heeter's suggestions.
4435 4444
4436 4445 2002-06-16 Fernando Perez <fperez@colorado.edu>
4437 4446
4438 4447 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4439 4448 system. GnuplotMagic is gone as a user-directory option. New files
4440 4449 make it easier to use all the gnuplot stuff both from external
4441 4450 programs as well as from IPython. Had to rewrite part of
4442 4451 hardcopy() b/c of a strange bug: often the ps files simply don't
4443 4452 get created, and require a repeat of the command (often several
4444 4453 times).
4445 4454
4446 4455 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4447 4456 resolve output channel at call time, so that if sys.stderr has
4448 4457 been redirected by user this gets honored.
4449 4458
4450 4459 2002-06-13 Fernando Perez <fperez@colorado.edu>
4451 4460
4452 4461 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4453 4462 IPShell. Kept a copy with the old names to avoid breaking people's
4454 4463 embedded code.
4455 4464
4456 4465 * IPython/ipython: simplified it to the bare minimum after
4457 4466 Holger's suggestions. Added info about how to use it in
4458 4467 PYTHONSTARTUP.
4459 4468
4460 4469 * IPython/Shell.py (IPythonShell): changed the options passing
4461 4470 from a string with funky %s replacements to a straight list. Maybe
4462 4471 a bit more typing, but it follows sys.argv conventions, so there's
4463 4472 less special-casing to remember.
4464 4473
4465 4474 2002-06-12 Fernando Perez <fperez@colorado.edu>
4466 4475
4467 4476 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4468 4477 command. Thanks to a suggestion by Mike Heeter.
4469 4478 (Magic.magic_pfile): added behavior to look at filenames if given
4470 4479 arg is not a defined object.
4471 4480 (Magic.magic_save): New @save function to save code snippets. Also
4472 4481 a Mike Heeter idea.
4473 4482
4474 4483 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4475 4484 plot() and replot(). Much more convenient now, especially for
4476 4485 interactive use.
4477 4486
4478 4487 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4479 4488 filenames.
4480 4489
4481 4490 2002-06-02 Fernando Perez <fperez@colorado.edu>
4482 4491
4483 4492 * IPython/Struct.py (Struct.__init__): modified to admit
4484 4493 initialization via another struct.
4485 4494
4486 4495 * IPython/genutils.py (SystemExec.__init__): New stateful
4487 4496 interface to xsys and bq. Useful for writing system scripts.
4488 4497
4489 4498 2002-05-30 Fernando Perez <fperez@colorado.edu>
4490 4499
4491 4500 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4492 4501 documents. This will make the user download smaller (it's getting
4493 4502 too big).
4494 4503
4495 4504 2002-05-29 Fernando Perez <fperez@colorado.edu>
4496 4505
4497 4506 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4498 4507 fix problems with shelve and pickle. Seems to work, but I don't
4499 4508 know if corner cases break it. Thanks to Mike Heeter
4500 4509 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4501 4510
4502 4511 2002-05-24 Fernando Perez <fperez@colorado.edu>
4503 4512
4504 4513 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4505 4514 macros having broken.
4506 4515
4507 4516 2002-05-21 Fernando Perez <fperez@colorado.edu>
4508 4517
4509 4518 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4510 4519 introduced logging bug: all history before logging started was
4511 4520 being written one character per line! This came from the redesign
4512 4521 of the input history as a special list which slices to strings,
4513 4522 not to lists.
4514 4523
4515 4524 2002-05-20 Fernando Perez <fperez@colorado.edu>
4516 4525
4517 4526 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4518 4527 be an attribute of all classes in this module. The design of these
4519 4528 classes needs some serious overhauling.
4520 4529
4521 4530 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4522 4531 which was ignoring '_' in option names.
4523 4532
4524 4533 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4525 4534 'Verbose_novars' to 'Context' and made it the new default. It's a
4526 4535 bit more readable and also safer than verbose.
4527 4536
4528 4537 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4529 4538 triple-quoted strings.
4530 4539
4531 4540 * IPython/OInspect.py (__all__): new module exposing the object
4532 4541 introspection facilities. Now the corresponding magics are dummy
4533 4542 wrappers around this. Having this module will make it much easier
4534 4543 to put these functions into our modified pdb.
4535 4544 This new object inspector system uses the new colorizing module,
4536 4545 so source code and other things are nicely syntax highlighted.
4537 4546
4538 4547 2002-05-18 Fernando Perez <fperez@colorado.edu>
4539 4548
4540 4549 * IPython/ColorANSI.py: Split the coloring tools into a separate
4541 4550 module so I can use them in other code easier (they were part of
4542 4551 ultraTB).
4543 4552
4544 4553 2002-05-17 Fernando Perez <fperez@colorado.edu>
4545 4554
4546 4555 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4547 4556 fixed it to set the global 'g' also to the called instance, as
4548 4557 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4549 4558 user's 'g' variables).
4550 4559
4551 4560 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4552 4561 global variables (aliases to _ih,_oh) so that users which expect
4553 4562 In[5] or Out[7] to work aren't unpleasantly surprised.
4554 4563 (InputList.__getslice__): new class to allow executing slices of
4555 4564 input history directly. Very simple class, complements the use of
4556 4565 macros.
4557 4566
4558 4567 2002-05-16 Fernando Perez <fperez@colorado.edu>
4559 4568
4560 4569 * setup.py (docdirbase): make doc directory be just doc/IPython
4561 4570 without version numbers, it will reduce clutter for users.
4562 4571
4563 4572 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4564 4573 execfile call to prevent possible memory leak. See for details:
4565 4574 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4566 4575
4567 4576 2002-05-15 Fernando Perez <fperez@colorado.edu>
4568 4577
4569 4578 * IPython/Magic.py (Magic.magic_psource): made the object
4570 4579 introspection names be more standard: pdoc, pdef, pfile and
4571 4580 psource. They all print/page their output, and it makes
4572 4581 remembering them easier. Kept old names for compatibility as
4573 4582 aliases.
4574 4583
4575 4584 2002-05-14 Fernando Perez <fperez@colorado.edu>
4576 4585
4577 4586 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4578 4587 what the mouse problem was. The trick is to use gnuplot with temp
4579 4588 files and NOT with pipes (for data communication), because having
4580 4589 both pipes and the mouse on is bad news.
4581 4590
4582 4591 2002-05-13 Fernando Perez <fperez@colorado.edu>
4583 4592
4584 4593 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4585 4594 bug. Information would be reported about builtins even when
4586 4595 user-defined functions overrode them.
4587 4596
4588 4597 2002-05-11 Fernando Perez <fperez@colorado.edu>
4589 4598
4590 4599 * IPython/__init__.py (__all__): removed FlexCompleter from
4591 4600 __all__ so that things don't fail in platforms without readline.
4592 4601
4593 4602 2002-05-10 Fernando Perez <fperez@colorado.edu>
4594 4603
4595 4604 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4596 4605 it requires Numeric, effectively making Numeric a dependency for
4597 4606 IPython.
4598 4607
4599 4608 * Released 0.2.13
4600 4609
4601 4610 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4602 4611 profiler interface. Now all the major options from the profiler
4603 4612 module are directly supported in IPython, both for single
4604 4613 expressions (@prun) and for full programs (@run -p).
4605 4614
4606 4615 2002-05-09 Fernando Perez <fperez@colorado.edu>
4607 4616
4608 4617 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4609 4618 magic properly formatted for screen.
4610 4619
4611 4620 * setup.py (make_shortcut): Changed things to put pdf version in
4612 4621 doc/ instead of doc/manual (had to change lyxport a bit).
4613 4622
4614 4623 * IPython/Magic.py (Profile.string_stats): made profile runs go
4615 4624 through pager (they are long and a pager allows searching, saving,
4616 4625 etc.)
4617 4626
4618 4627 2002-05-08 Fernando Perez <fperez@colorado.edu>
4619 4628
4620 4629 * Released 0.2.12
4621 4630
4622 4631 2002-05-06 Fernando Perez <fperez@colorado.edu>
4623 4632
4624 4633 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4625 4634 introduced); 'hist n1 n2' was broken.
4626 4635 (Magic.magic_pdb): added optional on/off arguments to @pdb
4627 4636 (Magic.magic_run): added option -i to @run, which executes code in
4628 4637 the IPython namespace instead of a clean one. Also added @irun as
4629 4638 an alias to @run -i.
4630 4639
4631 4640 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4632 4641 fixed (it didn't really do anything, the namespaces were wrong).
4633 4642
4634 4643 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4635 4644
4636 4645 * IPython/__init__.py (__all__): Fixed package namespace, now
4637 4646 'import IPython' does give access to IPython.<all> as
4638 4647 expected. Also renamed __release__ to Release.
4639 4648
4640 4649 * IPython/Debugger.py (__license__): created new Pdb class which
4641 4650 functions like a drop-in for the normal pdb.Pdb but does NOT
4642 4651 import readline by default. This way it doesn't muck up IPython's
4643 4652 readline handling, and now tab-completion finally works in the
4644 4653 debugger -- sort of. It completes things globally visible, but the
4645 4654 completer doesn't track the stack as pdb walks it. That's a bit
4646 4655 tricky, and I'll have to implement it later.
4647 4656
4648 4657 2002-05-05 Fernando Perez <fperez@colorado.edu>
4649 4658
4650 4659 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4651 4660 magic docstrings when printed via ? (explicit \'s were being
4652 4661 printed).
4653 4662
4654 4663 * IPython/ipmaker.py (make_IPython): fixed namespace
4655 4664 identification bug. Now variables loaded via logs or command-line
4656 4665 files are recognized in the interactive namespace by @who.
4657 4666
4658 4667 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4659 4668 log replay system stemming from the string form of Structs.
4660 4669
4661 4670 * IPython/Magic.py (Macro.__init__): improved macros to properly
4662 4671 handle magic commands in them.
4663 4672 (Magic.magic_logstart): usernames are now expanded so 'logstart
4664 4673 ~/mylog' now works.
4665 4674
4666 4675 * IPython/iplib.py (complete): fixed bug where paths starting with
4667 4676 '/' would be completed as magic names.
4668 4677
4669 4678 2002-05-04 Fernando Perez <fperez@colorado.edu>
4670 4679
4671 4680 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4672 4681 allow running full programs under the profiler's control.
4673 4682
4674 4683 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4675 4684 mode to report exceptions verbosely but without formatting
4676 4685 variables. This addresses the issue of ipython 'freezing' (it's
4677 4686 not frozen, but caught in an expensive formatting loop) when huge
4678 4687 variables are in the context of an exception.
4679 4688 (VerboseTB.text): Added '--->' markers at line where exception was
4680 4689 triggered. Much clearer to read, especially in NoColor modes.
4681 4690
4682 4691 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4683 4692 implemented in reverse when changing to the new parse_options().
4684 4693
4685 4694 2002-05-03 Fernando Perez <fperez@colorado.edu>
4686 4695
4687 4696 * IPython/Magic.py (Magic.parse_options): new function so that
4688 4697 magics can parse options easier.
4689 4698 (Magic.magic_prun): new function similar to profile.run(),
4690 4699 suggested by Chris Hart.
4691 4700 (Magic.magic_cd): fixed behavior so that it only changes if
4692 4701 directory actually is in history.
4693 4702
4694 4703 * IPython/usage.py (__doc__): added information about potential
4695 4704 slowness of Verbose exception mode when there are huge data
4696 4705 structures to be formatted (thanks to Archie Paulson).
4697 4706
4698 4707 * IPython/ipmaker.py (make_IPython): Changed default logging
4699 4708 (when simply called with -log) to use curr_dir/ipython.log in
4700 4709 rotate mode. Fixed crash which was occuring with -log before
4701 4710 (thanks to Jim Boyle).
4702 4711
4703 4712 2002-05-01 Fernando Perez <fperez@colorado.edu>
4704 4713
4705 4714 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4706 4715 was nasty -- though somewhat of a corner case).
4707 4716
4708 4717 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4709 4718 text (was a bug).
4710 4719
4711 4720 2002-04-30 Fernando Perez <fperez@colorado.edu>
4712 4721
4713 4722 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4714 4723 a print after ^D or ^C from the user so that the In[] prompt
4715 4724 doesn't over-run the gnuplot one.
4716 4725
4717 4726 2002-04-29 Fernando Perez <fperez@colorado.edu>
4718 4727
4719 4728 * Released 0.2.10
4720 4729
4721 4730 * IPython/__release__.py (version): get date dynamically.
4722 4731
4723 4732 * Misc. documentation updates thanks to Arnd's comments. Also ran
4724 4733 a full spellcheck on the manual (hadn't been done in a while).
4725 4734
4726 4735 2002-04-27 Fernando Perez <fperez@colorado.edu>
4727 4736
4728 4737 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4729 4738 starting a log in mid-session would reset the input history list.
4730 4739
4731 4740 2002-04-26 Fernando Perez <fperez@colorado.edu>
4732 4741
4733 4742 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4734 4743 all files were being included in an update. Now anything in
4735 4744 UserConfig that matches [A-Za-z]*.py will go (this excludes
4736 4745 __init__.py)
4737 4746
4738 4747 2002-04-25 Fernando Perez <fperez@colorado.edu>
4739 4748
4740 4749 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4741 4750 to __builtins__ so that any form of embedded or imported code can
4742 4751 test for being inside IPython.
4743 4752
4744 4753 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4745 4754 changed to GnuplotMagic because it's now an importable module,
4746 4755 this makes the name follow that of the standard Gnuplot module.
4747 4756 GnuplotMagic can now be loaded at any time in mid-session.
4748 4757
4749 4758 2002-04-24 Fernando Perez <fperez@colorado.edu>
4750 4759
4751 4760 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4752 4761 the globals (IPython has its own namespace) and the
4753 4762 PhysicalQuantity stuff is much better anyway.
4754 4763
4755 4764 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4756 4765 embedding example to standard user directory for
4757 4766 distribution. Also put it in the manual.
4758 4767
4759 4768 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4760 4769 instance as first argument (so it doesn't rely on some obscure
4761 4770 hidden global).
4762 4771
4763 4772 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4764 4773 delimiters. While it prevents ().TAB from working, it allows
4765 4774 completions in open (... expressions. This is by far a more common
4766 4775 case.
4767 4776
4768 4777 2002-04-23 Fernando Perez <fperez@colorado.edu>
4769 4778
4770 4779 * IPython/Extensions/InterpreterPasteInput.py: new
4771 4780 syntax-processing module for pasting lines with >>> or ... at the
4772 4781 start.
4773 4782
4774 4783 * IPython/Extensions/PhysicalQ_Interactive.py
4775 4784 (PhysicalQuantityInteractive.__int__): fixed to work with either
4776 4785 Numeric or math.
4777 4786
4778 4787 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4779 4788 provided profiles. Now we have:
4780 4789 -math -> math module as * and cmath with its own namespace.
4781 4790 -numeric -> Numeric as *, plus gnuplot & grace
4782 4791 -physics -> same as before
4783 4792
4784 4793 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4785 4794 user-defined magics wouldn't be found by @magic if they were
4786 4795 defined as class methods. Also cleaned up the namespace search
4787 4796 logic and the string building (to use %s instead of many repeated
4788 4797 string adds).
4789 4798
4790 4799 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4791 4800 of user-defined magics to operate with class methods (cleaner, in
4792 4801 line with the gnuplot code).
4793 4802
4794 4803 2002-04-22 Fernando Perez <fperez@colorado.edu>
4795 4804
4796 4805 * setup.py: updated dependency list so that manual is updated when
4797 4806 all included files change.
4798 4807
4799 4808 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4800 4809 the delimiter removal option (the fix is ugly right now).
4801 4810
4802 4811 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4803 4812 all of the math profile (quicker loading, no conflict between
4804 4813 g-9.8 and g-gnuplot).
4805 4814
4806 4815 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4807 4816 name of post-mortem files to IPython_crash_report.txt.
4808 4817
4809 4818 * Cleanup/update of the docs. Added all the new readline info and
4810 4819 formatted all lists as 'real lists'.
4811 4820
4812 4821 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4813 4822 tab-completion options, since the full readline parse_and_bind is
4814 4823 now accessible.
4815 4824
4816 4825 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4817 4826 handling of readline options. Now users can specify any string to
4818 4827 be passed to parse_and_bind(), as well as the delimiters to be
4819 4828 removed.
4820 4829 (InteractiveShell.__init__): Added __name__ to the global
4821 4830 namespace so that things like Itpl which rely on its existence
4822 4831 don't crash.
4823 4832 (InteractiveShell._prefilter): Defined the default with a _ so
4824 4833 that prefilter() is easier to override, while the default one
4825 4834 remains available.
4826 4835
4827 4836 2002-04-18 Fernando Perez <fperez@colorado.edu>
4828 4837
4829 4838 * Added information about pdb in the docs.
4830 4839
4831 4840 2002-04-17 Fernando Perez <fperez@colorado.edu>
4832 4841
4833 4842 * IPython/ipmaker.py (make_IPython): added rc_override option to
4834 4843 allow passing config options at creation time which may override
4835 4844 anything set in the config files or command line. This is
4836 4845 particularly useful for configuring embedded instances.
4837 4846
4838 4847 2002-04-15 Fernando Perez <fperez@colorado.edu>
4839 4848
4840 4849 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4841 4850 crash embedded instances because of the input cache falling out of
4842 4851 sync with the output counter.
4843 4852
4844 4853 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4845 4854 mode which calls pdb after an uncaught exception in IPython itself.
4846 4855
4847 4856 2002-04-14 Fernando Perez <fperez@colorado.edu>
4848 4857
4849 4858 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4850 4859 readline, fix it back after each call.
4851 4860
4852 4861 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4853 4862 method to force all access via __call__(), which guarantees that
4854 4863 traceback references are properly deleted.
4855 4864
4856 4865 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4857 4866 improve printing when pprint is in use.
4858 4867
4859 4868 2002-04-13 Fernando Perez <fperez@colorado.edu>
4860 4869
4861 4870 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4862 4871 exceptions aren't caught anymore. If the user triggers one, he
4863 4872 should know why he's doing it and it should go all the way up,
4864 4873 just like any other exception. So now @abort will fully kill the
4865 4874 embedded interpreter and the embedding code (unless that happens
4866 4875 to catch SystemExit).
4867 4876
4868 4877 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4869 4878 and a debugger() method to invoke the interactive pdb debugger
4870 4879 after printing exception information. Also added the corresponding
4871 4880 -pdb option and @pdb magic to control this feature, and updated
4872 4881 the docs. After a suggestion from Christopher Hart
4873 4882 (hart-AT-caltech.edu).
4874 4883
4875 4884 2002-04-12 Fernando Perez <fperez@colorado.edu>
4876 4885
4877 4886 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4878 4887 the exception handlers defined by the user (not the CrashHandler)
4879 4888 so that user exceptions don't trigger an ipython bug report.
4880 4889
4881 4890 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4882 4891 configurable (it should have always been so).
4883 4892
4884 4893 2002-03-26 Fernando Perez <fperez@colorado.edu>
4885 4894
4886 4895 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4887 4896 and there to fix embedding namespace issues. This should all be
4888 4897 done in a more elegant way.
4889 4898
4890 4899 2002-03-25 Fernando Perez <fperez@colorado.edu>
4891 4900
4892 4901 * IPython/genutils.py (get_home_dir): Try to make it work under
4893 4902 win9x also.
4894 4903
4895 4904 2002-03-20 Fernando Perez <fperez@colorado.edu>
4896 4905
4897 4906 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4898 4907 sys.displayhook untouched upon __init__.
4899 4908
4900 4909 2002-03-19 Fernando Perez <fperez@colorado.edu>
4901 4910
4902 4911 * Released 0.2.9 (for embedding bug, basically).
4903 4912
4904 4913 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4905 4914 exceptions so that enclosing shell's state can be restored.
4906 4915
4907 4916 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4908 4917 naming conventions in the .ipython/ dir.
4909 4918
4910 4919 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4911 4920 from delimiters list so filenames with - in them get expanded.
4912 4921
4913 4922 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4914 4923 sys.displayhook not being properly restored after an embedded call.
4915 4924
4916 4925 2002-03-18 Fernando Perez <fperez@colorado.edu>
4917 4926
4918 4927 * Released 0.2.8
4919 4928
4920 4929 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4921 4930 some files weren't being included in a -upgrade.
4922 4931 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4923 4932 on' so that the first tab completes.
4924 4933 (InteractiveShell.handle_magic): fixed bug with spaces around
4925 4934 quotes breaking many magic commands.
4926 4935
4927 4936 * setup.py: added note about ignoring the syntax error messages at
4928 4937 installation.
4929 4938
4930 4939 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4931 4940 streamlining the gnuplot interface, now there's only one magic @gp.
4932 4941
4933 4942 2002-03-17 Fernando Perez <fperez@colorado.edu>
4934 4943
4935 4944 * IPython/UserConfig/magic_gnuplot.py: new name for the
4936 4945 example-magic_pm.py file. Much enhanced system, now with a shell
4937 4946 for communicating directly with gnuplot, one command at a time.
4938 4947
4939 4948 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4940 4949 setting __name__=='__main__'.
4941 4950
4942 4951 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4943 4952 mini-shell for accessing gnuplot from inside ipython. Should
4944 4953 extend it later for grace access too. Inspired by Arnd's
4945 4954 suggestion.
4946 4955
4947 4956 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4948 4957 calling magic functions with () in their arguments. Thanks to Arnd
4949 4958 Baecker for pointing this to me.
4950 4959
4951 4960 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4952 4961 infinitely for integer or complex arrays (only worked with floats).
4953 4962
4954 4963 2002-03-16 Fernando Perez <fperez@colorado.edu>
4955 4964
4956 4965 * setup.py: Merged setup and setup_windows into a single script
4957 4966 which properly handles things for windows users.
4958 4967
4959 4968 2002-03-15 Fernando Perez <fperez@colorado.edu>
4960 4969
4961 4970 * Big change to the manual: now the magics are all automatically
4962 4971 documented. This information is generated from their docstrings
4963 4972 and put in a latex file included by the manual lyx file. This way
4964 4973 we get always up to date information for the magics. The manual
4965 4974 now also has proper version information, also auto-synced.
4966 4975
4967 4976 For this to work, an undocumented --magic_docstrings option was added.
4968 4977
4969 4978 2002-03-13 Fernando Perez <fperez@colorado.edu>
4970 4979
4971 4980 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4972 4981 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4973 4982
4974 4983 2002-03-12 Fernando Perez <fperez@colorado.edu>
4975 4984
4976 4985 * IPython/ultraTB.py (TermColors): changed color escapes again to
4977 4986 fix the (old, reintroduced) line-wrapping bug. Basically, if
4978 4987 \001..\002 aren't given in the color escapes, lines get wrapped
4979 4988 weirdly. But giving those screws up old xterms and emacs terms. So
4980 4989 I added some logic for emacs terms to be ok, but I can't identify old
4981 4990 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4982 4991
4983 4992 2002-03-10 Fernando Perez <fperez@colorado.edu>
4984 4993
4985 4994 * IPython/usage.py (__doc__): Various documentation cleanups and
4986 4995 updates, both in usage docstrings and in the manual.
4987 4996
4988 4997 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4989 4998 handling of caching. Set minimum acceptabe value for having a
4990 4999 cache at 20 values.
4991 5000
4992 5001 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4993 5002 install_first_time function to a method, renamed it and added an
4994 5003 'upgrade' mode. Now people can update their config directory with
4995 5004 a simple command line switch (-upgrade, also new).
4996 5005
4997 5006 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4998 5007 @file (convenient for automagic users under Python >= 2.2).
4999 5008 Removed @files (it seemed more like a plural than an abbrev. of
5000 5009 'file show').
5001 5010
5002 5011 * IPython/iplib.py (install_first_time): Fixed crash if there were
5003 5012 backup files ('~') in .ipython/ install directory.
5004 5013
5005 5014 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5006 5015 system. Things look fine, but these changes are fairly
5007 5016 intrusive. Test them for a few days.
5008 5017
5009 5018 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5010 5019 the prompts system. Now all in/out prompt strings are user
5011 5020 controllable. This is particularly useful for embedding, as one
5012 5021 can tag embedded instances with particular prompts.
5013 5022
5014 5023 Also removed global use of sys.ps1/2, which now allows nested
5015 5024 embeddings without any problems. Added command-line options for
5016 5025 the prompt strings.
5017 5026
5018 5027 2002-03-08 Fernando Perez <fperez@colorado.edu>
5019 5028
5020 5029 * IPython/UserConfig/example-embed-short.py (ipshell): added
5021 5030 example file with the bare minimum code for embedding.
5022 5031
5023 5032 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5024 5033 functionality for the embeddable shell to be activated/deactivated
5025 5034 either globally or at each call.
5026 5035
5027 5036 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5028 5037 rewriting the prompt with '--->' for auto-inputs with proper
5029 5038 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5030 5039 this is handled by the prompts class itself, as it should.
5031 5040
5032 5041 2002-03-05 Fernando Perez <fperez@colorado.edu>
5033 5042
5034 5043 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5035 5044 @logstart to avoid name clashes with the math log function.
5036 5045
5037 5046 * Big updates to X/Emacs section of the manual.
5038 5047
5039 5048 * Removed ipython_emacs. Milan explained to me how to pass
5040 5049 arguments to ipython through Emacs. Some day I'm going to end up
5041 5050 learning some lisp...
5042 5051
5043 5052 2002-03-04 Fernando Perez <fperez@colorado.edu>
5044 5053
5045 5054 * IPython/ipython_emacs: Created script to be used as the
5046 5055 py-python-command Emacs variable so we can pass IPython
5047 5056 parameters. I can't figure out how to tell Emacs directly to pass
5048 5057 parameters to IPython, so a dummy shell script will do it.
5049 5058
5050 5059 Other enhancements made for things to work better under Emacs'
5051 5060 various types of terminals. Many thanks to Milan Zamazal
5052 5061 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5053 5062
5054 5063 2002-03-01 Fernando Perez <fperez@colorado.edu>
5055 5064
5056 5065 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5057 5066 that loading of readline is now optional. This gives better
5058 5067 control to emacs users.
5059 5068
5060 5069 * IPython/ultraTB.py (__date__): Modified color escape sequences
5061 5070 and now things work fine under xterm and in Emacs' term buffers
5062 5071 (though not shell ones). Well, in emacs you get colors, but all
5063 5072 seem to be 'light' colors (no difference between dark and light
5064 5073 ones). But the garbage chars are gone, and also in xterms. It
5065 5074 seems that now I'm using 'cleaner' ansi sequences.
5066 5075
5067 5076 2002-02-21 Fernando Perez <fperez@colorado.edu>
5068 5077
5069 5078 * Released 0.2.7 (mainly to publish the scoping fix).
5070 5079
5071 5080 * IPython/Logger.py (Logger.logstate): added. A corresponding
5072 5081 @logstate magic was created.
5073 5082
5074 5083 * IPython/Magic.py: fixed nested scoping problem under Python
5075 5084 2.1.x (automagic wasn't working).
5076 5085
5077 5086 2002-02-20 Fernando Perez <fperez@colorado.edu>
5078 5087
5079 5088 * Released 0.2.6.
5080 5089
5081 5090 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5082 5091 option so that logs can come out without any headers at all.
5083 5092
5084 5093 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5085 5094 SciPy.
5086 5095
5087 5096 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5088 5097 that embedded IPython calls don't require vars() to be explicitly
5089 5098 passed. Now they are extracted from the caller's frame (code
5090 5099 snatched from Eric Jones' weave). Added better documentation to
5091 5100 the section on embedding and the example file.
5092 5101
5093 5102 * IPython/genutils.py (page): Changed so that under emacs, it just
5094 5103 prints the string. You can then page up and down in the emacs
5095 5104 buffer itself. This is how the builtin help() works.
5096 5105
5097 5106 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5098 5107 macro scoping: macros need to be executed in the user's namespace
5099 5108 to work as if they had been typed by the user.
5100 5109
5101 5110 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5102 5111 execute automatically (no need to type 'exec...'). They then
5103 5112 behave like 'true macros'. The printing system was also modified
5104 5113 for this to work.
5105 5114
5106 5115 2002-02-19 Fernando Perez <fperez@colorado.edu>
5107 5116
5108 5117 * IPython/genutils.py (page_file): new function for paging files
5109 5118 in an OS-independent way. Also necessary for file viewing to work
5110 5119 well inside Emacs buffers.
5111 5120 (page): Added checks for being in an emacs buffer.
5112 5121 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5113 5122 same bug in iplib.
5114 5123
5115 5124 2002-02-18 Fernando Perez <fperez@colorado.edu>
5116 5125
5117 5126 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5118 5127 of readline so that IPython can work inside an Emacs buffer.
5119 5128
5120 5129 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5121 5130 method signatures (they weren't really bugs, but it looks cleaner
5122 5131 and keeps PyChecker happy).
5123 5132
5124 5133 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5125 5134 for implementing various user-defined hooks. Currently only
5126 5135 display is done.
5127 5136
5128 5137 * IPython/Prompts.py (CachedOutput._display): changed display
5129 5138 functions so that they can be dynamically changed by users easily.
5130 5139
5131 5140 * IPython/Extensions/numeric_formats.py (num_display): added an
5132 5141 extension for printing NumPy arrays in flexible manners. It
5133 5142 doesn't do anything yet, but all the structure is in
5134 5143 place. Ultimately the plan is to implement output format control
5135 5144 like in Octave.
5136 5145
5137 5146 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5138 5147 methods are found at run-time by all the automatic machinery.
5139 5148
5140 5149 2002-02-17 Fernando Perez <fperez@colorado.edu>
5141 5150
5142 5151 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5143 5152 whole file a little.
5144 5153
5145 5154 * ToDo: closed this document. Now there's a new_design.lyx
5146 5155 document for all new ideas. Added making a pdf of it for the
5147 5156 end-user distro.
5148 5157
5149 5158 * IPython/Logger.py (Logger.switch_log): Created this to replace
5150 5159 logon() and logoff(). It also fixes a nasty crash reported by
5151 5160 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5152 5161
5153 5162 * IPython/iplib.py (complete): got auto-completion to work with
5154 5163 automagic (I had wanted this for a long time).
5155 5164
5156 5165 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5157 5166 to @file, since file() is now a builtin and clashes with automagic
5158 5167 for @file.
5159 5168
5160 5169 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5161 5170 of this was previously in iplib, which had grown to more than 2000
5162 5171 lines, way too long. No new functionality, but it makes managing
5163 5172 the code a bit easier.
5164 5173
5165 5174 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5166 5175 information to crash reports.
5167 5176
5168 5177 2002-02-12 Fernando Perez <fperez@colorado.edu>
5169 5178
5170 5179 * Released 0.2.5.
5171 5180
5172 5181 2002-02-11 Fernando Perez <fperez@colorado.edu>
5173 5182
5174 5183 * Wrote a relatively complete Windows installer. It puts
5175 5184 everything in place, creates Start Menu entries and fixes the
5176 5185 color issues. Nothing fancy, but it works.
5177 5186
5178 5187 2002-02-10 Fernando Perez <fperez@colorado.edu>
5179 5188
5180 5189 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5181 5190 os.path.expanduser() call so that we can type @run ~/myfile.py and
5182 5191 have thigs work as expected.
5183 5192
5184 5193 * IPython/genutils.py (page): fixed exception handling so things
5185 5194 work both in Unix and Windows correctly. Quitting a pager triggers
5186 5195 an IOError/broken pipe in Unix, and in windows not finding a pager
5187 5196 is also an IOError, so I had to actually look at the return value
5188 5197 of the exception, not just the exception itself. Should be ok now.
5189 5198
5190 5199 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5191 5200 modified to allow case-insensitive color scheme changes.
5192 5201
5193 5202 2002-02-09 Fernando Perez <fperez@colorado.edu>
5194 5203
5195 5204 * IPython/genutils.py (native_line_ends): new function to leave
5196 5205 user config files with os-native line-endings.
5197 5206
5198 5207 * README and manual updates.
5199 5208
5200 5209 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5201 5210 instead of StringType to catch Unicode strings.
5202 5211
5203 5212 * IPython/genutils.py (filefind): fixed bug for paths with
5204 5213 embedded spaces (very common in Windows).
5205 5214
5206 5215 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5207 5216 files under Windows, so that they get automatically associated
5208 5217 with a text editor. Windows makes it a pain to handle
5209 5218 extension-less files.
5210 5219
5211 5220 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5212 5221 warning about readline only occur for Posix. In Windows there's no
5213 5222 way to get readline, so why bother with the warning.
5214 5223
5215 5224 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5216 5225 for __str__ instead of dir(self), since dir() changed in 2.2.
5217 5226
5218 5227 * Ported to Windows! Tested on XP, I suspect it should work fine
5219 5228 on NT/2000, but I don't think it will work on 98 et al. That
5220 5229 series of Windows is such a piece of junk anyway that I won't try
5221 5230 porting it there. The XP port was straightforward, showed a few
5222 5231 bugs here and there (fixed all), in particular some string
5223 5232 handling stuff which required considering Unicode strings (which
5224 5233 Windows uses). This is good, but hasn't been too tested :) No
5225 5234 fancy installer yet, I'll put a note in the manual so people at
5226 5235 least make manually a shortcut.
5227 5236
5228 5237 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5229 5238 into a single one, "colors". This now controls both prompt and
5230 5239 exception color schemes, and can be changed both at startup
5231 5240 (either via command-line switches or via ipythonrc files) and at
5232 5241 runtime, with @colors.
5233 5242 (Magic.magic_run): renamed @prun to @run and removed the old
5234 5243 @run. The two were too similar to warrant keeping both.
5235 5244
5236 5245 2002-02-03 Fernando Perez <fperez@colorado.edu>
5237 5246
5238 5247 * IPython/iplib.py (install_first_time): Added comment on how to
5239 5248 configure the color options for first-time users. Put a <return>
5240 5249 request at the end so that small-terminal users get a chance to
5241 5250 read the startup info.
5242 5251
5243 5252 2002-01-23 Fernando Perez <fperez@colorado.edu>
5244 5253
5245 5254 * IPython/iplib.py (CachedOutput.update): Changed output memory
5246 5255 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5247 5256 input history we still use _i. Did this b/c these variable are
5248 5257 very commonly used in interactive work, so the less we need to
5249 5258 type the better off we are.
5250 5259 (Magic.magic_prun): updated @prun to better handle the namespaces
5251 5260 the file will run in, including a fix for __name__ not being set
5252 5261 before.
5253 5262
5254 5263 2002-01-20 Fernando Perez <fperez@colorado.edu>
5255 5264
5256 5265 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5257 5266 extra garbage for Python 2.2. Need to look more carefully into
5258 5267 this later.
5259 5268
5260 5269 2002-01-19 Fernando Perez <fperez@colorado.edu>
5261 5270
5262 5271 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5263 5272 display SyntaxError exceptions properly formatted when they occur
5264 5273 (they can be triggered by imported code).
5265 5274
5266 5275 2002-01-18 Fernando Perez <fperez@colorado.edu>
5267 5276
5268 5277 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5269 5278 SyntaxError exceptions are reported nicely formatted, instead of
5270 5279 spitting out only offset information as before.
5271 5280 (Magic.magic_prun): Added the @prun function for executing
5272 5281 programs with command line args inside IPython.
5273 5282
5274 5283 2002-01-16 Fernando Perez <fperez@colorado.edu>
5275 5284
5276 5285 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5277 5286 to *not* include the last item given in a range. This brings their
5278 5287 behavior in line with Python's slicing:
5279 5288 a[n1:n2] -> a[n1]...a[n2-1]
5280 5289 It may be a bit less convenient, but I prefer to stick to Python's
5281 5290 conventions *everywhere*, so users never have to wonder.
5282 5291 (Magic.magic_macro): Added @macro function to ease the creation of
5283 5292 macros.
5284 5293
5285 5294 2002-01-05 Fernando Perez <fperez@colorado.edu>
5286 5295
5287 5296 * Released 0.2.4.
5288 5297
5289 5298 * IPython/iplib.py (Magic.magic_pdef):
5290 5299 (InteractiveShell.safe_execfile): report magic lines and error
5291 5300 lines without line numbers so one can easily copy/paste them for
5292 5301 re-execution.
5293 5302
5294 5303 * Updated manual with recent changes.
5295 5304
5296 5305 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5297 5306 docstring printing when class? is called. Very handy for knowing
5298 5307 how to create class instances (as long as __init__ is well
5299 5308 documented, of course :)
5300 5309 (Magic.magic_doc): print both class and constructor docstrings.
5301 5310 (Magic.magic_pdef): give constructor info if passed a class and
5302 5311 __call__ info for callable object instances.
5303 5312
5304 5313 2002-01-04 Fernando Perez <fperez@colorado.edu>
5305 5314
5306 5315 * Made deep_reload() off by default. It doesn't always work
5307 5316 exactly as intended, so it's probably safer to have it off. It's
5308 5317 still available as dreload() anyway, so nothing is lost.
5309 5318
5310 5319 2002-01-02 Fernando Perez <fperez@colorado.edu>
5311 5320
5312 5321 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5313 5322 so I wanted an updated release).
5314 5323
5315 5324 2001-12-27 Fernando Perez <fperez@colorado.edu>
5316 5325
5317 5326 * IPython/iplib.py (InteractiveShell.interact): Added the original
5318 5327 code from 'code.py' for this module in order to change the
5319 5328 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5320 5329 the history cache would break when the user hit Ctrl-C, and
5321 5330 interact() offers no way to add any hooks to it.
5322 5331
5323 5332 2001-12-23 Fernando Perez <fperez@colorado.edu>
5324 5333
5325 5334 * setup.py: added check for 'MANIFEST' before trying to remove
5326 5335 it. Thanks to Sean Reifschneider.
5327 5336
5328 5337 2001-12-22 Fernando Perez <fperez@colorado.edu>
5329 5338
5330 5339 * Released 0.2.2.
5331 5340
5332 5341 * Finished (reasonably) writing the manual. Later will add the
5333 5342 python-standard navigation stylesheets, but for the time being
5334 5343 it's fairly complete. Distribution will include html and pdf
5335 5344 versions.
5336 5345
5337 5346 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5338 5347 (MayaVi author).
5339 5348
5340 5349 2001-12-21 Fernando Perez <fperez@colorado.edu>
5341 5350
5342 5351 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5343 5352 good public release, I think (with the manual and the distutils
5344 5353 installer). The manual can use some work, but that can go
5345 5354 slowly. Otherwise I think it's quite nice for end users. Next
5346 5355 summer, rewrite the guts of it...
5347 5356
5348 5357 * Changed format of ipythonrc files to use whitespace as the
5349 5358 separator instead of an explicit '='. Cleaner.
5350 5359
5351 5360 2001-12-20 Fernando Perez <fperez@colorado.edu>
5352 5361
5353 5362 * Started a manual in LyX. For now it's just a quick merge of the
5354 5363 various internal docstrings and READMEs. Later it may grow into a
5355 5364 nice, full-blown manual.
5356 5365
5357 5366 * Set up a distutils based installer. Installation should now be
5358 5367 trivially simple for end-users.
5359 5368
5360 5369 2001-12-11 Fernando Perez <fperez@colorado.edu>
5361 5370
5362 5371 * Released 0.2.0. First public release, announced it at
5363 5372 comp.lang.python. From now on, just bugfixes...
5364 5373
5365 5374 * Went through all the files, set copyright/license notices and
5366 5375 cleaned up things. Ready for release.
5367 5376
5368 5377 2001-12-10 Fernando Perez <fperez@colorado.edu>
5369 5378
5370 5379 * Changed the first-time installer not to use tarfiles. It's more
5371 5380 robust now and less unix-dependent. Also makes it easier for
5372 5381 people to later upgrade versions.
5373 5382
5374 5383 * Changed @exit to @abort to reflect the fact that it's pretty
5375 5384 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5376 5385 becomes significant only when IPyhton is embedded: in that case,
5377 5386 C-D closes IPython only, but @abort kills the enclosing program
5378 5387 too (unless it had called IPython inside a try catching
5379 5388 SystemExit).
5380 5389
5381 5390 * Created Shell module which exposes the actuall IPython Shell
5382 5391 classes, currently the normal and the embeddable one. This at
5383 5392 least offers a stable interface we won't need to change when
5384 5393 (later) the internals are rewritten. That rewrite will be confined
5385 5394 to iplib and ipmaker, but the Shell interface should remain as is.
5386 5395
5387 5396 * Added embed module which offers an embeddable IPShell object,
5388 5397 useful to fire up IPython *inside* a running program. Great for
5389 5398 debugging or dynamical data analysis.
5390 5399
5391 5400 2001-12-08 Fernando Perez <fperez@colorado.edu>
5392 5401
5393 5402 * Fixed small bug preventing seeing info from methods of defined
5394 5403 objects (incorrect namespace in _ofind()).
5395 5404
5396 5405 * Documentation cleanup. Moved the main usage docstrings to a
5397 5406 separate file, usage.py (cleaner to maintain, and hopefully in the
5398 5407 future some perlpod-like way of producing interactive, man and
5399 5408 html docs out of it will be found).
5400 5409
5401 5410 * Added @profile to see your profile at any time.
5402 5411
5403 5412 * Added @p as an alias for 'print'. It's especially convenient if
5404 5413 using automagic ('p x' prints x).
5405 5414
5406 5415 * Small cleanups and fixes after a pychecker run.
5407 5416
5408 5417 * Changed the @cd command to handle @cd - and @cd -<n> for
5409 5418 visiting any directory in _dh.
5410 5419
5411 5420 * Introduced _dh, a history of visited directories. @dhist prints
5412 5421 it out with numbers.
5413 5422
5414 5423 2001-12-07 Fernando Perez <fperez@colorado.edu>
5415 5424
5416 5425 * Released 0.1.22
5417 5426
5418 5427 * Made initialization a bit more robust against invalid color
5419 5428 options in user input (exit, not traceback-crash).
5420 5429
5421 5430 * Changed the bug crash reporter to write the report only in the
5422 5431 user's .ipython directory. That way IPython won't litter people's
5423 5432 hard disks with crash files all over the place. Also print on
5424 5433 screen the necessary mail command.
5425 5434
5426 5435 * With the new ultraTB, implemented LightBG color scheme for light
5427 5436 background terminals. A lot of people like white backgrounds, so I
5428 5437 guess we should at least give them something readable.
5429 5438
5430 5439 2001-12-06 Fernando Perez <fperez@colorado.edu>
5431 5440
5432 5441 * Modified the structure of ultraTB. Now there's a proper class
5433 5442 for tables of color schemes which allow adding schemes easily and
5434 5443 switching the active scheme without creating a new instance every
5435 5444 time (which was ridiculous). The syntax for creating new schemes
5436 5445 is also cleaner. I think ultraTB is finally done, with a clean
5437 5446 class structure. Names are also much cleaner (now there's proper
5438 5447 color tables, no need for every variable to also have 'color' in
5439 5448 its name).
5440 5449
5441 5450 * Broke down genutils into separate files. Now genutils only
5442 5451 contains utility functions, and classes have been moved to their
5443 5452 own files (they had enough independent functionality to warrant
5444 5453 it): ConfigLoader, OutputTrap, Struct.
5445 5454
5446 5455 2001-12-05 Fernando Perez <fperez@colorado.edu>
5447 5456
5448 5457 * IPython turns 21! Released version 0.1.21, as a candidate for
5449 5458 public consumption. If all goes well, release in a few days.
5450 5459
5451 5460 * Fixed path bug (files in Extensions/ directory wouldn't be found
5452 5461 unless IPython/ was explicitly in sys.path).
5453 5462
5454 5463 * Extended the FlexCompleter class as MagicCompleter to allow
5455 5464 completion of @-starting lines.
5456 5465
5457 5466 * Created __release__.py file as a central repository for release
5458 5467 info that other files can read from.
5459 5468
5460 5469 * Fixed small bug in logging: when logging was turned on in
5461 5470 mid-session, old lines with special meanings (!@?) were being
5462 5471 logged without the prepended comment, which is necessary since
5463 5472 they are not truly valid python syntax. This should make session
5464 5473 restores produce less errors.
5465 5474
5466 5475 * The namespace cleanup forced me to make a FlexCompleter class
5467 5476 which is nothing but a ripoff of rlcompleter, but with selectable
5468 5477 namespace (rlcompleter only works in __main__.__dict__). I'll try
5469 5478 to submit a note to the authors to see if this change can be
5470 5479 incorporated in future rlcompleter releases (Dec.6: done)
5471 5480
5472 5481 * More fixes to namespace handling. It was a mess! Now all
5473 5482 explicit references to __main__.__dict__ are gone (except when
5474 5483 really needed) and everything is handled through the namespace
5475 5484 dicts in the IPython instance. We seem to be getting somewhere
5476 5485 with this, finally...
5477 5486
5478 5487 * Small documentation updates.
5479 5488
5480 5489 * Created the Extensions directory under IPython (with an
5481 5490 __init__.py). Put the PhysicalQ stuff there. This directory should
5482 5491 be used for all special-purpose extensions.
5483 5492
5484 5493 * File renaming:
5485 5494 ipythonlib --> ipmaker
5486 5495 ipplib --> iplib
5487 5496 This makes a bit more sense in terms of what these files actually do.
5488 5497
5489 5498 * Moved all the classes and functions in ipythonlib to ipplib, so
5490 5499 now ipythonlib only has make_IPython(). This will ease up its
5491 5500 splitting in smaller functional chunks later.
5492 5501
5493 5502 * Cleaned up (done, I think) output of @whos. Better column
5494 5503 formatting, and now shows str(var) for as much as it can, which is
5495 5504 typically what one gets with a 'print var'.
5496 5505
5497 5506 2001-12-04 Fernando Perez <fperez@colorado.edu>
5498 5507
5499 5508 * Fixed namespace problems. Now builtin/IPyhton/user names get
5500 5509 properly reported in their namespace. Internal namespace handling
5501 5510 is finally getting decent (not perfect yet, but much better than
5502 5511 the ad-hoc mess we had).
5503 5512
5504 5513 * Removed -exit option. If people just want to run a python
5505 5514 script, that's what the normal interpreter is for. Less
5506 5515 unnecessary options, less chances for bugs.
5507 5516
5508 5517 * Added a crash handler which generates a complete post-mortem if
5509 5518 IPython crashes. This will help a lot in tracking bugs down the
5510 5519 road.
5511 5520
5512 5521 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5513 5522 which were boud to functions being reassigned would bypass the
5514 5523 logger, breaking the sync of _il with the prompt counter. This
5515 5524 would then crash IPython later when a new line was logged.
5516 5525
5517 5526 2001-12-02 Fernando Perez <fperez@colorado.edu>
5518 5527
5519 5528 * Made IPython a package. This means people don't have to clutter
5520 5529 their sys.path with yet another directory. Changed the INSTALL
5521 5530 file accordingly.
5522 5531
5523 5532 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5524 5533 sorts its output (so @who shows it sorted) and @whos formats the
5525 5534 table according to the width of the first column. Nicer, easier to
5526 5535 read. Todo: write a generic table_format() which takes a list of
5527 5536 lists and prints it nicely formatted, with optional row/column
5528 5537 separators and proper padding and justification.
5529 5538
5530 5539 * Released 0.1.20
5531 5540
5532 5541 * Fixed bug in @log which would reverse the inputcache list (a
5533 5542 copy operation was missing).
5534 5543
5535 5544 * Code cleanup. @config was changed to use page(). Better, since
5536 5545 its output is always quite long.
5537 5546
5538 5547 * Itpl is back as a dependency. I was having too many problems
5539 5548 getting the parametric aliases to work reliably, and it's just
5540 5549 easier to code weird string operations with it than playing %()s
5541 5550 games. It's only ~6k, so I don't think it's too big a deal.
5542 5551
5543 5552 * Found (and fixed) a very nasty bug with history. !lines weren't
5544 5553 getting cached, and the out of sync caches would crash
5545 5554 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5546 5555 division of labor a bit better. Bug fixed, cleaner structure.
5547 5556
5548 5557 2001-12-01 Fernando Perez <fperez@colorado.edu>
5549 5558
5550 5559 * Released 0.1.19
5551 5560
5552 5561 * Added option -n to @hist to prevent line number printing. Much
5553 5562 easier to copy/paste code this way.
5554 5563
5555 5564 * Created global _il to hold the input list. Allows easy
5556 5565 re-execution of blocks of code by slicing it (inspired by Janko's
5557 5566 comment on 'macros').
5558 5567
5559 5568 * Small fixes and doc updates.
5560 5569
5561 5570 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5562 5571 much too fragile with automagic. Handles properly multi-line
5563 5572 statements and takes parameters.
5564 5573
5565 5574 2001-11-30 Fernando Perez <fperez@colorado.edu>
5566 5575
5567 5576 * Version 0.1.18 released.
5568 5577
5569 5578 * Fixed nasty namespace bug in initial module imports.
5570 5579
5571 5580 * Added copyright/license notes to all code files (except
5572 5581 DPyGetOpt). For the time being, LGPL. That could change.
5573 5582
5574 5583 * Rewrote a much nicer README, updated INSTALL, cleaned up
5575 5584 ipythonrc-* samples.
5576 5585
5577 5586 * Overall code/documentation cleanup. Basically ready for
5578 5587 release. Only remaining thing: licence decision (LGPL?).
5579 5588
5580 5589 * Converted load_config to a class, ConfigLoader. Now recursion
5581 5590 control is better organized. Doesn't include the same file twice.
5582 5591
5583 5592 2001-11-29 Fernando Perez <fperez@colorado.edu>
5584 5593
5585 5594 * Got input history working. Changed output history variables from
5586 5595 _p to _o so that _i is for input and _o for output. Just cleaner
5587 5596 convention.
5588 5597
5589 5598 * Implemented parametric aliases. This pretty much allows the
5590 5599 alias system to offer full-blown shell convenience, I think.
5591 5600
5592 5601 * Version 0.1.17 released, 0.1.18 opened.
5593 5602
5594 5603 * dot_ipython/ipythonrc (alias): added documentation.
5595 5604 (xcolor): Fixed small bug (xcolors -> xcolor)
5596 5605
5597 5606 * Changed the alias system. Now alias is a magic command to define
5598 5607 aliases just like the shell. Rationale: the builtin magics should
5599 5608 be there for things deeply connected to IPython's
5600 5609 architecture. And this is a much lighter system for what I think
5601 5610 is the really important feature: allowing users to define quickly
5602 5611 magics that will do shell things for them, so they can customize
5603 5612 IPython easily to match their work habits. If someone is really
5604 5613 desperate to have another name for a builtin alias, they can
5605 5614 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5606 5615 works.
5607 5616
5608 5617 2001-11-28 Fernando Perez <fperez@colorado.edu>
5609 5618
5610 5619 * Changed @file so that it opens the source file at the proper
5611 5620 line. Since it uses less, if your EDITOR environment is
5612 5621 configured, typing v will immediately open your editor of choice
5613 5622 right at the line where the object is defined. Not as quick as
5614 5623 having a direct @edit command, but for all intents and purposes it
5615 5624 works. And I don't have to worry about writing @edit to deal with
5616 5625 all the editors, less does that.
5617 5626
5618 5627 * Version 0.1.16 released, 0.1.17 opened.
5619 5628
5620 5629 * Fixed some nasty bugs in the page/page_dumb combo that could
5621 5630 crash IPython.
5622 5631
5623 5632 2001-11-27 Fernando Perez <fperez@colorado.edu>
5624 5633
5625 5634 * Version 0.1.15 released, 0.1.16 opened.
5626 5635
5627 5636 * Finally got ? and ?? to work for undefined things: now it's
5628 5637 possible to type {}.get? and get information about the get method
5629 5638 of dicts, or os.path? even if only os is defined (so technically
5630 5639 os.path isn't). Works at any level. For example, after import os,
5631 5640 os?, os.path?, os.path.abspath? all work. This is great, took some
5632 5641 work in _ofind.
5633 5642
5634 5643 * Fixed more bugs with logging. The sanest way to do it was to add
5635 5644 to @log a 'mode' parameter. Killed two in one shot (this mode
5636 5645 option was a request of Janko's). I think it's finally clean
5637 5646 (famous last words).
5638 5647
5639 5648 * Added a page_dumb() pager which does a decent job of paging on
5640 5649 screen, if better things (like less) aren't available. One less
5641 5650 unix dependency (someday maybe somebody will port this to
5642 5651 windows).
5643 5652
5644 5653 * Fixed problem in magic_log: would lock of logging out if log
5645 5654 creation failed (because it would still think it had succeeded).
5646 5655
5647 5656 * Improved the page() function using curses to auto-detect screen
5648 5657 size. Now it can make a much better decision on whether to print
5649 5658 or page a string. Option screen_length was modified: a value 0
5650 5659 means auto-detect, and that's the default now.
5651 5660
5652 5661 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5653 5662 go out. I'll test it for a few days, then talk to Janko about
5654 5663 licences and announce it.
5655 5664
5656 5665 * Fixed the length of the auto-generated ---> prompt which appears
5657 5666 for auto-parens and auto-quotes. Getting this right isn't trivial,
5658 5667 with all the color escapes, different prompt types and optional
5659 5668 separators. But it seems to be working in all the combinations.
5660 5669
5661 5670 2001-11-26 Fernando Perez <fperez@colorado.edu>
5662 5671
5663 5672 * Wrote a regexp filter to get option types from the option names
5664 5673 string. This eliminates the need to manually keep two duplicate
5665 5674 lists.
5666 5675
5667 5676 * Removed the unneeded check_option_names. Now options are handled
5668 5677 in a much saner manner and it's easy to visually check that things
5669 5678 are ok.
5670 5679
5671 5680 * Updated version numbers on all files I modified to carry a
5672 5681 notice so Janko and Nathan have clear version markers.
5673 5682
5674 5683 * Updated docstring for ultraTB with my changes. I should send
5675 5684 this to Nathan.
5676 5685
5677 5686 * Lots of small fixes. Ran everything through pychecker again.
5678 5687
5679 5688 * Made loading of deep_reload an cmd line option. If it's not too
5680 5689 kosher, now people can just disable it. With -nodeep_reload it's
5681 5690 still available as dreload(), it just won't overwrite reload().
5682 5691
5683 5692 * Moved many options to the no| form (-opt and -noopt
5684 5693 accepted). Cleaner.
5685 5694
5686 5695 * Changed magic_log so that if called with no parameters, it uses
5687 5696 'rotate' mode. That way auto-generated logs aren't automatically
5688 5697 over-written. For normal logs, now a backup is made if it exists
5689 5698 (only 1 level of backups). A new 'backup' mode was added to the
5690 5699 Logger class to support this. This was a request by Janko.
5691 5700
5692 5701 * Added @logoff/@logon to stop/restart an active log.
5693 5702
5694 5703 * Fixed a lot of bugs in log saving/replay. It was pretty
5695 5704 broken. Now special lines (!@,/) appear properly in the command
5696 5705 history after a log replay.
5697 5706
5698 5707 * Tried and failed to implement full session saving via pickle. My
5699 5708 idea was to pickle __main__.__dict__, but modules can't be
5700 5709 pickled. This would be a better alternative to replaying logs, but
5701 5710 seems quite tricky to get to work. Changed -session to be called
5702 5711 -logplay, which more accurately reflects what it does. And if we
5703 5712 ever get real session saving working, -session is now available.
5704 5713
5705 5714 * Implemented color schemes for prompts also. As for tracebacks,
5706 5715 currently only NoColor and Linux are supported. But now the
5707 5716 infrastructure is in place, based on a generic ColorScheme
5708 5717 class. So writing and activating new schemes both for the prompts
5709 5718 and the tracebacks should be straightforward.
5710 5719
5711 5720 * Version 0.1.13 released, 0.1.14 opened.
5712 5721
5713 5722 * Changed handling of options for output cache. Now counter is
5714 5723 hardwired starting at 1 and one specifies the maximum number of
5715 5724 entries *in the outcache* (not the max prompt counter). This is
5716 5725 much better, since many statements won't increase the cache
5717 5726 count. It also eliminated some confusing options, now there's only
5718 5727 one: cache_size.
5719 5728
5720 5729 * Added 'alias' magic function and magic_alias option in the
5721 5730 ipythonrc file. Now the user can easily define whatever names he
5722 5731 wants for the magic functions without having to play weird
5723 5732 namespace games. This gives IPython a real shell-like feel.
5724 5733
5725 5734 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5726 5735 @ or not).
5727 5736
5728 5737 This was one of the last remaining 'visible' bugs (that I know
5729 5738 of). I think if I can clean up the session loading so it works
5730 5739 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5731 5740 about licensing).
5732 5741
5733 5742 2001-11-25 Fernando Perez <fperez@colorado.edu>
5734 5743
5735 5744 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5736 5745 there's a cleaner distinction between what ? and ?? show.
5737 5746
5738 5747 * Added screen_length option. Now the user can define his own
5739 5748 screen size for page() operations.
5740 5749
5741 5750 * Implemented magic shell-like functions with automatic code
5742 5751 generation. Now adding another function is just a matter of adding
5743 5752 an entry to a dict, and the function is dynamically generated at
5744 5753 run-time. Python has some really cool features!
5745 5754
5746 5755 * Renamed many options to cleanup conventions a little. Now all
5747 5756 are lowercase, and only underscores where needed. Also in the code
5748 5757 option name tables are clearer.
5749 5758
5750 5759 * Changed prompts a little. Now input is 'In [n]:' instead of
5751 5760 'In[n]:='. This allows it the numbers to be aligned with the
5752 5761 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5753 5762 Python (it was a Mathematica thing). The '...' continuation prompt
5754 5763 was also changed a little to align better.
5755 5764
5756 5765 * Fixed bug when flushing output cache. Not all _p<n> variables
5757 5766 exist, so their deletion needs to be wrapped in a try:
5758 5767
5759 5768 * Figured out how to properly use inspect.formatargspec() (it
5760 5769 requires the args preceded by *). So I removed all the code from
5761 5770 _get_pdef in Magic, which was just replicating that.
5762 5771
5763 5772 * Added test to prefilter to allow redefining magic function names
5764 5773 as variables. This is ok, since the @ form is always available,
5765 5774 but whe should allow the user to define a variable called 'ls' if
5766 5775 he needs it.
5767 5776
5768 5777 * Moved the ToDo information from README into a separate ToDo.
5769 5778
5770 5779 * General code cleanup and small bugfixes. I think it's close to a
5771 5780 state where it can be released, obviously with a big 'beta'
5772 5781 warning on it.
5773 5782
5774 5783 * Got the magic function split to work. Now all magics are defined
5775 5784 in a separate class. It just organizes things a bit, and now
5776 5785 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5777 5786 was too long).
5778 5787
5779 5788 * Changed @clear to @reset to avoid potential confusions with
5780 5789 the shell command clear. Also renamed @cl to @clear, which does
5781 5790 exactly what people expect it to from their shell experience.
5782 5791
5783 5792 Added a check to the @reset command (since it's so
5784 5793 destructive, it's probably a good idea to ask for confirmation).
5785 5794 But now reset only works for full namespace resetting. Since the
5786 5795 del keyword is already there for deleting a few specific
5787 5796 variables, I don't see the point of having a redundant magic
5788 5797 function for the same task.
5789 5798
5790 5799 2001-11-24 Fernando Perez <fperez@colorado.edu>
5791 5800
5792 5801 * Updated the builtin docs (esp. the ? ones).
5793 5802
5794 5803 * Ran all the code through pychecker. Not terribly impressed with
5795 5804 it: lots of spurious warnings and didn't really find anything of
5796 5805 substance (just a few modules being imported and not used).
5797 5806
5798 5807 * Implemented the new ultraTB functionality into IPython. New
5799 5808 option: xcolors. This chooses color scheme. xmode now only selects
5800 5809 between Plain and Verbose. Better orthogonality.
5801 5810
5802 5811 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5803 5812 mode and color scheme for the exception handlers. Now it's
5804 5813 possible to have the verbose traceback with no coloring.
5805 5814
5806 5815 2001-11-23 Fernando Perez <fperez@colorado.edu>
5807 5816
5808 5817 * Version 0.1.12 released, 0.1.13 opened.
5809 5818
5810 5819 * Removed option to set auto-quote and auto-paren escapes by
5811 5820 user. The chances of breaking valid syntax are just too high. If
5812 5821 someone *really* wants, they can always dig into the code.
5813 5822
5814 5823 * Made prompt separators configurable.
5815 5824
5816 5825 2001-11-22 Fernando Perez <fperez@colorado.edu>
5817 5826
5818 5827 * Small bugfixes in many places.
5819 5828
5820 5829 * Removed the MyCompleter class from ipplib. It seemed redundant
5821 5830 with the C-p,C-n history search functionality. Less code to
5822 5831 maintain.
5823 5832
5824 5833 * Moved all the original ipython.py code into ipythonlib.py. Right
5825 5834 now it's just one big dump into a function called make_IPython, so
5826 5835 no real modularity has been gained. But at least it makes the
5827 5836 wrapper script tiny, and since ipythonlib is a module, it gets
5828 5837 compiled and startup is much faster.
5829 5838
5830 5839 This is a reasobably 'deep' change, so we should test it for a
5831 5840 while without messing too much more with the code.
5832 5841
5833 5842 2001-11-21 Fernando Perez <fperez@colorado.edu>
5834 5843
5835 5844 * Version 0.1.11 released, 0.1.12 opened for further work.
5836 5845
5837 5846 * Removed dependency on Itpl. It was only needed in one place. It
5838 5847 would be nice if this became part of python, though. It makes life
5839 5848 *a lot* easier in some cases.
5840 5849
5841 5850 * Simplified the prefilter code a bit. Now all handlers are
5842 5851 expected to explicitly return a value (at least a blank string).
5843 5852
5844 5853 * Heavy edits in ipplib. Removed the help system altogether. Now
5845 5854 obj?/?? is used for inspecting objects, a magic @doc prints
5846 5855 docstrings, and full-blown Python help is accessed via the 'help'
5847 5856 keyword. This cleans up a lot of code (less to maintain) and does
5848 5857 the job. Since 'help' is now a standard Python component, might as
5849 5858 well use it and remove duplicate functionality.
5850 5859
5851 5860 Also removed the option to use ipplib as a standalone program. By
5852 5861 now it's too dependent on other parts of IPython to function alone.
5853 5862
5854 5863 * Fixed bug in genutils.pager. It would crash if the pager was
5855 5864 exited immediately after opening (broken pipe).
5856 5865
5857 5866 * Trimmed down the VerboseTB reporting a little. The header is
5858 5867 much shorter now and the repeated exception arguments at the end
5859 5868 have been removed. For interactive use the old header seemed a bit
5860 5869 excessive.
5861 5870
5862 5871 * Fixed small bug in output of @whos for variables with multi-word
5863 5872 types (only first word was displayed).
5864 5873
5865 5874 2001-11-17 Fernando Perez <fperez@colorado.edu>
5866 5875
5867 5876 * Version 0.1.10 released, 0.1.11 opened for further work.
5868 5877
5869 5878 * Modified dirs and friends. dirs now *returns* the stack (not
5870 5879 prints), so one can manipulate it as a variable. Convenient to
5871 5880 travel along many directories.
5872 5881
5873 5882 * Fixed bug in magic_pdef: would only work with functions with
5874 5883 arguments with default values.
5875 5884
5876 5885 2001-11-14 Fernando Perez <fperez@colorado.edu>
5877 5886
5878 5887 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5879 5888 example with IPython. Various other minor fixes and cleanups.
5880 5889
5881 5890 * Version 0.1.9 released, 0.1.10 opened for further work.
5882 5891
5883 5892 * Added sys.path to the list of directories searched in the
5884 5893 execfile= option. It used to be the current directory and the
5885 5894 user's IPYTHONDIR only.
5886 5895
5887 5896 2001-11-13 Fernando Perez <fperez@colorado.edu>
5888 5897
5889 5898 * Reinstated the raw_input/prefilter separation that Janko had
5890 5899 initially. This gives a more convenient setup for extending the
5891 5900 pre-processor from the outside: raw_input always gets a string,
5892 5901 and prefilter has to process it. We can then redefine prefilter
5893 5902 from the outside and implement extensions for special
5894 5903 purposes.
5895 5904
5896 5905 Today I got one for inputting PhysicalQuantity objects
5897 5906 (from Scientific) without needing any function calls at
5898 5907 all. Extremely convenient, and it's all done as a user-level
5899 5908 extension (no IPython code was touched). Now instead of:
5900 5909 a = PhysicalQuantity(4.2,'m/s**2')
5901 5910 one can simply say
5902 5911 a = 4.2 m/s**2
5903 5912 or even
5904 5913 a = 4.2 m/s^2
5905 5914
5906 5915 I use this, but it's also a proof of concept: IPython really is
5907 5916 fully user-extensible, even at the level of the parsing of the
5908 5917 command line. It's not trivial, but it's perfectly doable.
5909 5918
5910 5919 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5911 5920 the problem of modules being loaded in the inverse order in which
5912 5921 they were defined in
5913 5922
5914 5923 * Version 0.1.8 released, 0.1.9 opened for further work.
5915 5924
5916 5925 * Added magics pdef, source and file. They respectively show the
5917 5926 definition line ('prototype' in C), source code and full python
5918 5927 file for any callable object. The object inspector oinfo uses
5919 5928 these to show the same information.
5920 5929
5921 5930 * Version 0.1.7 released, 0.1.8 opened for further work.
5922 5931
5923 5932 * Separated all the magic functions into a class called Magic. The
5924 5933 InteractiveShell class was becoming too big for Xemacs to handle
5925 5934 (de-indenting a line would lock it up for 10 seconds while it
5926 5935 backtracked on the whole class!)
5927 5936
5928 5937 FIXME: didn't work. It can be done, but right now namespaces are
5929 5938 all messed up. Do it later (reverted it for now, so at least
5930 5939 everything works as before).
5931 5940
5932 5941 * Got the object introspection system (magic_oinfo) working! I
5933 5942 think this is pretty much ready for release to Janko, so he can
5934 5943 test it for a while and then announce it. Pretty much 100% of what
5935 5944 I wanted for the 'phase 1' release is ready. Happy, tired.
5936 5945
5937 5946 2001-11-12 Fernando Perez <fperez@colorado.edu>
5938 5947
5939 5948 * Version 0.1.6 released, 0.1.7 opened for further work.
5940 5949
5941 5950 * Fixed bug in printing: it used to test for truth before
5942 5951 printing, so 0 wouldn't print. Now checks for None.
5943 5952
5944 5953 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5945 5954 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5946 5955 reaches by hand into the outputcache. Think of a better way to do
5947 5956 this later.
5948 5957
5949 5958 * Various small fixes thanks to Nathan's comments.
5950 5959
5951 5960 * Changed magic_pprint to magic_Pprint. This way it doesn't
5952 5961 collide with pprint() and the name is consistent with the command
5953 5962 line option.
5954 5963
5955 5964 * Changed prompt counter behavior to be fully like
5956 5965 Mathematica's. That is, even input that doesn't return a result
5957 5966 raises the prompt counter. The old behavior was kind of confusing
5958 5967 (getting the same prompt number several times if the operation
5959 5968 didn't return a result).
5960 5969
5961 5970 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5962 5971
5963 5972 * Fixed -Classic mode (wasn't working anymore).
5964 5973
5965 5974 * Added colored prompts using Nathan's new code. Colors are
5966 5975 currently hardwired, they can be user-configurable. For
5967 5976 developers, they can be chosen in file ipythonlib.py, at the
5968 5977 beginning of the CachedOutput class def.
5969 5978
5970 5979 2001-11-11 Fernando Perez <fperez@colorado.edu>
5971 5980
5972 5981 * Version 0.1.5 released, 0.1.6 opened for further work.
5973 5982
5974 5983 * Changed magic_env to *return* the environment as a dict (not to
5975 5984 print it). This way it prints, but it can also be processed.
5976 5985
5977 5986 * Added Verbose exception reporting to interactive
5978 5987 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5979 5988 traceback. Had to make some changes to the ultraTB file. This is
5980 5989 probably the last 'big' thing in my mental todo list. This ties
5981 5990 in with the next entry:
5982 5991
5983 5992 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5984 5993 has to specify is Plain, Color or Verbose for all exception
5985 5994 handling.
5986 5995
5987 5996 * Removed ShellServices option. All this can really be done via
5988 5997 the magic system. It's easier to extend, cleaner and has automatic
5989 5998 namespace protection and documentation.
5990 5999
5991 6000 2001-11-09 Fernando Perez <fperez@colorado.edu>
5992 6001
5993 6002 * Fixed bug in output cache flushing (missing parameter to
5994 6003 __init__). Other small bugs fixed (found using pychecker).
5995 6004
5996 6005 * Version 0.1.4 opened for bugfixing.
5997 6006
5998 6007 2001-11-07 Fernando Perez <fperez@colorado.edu>
5999 6008
6000 6009 * Version 0.1.3 released, mainly because of the raw_input bug.
6001 6010
6002 6011 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6003 6012 and when testing for whether things were callable, a call could
6004 6013 actually be made to certain functions. They would get called again
6005 6014 once 'really' executed, with a resulting double call. A disaster
6006 6015 in many cases (list.reverse() would never work!).
6007 6016
6008 6017 * Removed prefilter() function, moved its code to raw_input (which
6009 6018 after all was just a near-empty caller for prefilter). This saves
6010 6019 a function call on every prompt, and simplifies the class a tiny bit.
6011 6020
6012 6021 * Fix _ip to __ip name in magic example file.
6013 6022
6014 6023 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6015 6024 work with non-gnu versions of tar.
6016 6025
6017 6026 2001-11-06 Fernando Perez <fperez@colorado.edu>
6018 6027
6019 6028 * Version 0.1.2. Just to keep track of the recent changes.
6020 6029
6021 6030 * Fixed nasty bug in output prompt routine. It used to check 'if
6022 6031 arg != None...'. Problem is, this fails if arg implements a
6023 6032 special comparison (__cmp__) which disallows comparing to
6024 6033 None. Found it when trying to use the PhysicalQuantity module from
6025 6034 ScientificPython.
6026 6035
6027 6036 2001-11-05 Fernando Perez <fperez@colorado.edu>
6028 6037
6029 6038 * Also added dirs. Now the pushd/popd/dirs family functions
6030 6039 basically like the shell, with the added convenience of going home
6031 6040 when called with no args.
6032 6041
6033 6042 * pushd/popd slightly modified to mimic shell behavior more
6034 6043 closely.
6035 6044
6036 6045 * Added env,pushd,popd from ShellServices as magic functions. I
6037 6046 think the cleanest will be to port all desired functions from
6038 6047 ShellServices as magics and remove ShellServices altogether. This
6039 6048 will provide a single, clean way of adding functionality
6040 6049 (shell-type or otherwise) to IP.
6041 6050
6042 6051 2001-11-04 Fernando Perez <fperez@colorado.edu>
6043 6052
6044 6053 * Added .ipython/ directory to sys.path. This way users can keep
6045 6054 customizations there and access them via import.
6046 6055
6047 6056 2001-11-03 Fernando Perez <fperez@colorado.edu>
6048 6057
6049 6058 * Opened version 0.1.1 for new changes.
6050 6059
6051 6060 * Changed version number to 0.1.0: first 'public' release, sent to
6052 6061 Nathan and Janko.
6053 6062
6054 6063 * Lots of small fixes and tweaks.
6055 6064
6056 6065 * Minor changes to whos format. Now strings are shown, snipped if
6057 6066 too long.
6058 6067
6059 6068 * Changed ShellServices to work on __main__ so they show up in @who
6060 6069
6061 6070 * Help also works with ? at the end of a line:
6062 6071 ?sin and sin?
6063 6072 both produce the same effect. This is nice, as often I use the
6064 6073 tab-complete to find the name of a method, but I used to then have
6065 6074 to go to the beginning of the line to put a ? if I wanted more
6066 6075 info. Now I can just add the ? and hit return. Convenient.
6067 6076
6068 6077 2001-11-02 Fernando Perez <fperez@colorado.edu>
6069 6078
6070 6079 * Python version check (>=2.1) added.
6071 6080
6072 6081 * Added LazyPython documentation. At this point the docs are quite
6073 6082 a mess. A cleanup is in order.
6074 6083
6075 6084 * Auto-installer created. For some bizarre reason, the zipfiles
6076 6085 module isn't working on my system. So I made a tar version
6077 6086 (hopefully the command line options in various systems won't kill
6078 6087 me).
6079 6088
6080 6089 * Fixes to Struct in genutils. Now all dictionary-like methods are
6081 6090 protected (reasonably).
6082 6091
6083 6092 * Added pager function to genutils and changed ? to print usage
6084 6093 note through it (it was too long).
6085 6094
6086 6095 * Added the LazyPython functionality. Works great! I changed the
6087 6096 auto-quote escape to ';', it's on home row and next to '. But
6088 6097 both auto-quote and auto-paren (still /) escapes are command-line
6089 6098 parameters.
6090 6099
6091 6100
6092 6101 2001-11-01 Fernando Perez <fperez@colorado.edu>
6093 6102
6094 6103 * Version changed to 0.0.7. Fairly large change: configuration now
6095 6104 is all stored in a directory, by default .ipython. There, all
6096 6105 config files have normal looking names (not .names)
6097 6106
6098 6107 * Version 0.0.6 Released first to Lucas and Archie as a test
6099 6108 run. Since it's the first 'semi-public' release, change version to
6100 6109 > 0.0.6 for any changes now.
6101 6110
6102 6111 * Stuff I had put in the ipplib.py changelog:
6103 6112
6104 6113 Changes to InteractiveShell:
6105 6114
6106 6115 - Made the usage message a parameter.
6107 6116
6108 6117 - Require the name of the shell variable to be given. It's a bit
6109 6118 of a hack, but allows the name 'shell' not to be hardwired in the
6110 6119 magic (@) handler, which is problematic b/c it requires
6111 6120 polluting the global namespace with 'shell'. This in turn is
6112 6121 fragile: if a user redefines a variable called shell, things
6113 6122 break.
6114 6123
6115 6124 - magic @: all functions available through @ need to be defined
6116 6125 as magic_<name>, even though they can be called simply as
6117 6126 @<name>. This allows the special command @magic to gather
6118 6127 information automatically about all existing magic functions,
6119 6128 even if they are run-time user extensions, by parsing the shell
6120 6129 instance __dict__ looking for special magic_ names.
6121 6130
6122 6131 - mainloop: added *two* local namespace parameters. This allows
6123 6132 the class to differentiate between parameters which were there
6124 6133 before and after command line initialization was processed. This
6125 6134 way, later @who can show things loaded at startup by the
6126 6135 user. This trick was necessary to make session saving/reloading
6127 6136 really work: ideally after saving/exiting/reloading a session,
6128 6137 *everything* should look the same, including the output of @who. I
6129 6138 was only able to make this work with this double namespace
6130 6139 trick.
6131 6140
6132 6141 - added a header to the logfile which allows (almost) full
6133 6142 session restoring.
6134 6143
6135 6144 - prepend lines beginning with @ or !, with a and log
6136 6145 them. Why? !lines: may be useful to know what you did @lines:
6137 6146 they may affect session state. So when restoring a session, at
6138 6147 least inform the user of their presence. I couldn't quite get
6139 6148 them to properly re-execute, but at least the user is warned.
6140 6149
6141 6150 * Started ChangeLog.
@@ -1,29 +1,29 b''
1 1 #!/bin/sh
2 2
3 3 # release test
4 4
5 5 # clean up build/dist directories
6 6 rm -rf ~/ipython/ipython/build/*
7 7 rm -rf ~/ipython/ipython/dist/*
8 8
9 9 # build source distros
10 10 cd ~/ipython/ipython
11 11
12 12 ./setup.py sdist --formats=gztar
13 13
14 14 # Build rpm
15 python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
15 #python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
16 16
17 17 # Build eggs
18 18 ./eggsetup.py bdist_egg
19 19
20 20 # Call the windows build separately, so that the extra Windows scripts don't
21 21 # get pulled into Unix builds (setup.py has code which checks for
22 22 # bdist_wininst)
23 23
24 24 # For now, make the win32 installer with a hand-built 2.3.5 python, which is
25 25 # the only one that fixes a crash in the post-install phase.
26 26 #$HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \
27 27 # --install-script=ipython_win_post_install.py
28 28
29 29 ./setup.py bdist_wininst --install-script=ipython_win_post_install.py
@@ -1,6 +1,6 b''
1 1 #!/bin/sh
2 2
3 3 # clean public testing/ dir and upload
4 ssh "rm -f ipython@ipython.scipy.org:www/dist/testing/*"
4 #ssh "rm -f ipython@ipython.scipy.org:www/dist/testing/*"
5 5 cd ~/ipython/ipython/dist
6 6 scp * ipython@ipython.scipy.org:www/dist/testing/
General Comments 0
You need to be logged in to leave comments. Login now