##// END OF EJS Templates
Add an input argument to *all* Display constructors....
walter.doerwald -
Show More
@@ -1,401 +1,398 b''
1 """
1 """
2 ``astyle`` provides classes for adding style (foreground and background color;
2 ``astyle`` provides classes for adding style (foreground and background color;
3 bold; blink; etc.) to terminal and curses output.
3 bold; blink; etc.) to terminal and curses output.
4 """
4 """
5
5
6
6
7 import sys, os
7 import sys, os
8
8
9 try:
9 try:
10 import curses
10 import curses
11 except ImportError:
11 except ImportError:
12 curses = None
12 curses = None
13
13
14
14
15 COLOR_BLACK = 0
15 COLOR_BLACK = 0
16 COLOR_RED = 1
16 COLOR_RED = 1
17 COLOR_GREEN = 2
17 COLOR_GREEN = 2
18 COLOR_YELLOW = 3
18 COLOR_YELLOW = 3
19 COLOR_BLUE = 4
19 COLOR_BLUE = 4
20 COLOR_MAGENTA = 5
20 COLOR_MAGENTA = 5
21 COLOR_CYAN = 6
21 COLOR_CYAN = 6
22 COLOR_WHITE = 7
22 COLOR_WHITE = 7
23
23
24 A_BLINK = 1<<0 # Blinking text
24 A_BLINK = 1<<0 # Blinking text
25 A_BOLD = 1<<1 # Extra bright or bold text
25 A_BOLD = 1<<1 # Extra bright or bold text
26 A_DIM = 1<<2 # Half bright text
26 A_DIM = 1<<2 # Half bright text
27 A_REVERSE = 1<<3 # Reverse-video text
27 A_REVERSE = 1<<3 # Reverse-video text
28 A_STANDOUT = 1<<4 # The best highlighting mode available
28 A_STANDOUT = 1<<4 # The best highlighting mode available
29 A_UNDERLINE = 1<<5 # Underlined text
29 A_UNDERLINE = 1<<5 # Underlined text
30
30
31
31
32 class Style(object):
32 class Style(object):
33 """
33 """
34 Store foreground color, background color and attribute (bold, underlined
34 Store foreground color, background color and attribute (bold, underlined
35 etc.).
35 etc.).
36 """
36 """
37 __slots__ = ("fg", "bg", "attrs")
37 __slots__ = ("fg", "bg", "attrs")
38
38
39 COLORNAMES = {
39 COLORNAMES = {
40 "black": COLOR_BLACK,
40 "black": COLOR_BLACK,
41 "red": COLOR_RED,
41 "red": COLOR_RED,
42 "green": COLOR_GREEN,
42 "green": COLOR_GREEN,
43 "yellow": COLOR_YELLOW,
43 "yellow": COLOR_YELLOW,
44 "blue": COLOR_BLUE,
44 "blue": COLOR_BLUE,
45 "magenta": COLOR_MAGENTA,
45 "magenta": COLOR_MAGENTA,
46 "cyan": COLOR_CYAN,
46 "cyan": COLOR_CYAN,
47 "white": COLOR_WHITE,
47 "white": COLOR_WHITE,
48 }
48 }
49 ATTRNAMES = {
49 ATTRNAMES = {
50 "blink": A_BLINK,
50 "blink": A_BLINK,
51 "bold": A_BOLD,
51 "bold": A_BOLD,
52 "dim": A_DIM,
52 "dim": A_DIM,
53 "reverse": A_REVERSE,
53 "reverse": A_REVERSE,
54 "standout": A_STANDOUT,
54 "standout": A_STANDOUT,
55 "underline": A_UNDERLINE,
55 "underline": A_UNDERLINE,
56 }
56 }
57
57
58 def __init__(self, fg, bg, attrs=0):
58 def __init__(self, fg, bg, attrs=0):
59 """
59 """
60 Create a ``Style`` object with ``fg`` as the foreground color,
60 Create a ``Style`` object with ``fg`` as the foreground color,
61 ``bg`` as the background color and ``attrs`` as the attributes.
61 ``bg`` as the background color and ``attrs`` as the attributes.
62
62
63 Examples:
63 Examples:
64
64
65 >>> Style(COLOR_RED, COLOR_BLACK)
65 >>> Style(COLOR_RED, COLOR_BLACK)
66 >>> Style(COLOR_YELLOW, COLOR_BLUE, A_BOLD|A_UNDERLINE)
66 >>> Style(COLOR_YELLOW, COLOR_BLUE, A_BOLD|A_UNDERLINE)
67 """
67 """
68 self.fg = fg
68 self.fg = fg
69 self.bg = bg
69 self.bg = bg
70 self.attrs = attrs
70 self.attrs = attrs
71
71
72 def __call__(self, *args):
72 def __call__(self, *args):
73 text = Text()
73 text = Text()
74 for arg in args:
74 for arg in args:
75 if isinstance(arg, Text):
75 if isinstance(arg, Text):
76 text.extend(arg)
76 text.extend(arg)
77 else:
77 else:
78 text.append((self, arg))
78 text.append((self, arg))
79 return text
79 return text
80
80
81 def __eq__(self, other):
81 def __eq__(self, other):
82 return self.fg == other.fg and self.bg == other.bg and self.attrs == other.attrs
82 return self.fg == other.fg and self.bg == other.bg and self.attrs == other.attrs
83
83
84 def __neq__(self, other):
84 def __neq__(self, other):
85 return self.fg != other.fg or self.bg != other.bg or self.attrs != other.attrs
85 return self.fg != other.fg or self.bg != other.bg or self.attrs != other.attrs
86
86
87 def __repr__(self):
87 def __repr__(self):
88 color2name = ("black", "red", "green", "yellow", "blue", "magenta", "cyan", "white")
88 color2name = ("black", "red", "green", "yellow", "blue", "magenta", "cyan", "white")
89 attrs2name = ("blink", "bold", "dim", "reverse", "standout", "underline")
89 attrs2name = ("blink", "bold", "dim", "reverse", "standout", "underline")
90
90
91 return "<%s fg=%s bg=%s attrs=%s>" % (
91 return "<%s fg=%s bg=%s attrs=%s>" % (
92 self.__class__.__name__, color2name[self.fg], color2name[self.bg],
92 self.__class__.__name__, color2name[self.fg], color2name[self.bg],
93 "|".join([attrs2name[b] for b in xrange(6) if self.attrs&(1<<b)]) or 0)
93 "|".join([attrs2name[b] for b in xrange(6) if self.attrs&(1<<b)]) or 0)
94
94
95 def fromstr(cls, value):
95 def fromstr(cls, value):
96 """
96 """
97 Create a ``Style`` object from a string. The format looks like this:
97 Create a ``Style`` object from a string. The format looks like this:
98 ``"red:black:bold|blink"``.
98 ``"red:black:bold|blink"``.
99 """
99 """
100 # defaults
100 # defaults
101 fg = COLOR_WHITE
101 fg = COLOR_WHITE
102 bg = COLOR_BLACK
102 bg = COLOR_BLACK
103 attrs = 0
103 attrs = 0
104
104
105 parts = value.split(":")
105 parts = value.split(":")
106 if len(parts) > 0:
106 if len(parts) > 0:
107 fg = cls.COLORNAMES[parts[0].lower()]
107 fg = cls.COLORNAMES[parts[0].lower()]
108 if len(parts) > 1:
108 if len(parts) > 1:
109 bg = cls.COLORNAMES[parts[1].lower()]
109 bg = cls.COLORNAMES[parts[1].lower()]
110 if len(parts) > 2:
110 if len(parts) > 2:
111 for strattr in parts[2].split("|"):
111 for strattr in parts[2].split("|"):
112 attrs |= cls.ATTRNAMES[strattr.lower()]
112 attrs |= cls.ATTRNAMES[strattr.lower()]
113 return cls(fg, bg, attrs)
113 return cls(fg, bg, attrs)
114 fromstr = classmethod(fromstr)
114 fromstr = classmethod(fromstr)
115
115
116 def fromenv(cls, name, default):
116 def fromenv(cls, name, default):
117 """
117 """
118 Create a ``Style`` from an environment variable named ``name``
118 Create a ``Style`` from an environment variable named ``name``
119 (using ``default`` if the environment variable doesn't exist).
119 (using ``default`` if the environment variable doesn't exist).
120 """
120 """
121 return cls.fromstr(os.environ.get(name, default))
121 return cls.fromstr(os.environ.get(name, default))
122 fromenv = classmethod(fromenv)
122 fromenv = classmethod(fromenv)
123
123
124
124
125 def switchstyle(s1, s2):
125 def switchstyle(s1, s2):
126 """
126 """
127 Return the ANSI escape sequence needed to switch from style ``s1`` to
127 Return the ANSI escape sequence needed to switch from style ``s1`` to
128 style ``s2``.
128 style ``s2``.
129 """
129 """
130 attrmask = (A_BLINK|A_BOLD|A_UNDERLINE|A_REVERSE)
130 attrmask = (A_BLINK|A_BOLD|A_UNDERLINE|A_REVERSE)
131 a1 = s1.attrs & attrmask
131 a1 = s1.attrs & attrmask
132 a2 = s2.attrs & attrmask
132 a2 = s2.attrs & attrmask
133
133
134 args = []
134 args = []
135 if s1 != s2:
135 if s1 != s2:
136 # do we have to get rid of the bold/underline/blink bit?
136 # do we have to get rid of the bold/underline/blink bit?
137 # (can only be done by a reset)
137 # (can only be done by a reset)
138 # use reset when our target color is the default color
138 # use reset when our target color is the default color
139 # (this is shorter than 37;40)
139 # (this is shorter than 37;40)
140 if (a1 & ~a2 or s2==style_default):
140 if (a1 & ~a2 or s2==style_default):
141 args.append("0")
141 args.append("0")
142 s1 = style_default
142 s1 = style_default
143 a1 = 0
143 a1 = 0
144
144
145 # now we know that old and new color have the same boldness,
145 # now we know that old and new color have the same boldness,
146 # or the new color is bold and the old isn't,
146 # or the new color is bold and the old isn't,
147 # i.e. we only might have to switch bold on, not off
147 # i.e. we only might have to switch bold on, not off
148 if not (a1 & A_BOLD) and (a2 & A_BOLD):
148 if not (a1 & A_BOLD) and (a2 & A_BOLD):
149 args.append("1")
149 args.append("1")
150
150
151 # Fix underline
151 # Fix underline
152 if not (a1 & A_UNDERLINE) and (a2 & A_UNDERLINE):
152 if not (a1 & A_UNDERLINE) and (a2 & A_UNDERLINE):
153 args.append("4")
153 args.append("4")
154
154
155 # Fix blink
155 # Fix blink
156 if not (a1 & A_BLINK) and (a2 & A_BLINK):
156 if not (a1 & A_BLINK) and (a2 & A_BLINK):
157 args.append("5")
157 args.append("5")
158
158
159 # Fix reverse
159 # Fix reverse
160 if not (a1 & A_REVERSE) and (a2 & A_REVERSE):
160 if not (a1 & A_REVERSE) and (a2 & A_REVERSE):
161 args.append("7")
161 args.append("7")
162
162
163 # Fix foreground color
163 # Fix foreground color
164 if s1.fg != s2.fg:
164 if s1.fg != s2.fg:
165 args.append("3%d" % s2.fg)
165 args.append("3%d" % s2.fg)
166
166
167 # Finally fix the background color
167 # Finally fix the background color
168 if s1.bg != s2.bg:
168 if s1.bg != s2.bg:
169 args.append("4%d" % s2.bg)
169 args.append("4%d" % s2.bg)
170
170
171 if args:
171 if args:
172 return "\033[%sm" % ";".join(args)
172 return "\033[%sm" % ";".join(args)
173 return ""
173 return ""
174
174
175
175
176 class Text(list):
176 class Text(list):
177 """
177 """
178 A colored string. A ``Text`` object is a sequence, the sequence
178 A colored string. A ``Text`` object is a sequence, the sequence
179 items will be ``(style, string)`` tuples.
179 items will be ``(style, string)`` tuples.
180 """
180 """
181
181
182 def __init__(self, *args):
182 def __init__(self, *args):
183 list.__init__(self)
183 list.__init__(self)
184 self.append(*args)
184 self.append(*args)
185
185
186 def __repr__(self):
186 def __repr__(self):
187 return "%s.%s(%s)" % (
187 return "%s.%s(%s)" % (
188 self.__class__.__module__, self.__class__.__name__,
188 self.__class__.__module__, self.__class__.__name__,
189 list.__repr__(self)[1:-1])
189 list.__repr__(self)[1:-1])
190
190
191 def append(self, *args):
191 def append(self, *args):
192 for arg in args:
192 for arg in args:
193 if isinstance(arg, Text):
193 if isinstance(arg, Text):
194 self.extend(arg)
194 self.extend(arg)
195 elif isinstance(arg, tuple): # must be (style, string)
195 elif isinstance(arg, tuple): # must be (style, string)
196 list.append(self, arg)
196 list.append(self, arg)
197 elif isinstance(arg, unicode):
197 elif isinstance(arg, unicode):
198 list.append(self, (style_default, arg))
198 list.append(self, (style_default, arg))
199 else:
199 else:
200 list.append(self, (style_default, str(arg)))
200 list.append(self, (style_default, str(arg)))
201
201
202 def insert(self, index, *args):
202 def insert(self, index, *args):
203 self[index:index] = Text(*args)
203 self[index:index] = Text(*args)
204
204
205 def __add__(self, other):
205 def __add__(self, other):
206 new = Text()
206 new = Text()
207 new.append(self)
207 new.append(self)
208 new.append(other)
208 new.append(other)
209 return new
209 return new
210
210
211 def __iadd__(self, other):
211 def __iadd__(self, other):
212 self.append(other)
212 self.append(other)
213 return self
213 return self
214
214
215 def format(self, styled=True):
215 def format(self, styled=True):
216 """
216 """
217 This generator yields the strings that will make up the final
217 This generator yields the strings that will make up the final
218 colorized string.
218 colorized string.
219 """
219 """
220 if styled:
220 if styled:
221 oldstyle = style_default
221 oldstyle = style_default
222 for (style, string) in self:
222 for (style, string) in self:
223 if not isinstance(style, (int, long)):
223 if not isinstance(style, (int, long)):
224 switch = switchstyle(oldstyle, style)
224 switch = switchstyle(oldstyle, style)
225 if switch:
225 if switch:
226 yield switch
226 yield switch
227 if string:
227 if string:
228 yield string
228 yield string
229 oldstyle = style
229 oldstyle = style
230 switch = switchstyle(oldstyle, style_default)
230 switch = switchstyle(oldstyle, style_default)
231 if switch:
231 if switch:
232 yield switch
232 yield switch
233 else:
233 else:
234 for (style, string) in self:
234 for (style, string) in self:
235 if not isinstance(style, (int, long)):
235 if not isinstance(style, (int, long)):
236 yield string
236 yield string
237
237
238 def string(self, styled=True):
238 def string(self, styled=True):
239 """
239 """
240 Return the resulting string (with escape sequences, if ``styled``
240 Return the resulting string (with escape sequences, if ``styled``
241 is true).
241 is true).
242 """
242 """
243 return "".join(self.format(styled))
243 return "".join(self.format(styled))
244
244
245 def __str__(self):
245 def __str__(self):
246 """
246 """
247 Return ``self`` as a string (without ANSI escape sequences).
247 Return ``self`` as a string (without ANSI escape sequences).
248 """
248 """
249 return self.string(False)
249 return self.string(False)
250
250
251 def write(self, stream, styled=True):
251 def write(self, stream, styled=True):
252 """
252 """
253 Write ``self`` to the output stream ``stream`` (with escape sequences,
253 Write ``self`` to the output stream ``stream`` (with escape sequences,
254 if ``styled`` is true).
254 if ``styled`` is true).
255 """
255 """
256 for part in self.format(styled):
256 for part in self.format(styled):
257 stream.write(part)
257 stream.write(part)
258
258
259
259
260 try:
260 try:
261 import ipipe
261 import ipipe
262 except ImportError:
262 except ImportError:
263 pass
263 pass
264 else:
264 else:
265 def xrepr_astyle_text(self, mode="default"):
265 def xrepr_astyle_text(self, mode="default"):
266 yield (-1, True)
266 yield (-1, True)
267 for info in self:
267 for info in self:
268 yield info
268 yield info
269 try:
269 ipipe.xrepr.when_type(Text)(xrepr_astyle_text)
270 ipipe.xrepr.when_type(Text)(xrepr_astyle_text)
271 except Exception:
272 pass
273
270
274
271
275 def streamstyle(stream, styled=None):
272 def streamstyle(stream, styled=None):
276 """
273 """
277 If ``styled`` is ``None``, return whether ``stream`` refers to a terminal.
274 If ``styled`` is ``None``, return whether ``stream`` refers to a terminal.
278 If this can't be determined (either because ``stream`` doesn't refer to a
275 If this can't be determined (either because ``stream`` doesn't refer to a
279 real OS file, or because you're on Windows) return ``False``. If ``styled``
276 real OS file, or because you're on Windows) return ``False``. If ``styled``
280 is not ``None`` ``styled`` will be returned unchanged.
277 is not ``None`` ``styled`` will be returned unchanged.
281 """
278 """
282 if styled is None:
279 if styled is None:
283 try:
280 try:
284 styled = os.isatty(stream.fileno())
281 styled = os.isatty(stream.fileno())
285 except (KeyboardInterrupt, SystemExit):
282 except (KeyboardInterrupt, SystemExit):
286 raise
283 raise
287 except Exception:
284 except Exception:
288 styled = False
285 styled = False
289 return styled
286 return styled
290
287
291
288
292 def write(stream, styled, *texts):
289 def write(stream, styled, *texts):
293 """
290 """
294 Write ``texts`` to ``stream``.
291 Write ``texts`` to ``stream``.
295 """
292 """
296 text = Text(*texts)
293 text = Text(*texts)
297 text.write(stream, streamstyle(stream, styled))
294 text.write(stream, streamstyle(stream, styled))
298
295
299
296
300 def writeln(stream, styled, *texts):
297 def writeln(stream, styled, *texts):
301 """
298 """
302 Write ``texts`` to ``stream`` and finish with a line feed.
299 Write ``texts`` to ``stream`` and finish with a line feed.
303 """
300 """
304 write(stream, styled, *texts)
301 write(stream, styled, *texts)
305 stream.write("\n")
302 stream.write("\n")
306
303
307
304
308 class Stream(object):
305 class Stream(object):
309 """
306 """
310 Stream wrapper that adds color output.
307 Stream wrapper that adds color output.
311 """
308 """
312 def __init__(self, stream, styled=None):
309 def __init__(self, stream, styled=None):
313 self.stream = stream
310 self.stream = stream
314 self.styled = streamstyle(stream, styled)
311 self.styled = streamstyle(stream, styled)
315
312
316 def write(self, *texts):
313 def write(self, *texts):
317 write(self.stream, self.styled, *texts)
314 write(self.stream, self.styled, *texts)
318
315
319 def writeln(self, *texts):
316 def writeln(self, *texts):
320 writeln(self.stream, self.styled, *texts)
317 writeln(self.stream, self.styled, *texts)
321
318
322 def __getattr__(self, name):
319 def __getattr__(self, name):
323 return getattr(self.stream, name)
320 return getattr(self.stream, name)
324
321
325
322
326 class stdout(object):
323 class stdout(object):
327 """
324 """
328 Stream wrapper for ``sys.stdout`` that adds color output.
325 Stream wrapper for ``sys.stdout`` that adds color output.
329 """
326 """
330 def write(self, *texts):
327 def write(self, *texts):
331 write(sys.stdout, None, *texts)
328 write(sys.stdout, None, *texts)
332
329
333 def writeln(self, *texts):
330 def writeln(self, *texts):
334 writeln(sys.stdout, None, *texts)
331 writeln(sys.stdout, None, *texts)
335
332
336 def __getattr__(self, name):
333 def __getattr__(self, name):
337 return getattr(sys.stdout, name)
334 return getattr(sys.stdout, name)
338 stdout = stdout()
335 stdout = stdout()
339
336
340
337
341 class stderr(object):
338 class stderr(object):
342 """
339 """
343 Stream wrapper for ``sys.stderr`` that adds color output.
340 Stream wrapper for ``sys.stderr`` that adds color output.
344 """
341 """
345 def write(self, *texts):
342 def write(self, *texts):
346 write(sys.stderr, None, *texts)
343 write(sys.stderr, None, *texts)
347
344
348 def writeln(self, *texts):
345 def writeln(self, *texts):
349 writeln(sys.stderr, None, *texts)
346 writeln(sys.stderr, None, *texts)
350
347
351 def __getattr__(self, name):
348 def __getattr__(self, name):
352 return getattr(sys.stdout, name)
349 return getattr(sys.stdout, name)
353 stderr = stderr()
350 stderr = stderr()
354
351
355
352
356 if curses is not None:
353 if curses is not None:
357 # This is probably just range(8)
354 # This is probably just range(8)
358 COLOR2CURSES = [
355 COLOR2CURSES = [
359 COLOR_BLACK,
356 COLOR_BLACK,
360 COLOR_RED,
357 COLOR_RED,
361 COLOR_GREEN,
358 COLOR_GREEN,
362 COLOR_YELLOW,
359 COLOR_YELLOW,
363 COLOR_BLUE,
360 COLOR_BLUE,
364 COLOR_MAGENTA,
361 COLOR_MAGENTA,
365 COLOR_CYAN,
362 COLOR_CYAN,
366 COLOR_WHITE,
363 COLOR_WHITE,
367 ]
364 ]
368
365
369 A2CURSES = {
366 A2CURSES = {
370 A_BLINK: curses.A_BLINK,
367 A_BLINK: curses.A_BLINK,
371 A_BOLD: curses.A_BOLD,
368 A_BOLD: curses.A_BOLD,
372 A_DIM: curses.A_DIM,
369 A_DIM: curses.A_DIM,
373 A_REVERSE: curses.A_REVERSE,
370 A_REVERSE: curses.A_REVERSE,
374 A_STANDOUT: curses.A_STANDOUT,
371 A_STANDOUT: curses.A_STANDOUT,
375 A_UNDERLINE: curses.A_UNDERLINE,
372 A_UNDERLINE: curses.A_UNDERLINE,
376 }
373 }
377
374
378
375
379 # default style
376 # default style
380 style_default = Style.fromstr("white:black")
377 style_default = Style.fromstr("white:black")
381
378
382 # Styles for datatypes
379 # Styles for datatypes
383 style_type_none = Style.fromstr("magenta:black")
380 style_type_none = Style.fromstr("magenta:black")
384 style_type_bool = Style.fromstr("magenta:black")
381 style_type_bool = Style.fromstr("magenta:black")
385 style_type_number = Style.fromstr("yellow:black")
382 style_type_number = Style.fromstr("yellow:black")
386 style_type_datetime = Style.fromstr("magenta:black")
383 style_type_datetime = Style.fromstr("magenta:black")
387 style_type_type = Style.fromstr("cyan:black")
384 style_type_type = Style.fromstr("cyan:black")
388
385
389 # Style for URLs and file/directory names
386 # Style for URLs and file/directory names
390 style_url = Style.fromstr("green:black")
387 style_url = Style.fromstr("green:black")
391 style_dir = Style.fromstr("cyan:black")
388 style_dir = Style.fromstr("cyan:black")
392 style_file = Style.fromstr("green:black")
389 style_file = Style.fromstr("green:black")
393
390
394 # Style for ellipsis (when an output has been shortened
391 # Style for ellipsis (when an output has been shortened
395 style_ellisis = Style.fromstr("red:black")
392 style_ellisis = Style.fromstr("red:black")
396
393
397 # Style for displaying exceptions
394 # Style for displaying exceptions
398 style_error = Style.fromstr("red:black")
395 style_error = Style.fromstr("red:black")
399
396
400 # Style for displaying non-existing attributes
397 # Style for displaying non-existing attributes
401 style_nodata = Style.fromstr("red:black")
398 style_nodata = Style.fromstr("red:black")
@@ -1,1769 +1,1767 b''
1 # -*- coding: iso-8859-1 -*-
1 # -*- coding: iso-8859-1 -*-
2
2
3 import curses, fcntl, signal, struct, tty, textwrap, inspect
3 import curses, fcntl, signal, struct, tty, textwrap, inspect
4
4
5 from IPython import ipapi
5 from IPython import ipapi
6
6
7 import astyle, ipipe
7 import astyle, ipipe
8
8
9
9
10 # Python 2.3 compatibility
10 # Python 2.3 compatibility
11 try:
11 try:
12 set
12 set
13 except NameError:
13 except NameError:
14 import sets
14 import sets
15 set = sets.Set
15 set = sets.Set
16
16
17 # Python 2.3 compatibility
17 # Python 2.3 compatibility
18 try:
18 try:
19 sorted
19 sorted
20 except NameError:
20 except NameError:
21 from ipipe import sorted
21 from ipipe import sorted
22
22
23
23
24 class UnassignedKeyError(Exception):
24 class UnassignedKeyError(Exception):
25 """
25 """
26 Exception that is used for reporting unassigned keys.
26 Exception that is used for reporting unassigned keys.
27 """
27 """
28
28
29
29
30 class UnknownCommandError(Exception):
30 class UnknownCommandError(Exception):
31 """
31 """
32 Exception that is used for reporting unknown commands (this should never
32 Exception that is used for reporting unknown commands (this should never
33 happen).
33 happen).
34 """
34 """
35
35
36
36
37 class CommandError(Exception):
37 class CommandError(Exception):
38 """
38 """
39 Exception that is used for reporting that a command can't be executed.
39 Exception that is used for reporting that a command can't be executed.
40 """
40 """
41
41
42
42
43 class Keymap(dict):
43 class Keymap(dict):
44 """
44 """
45 Stores mapping of keys to commands.
45 Stores mapping of keys to commands.
46 """
46 """
47 def __init__(self):
47 def __init__(self):
48 self._keymap = {}
48 self._keymap = {}
49
49
50 def __setitem__(self, key, command):
50 def __setitem__(self, key, command):
51 if isinstance(key, str):
51 if isinstance(key, str):
52 for c in key:
52 for c in key:
53 dict.__setitem__(self, ord(c), command)
53 dict.__setitem__(self, ord(c), command)
54 else:
54 else:
55 dict.__setitem__(self, key, command)
55 dict.__setitem__(self, key, command)
56
56
57 def __getitem__(self, key):
57 def __getitem__(self, key):
58 if isinstance(key, str):
58 if isinstance(key, str):
59 key = ord(key)
59 key = ord(key)
60 return dict.__getitem__(self, key)
60 return dict.__getitem__(self, key)
61
61
62 def __detitem__(self, key):
62 def __detitem__(self, key):
63 if isinstance(key, str):
63 if isinstance(key, str):
64 key = ord(key)
64 key = ord(key)
65 dict.__detitem__(self, key)
65 dict.__detitem__(self, key)
66
66
67 def register(self, command, *keys):
67 def register(self, command, *keys):
68 for key in keys:
68 for key in keys:
69 self[key] = command
69 self[key] = command
70
70
71 def get(self, key, default=None):
71 def get(self, key, default=None):
72 if isinstance(key, str):
72 if isinstance(key, str):
73 key = ord(key)
73 key = ord(key)
74 return dict.get(self, key, default)
74 return dict.get(self, key, default)
75
75
76 def findkey(self, command, default=ipipe.noitem):
76 def findkey(self, command, default=ipipe.noitem):
77 for (key, commandcandidate) in self.iteritems():
77 for (key, commandcandidate) in self.iteritems():
78 if commandcandidate == command:
78 if commandcandidate == command:
79 return key
79 return key
80 if default is ipipe.noitem:
80 if default is ipipe.noitem:
81 raise KeyError(command)
81 raise KeyError(command)
82 return default
82 return default
83
83
84
84
85 class _BrowserCachedItem(object):
85 class _BrowserCachedItem(object):
86 # This is used internally by ``ibrowse`` to store a item together with its
86 # This is used internally by ``ibrowse`` to store a item together with its
87 # marked status.
87 # marked status.
88 __slots__ = ("item", "marked")
88 __slots__ = ("item", "marked")
89
89
90 def __init__(self, item):
90 def __init__(self, item):
91 self.item = item
91 self.item = item
92 self.marked = False
92 self.marked = False
93
93
94
94
95 class _BrowserHelp(object):
95 class _BrowserHelp(object):
96 style_header = astyle.Style.fromstr("yellow:black:bold")
96 style_header = astyle.Style.fromstr("yellow:black:bold")
97 # This is used internally by ``ibrowse`` for displaying the help screen.
97 # This is used internally by ``ibrowse`` for displaying the help screen.
98 def __init__(self, browser):
98 def __init__(self, browser):
99 self.browser = browser
99 self.browser = browser
100
100
101 def __xrepr__(self, mode):
101 def __xrepr__(self, mode):
102 yield (-1, True)
102 yield (-1, True)
103 if mode == "header" or mode == "footer":
103 if mode == "header" or mode == "footer":
104 yield (astyle.style_default, "ibrowse help screen")
104 yield (astyle.style_default, "ibrowse help screen")
105 else:
105 else:
106 yield (astyle.style_default, repr(self))
106 yield (astyle.style_default, repr(self))
107
107
108 def __iter__(self):
108 def __iter__(self):
109 # Get reverse key mapping
109 # Get reverse key mapping
110 allkeys = {}
110 allkeys = {}
111 for (key, cmd) in self.browser.keymap.iteritems():
111 for (key, cmd) in self.browser.keymap.iteritems():
112 allkeys.setdefault(cmd, []).append(key)
112 allkeys.setdefault(cmd, []).append(key)
113
113
114 fields = ("key", "description")
114 fields = ("key", "description")
115
115
116 commands = []
116 commands = []
117 for name in dir(self.browser):
117 for name in dir(self.browser):
118 if name.startswith("cmd_"):
118 if name.startswith("cmd_"):
119 command = getattr(self.browser, name)
119 command = getattr(self.browser, name)
120 commands.append((inspect.getsourcelines(command)[-1], name[4:], command))
120 commands.append((inspect.getsourcelines(command)[-1], name[4:], command))
121 commands.sort()
121 commands.sort()
122 commands = [(c[1], c[2]) for c in commands]
122 commands = [(c[1], c[2]) for c in commands]
123 for (i, (name, command)) in enumerate(commands):
123 for (i, (name, command)) in enumerate(commands):
124 if i:
124 if i:
125 yield ipipe.Fields(fields, key="", description="")
125 yield ipipe.Fields(fields, key="", description="")
126
126
127 description = command.__doc__
127 description = command.__doc__
128 if description is None:
128 if description is None:
129 lines = []
129 lines = []
130 else:
130 else:
131 lines = [l.strip() for l in description.splitlines() if l.strip()]
131 lines = [l.strip() for l in description.splitlines() if l.strip()]
132 description = "\n".join(lines)
132 description = "\n".join(lines)
133 lines = textwrap.wrap(description, 60)
133 lines = textwrap.wrap(description, 60)
134 keys = allkeys.get(name, [])
134 keys = allkeys.get(name, [])
135
135
136 yield ipipe.Fields(fields, key="", description=astyle.Text((self.style_header, name)))
136 yield ipipe.Fields(fields, key="", description=astyle.Text((self.style_header, name)))
137 for i in xrange(max(len(keys), len(lines))):
137 for i in xrange(max(len(keys), len(lines))):
138 try:
138 try:
139 key = self.browser.keylabel(keys[i])
139 key = self.browser.keylabel(keys[i])
140 except IndexError:
140 except IndexError:
141 key = ""
141 key = ""
142 try:
142 try:
143 line = lines[i]
143 line = lines[i]
144 except IndexError:
144 except IndexError:
145 line = ""
145 line = ""
146 yield ipipe.Fields(fields, key=key, description=line)
146 yield ipipe.Fields(fields, key=key, description=line)
147
147
148
148
149 class _BrowserLevel(object):
149 class _BrowserLevel(object):
150 # This is used internally to store the state (iterator, fetch items,
150 # This is used internally to store the state (iterator, fetch items,
151 # position of cursor and screen, etc.) of one browser level
151 # position of cursor and screen, etc.) of one browser level
152 # An ``ibrowse`` object keeps multiple ``_BrowserLevel`` objects in
152 # An ``ibrowse`` object keeps multiple ``_BrowserLevel`` objects in
153 # a stack.
153 # a stack.
154 def __init__(self, browser, input, mainsizey, *attrs):
154 def __init__(self, browser, input, mainsizey, *attrs):
155 self.browser = browser
155 self.browser = browser
156 self.input = input
156 self.input = input
157 self.header = [x for x in ipipe.xrepr(input, "header") if not isinstance(x[0], int)]
157 self.header = [x for x in ipipe.xrepr(input, "header") if not isinstance(x[0], int)]
158 # iterator for the input
158 # iterator for the input
159 self.iterator = ipipe.xiter(input)
159 self.iterator = ipipe.xiter(input)
160
160
161 # is the iterator exhausted?
161 # is the iterator exhausted?
162 self.exhausted = False
162 self.exhausted = False
163
163
164 # attributes to be display (autodetected if empty)
164 # attributes to be display (autodetected if empty)
165 self.attrs = attrs
165 self.attrs = attrs
166
166
167 # fetched items (+ marked flag)
167 # fetched items (+ marked flag)
168 self.items = ipipe.deque()
168 self.items = ipipe.deque()
169
169
170 # Number of marked objects
170 # Number of marked objects
171 self.marked = 0
171 self.marked = 0
172
172
173 # Vertical cursor position
173 # Vertical cursor position
174 self.cury = 0
174 self.cury = 0
175
175
176 # Horizontal cursor position
176 # Horizontal cursor position
177 self.curx = 0
177 self.curx = 0
178
178
179 # Index of first data column
179 # Index of first data column
180 self.datastartx = 0
180 self.datastartx = 0
181
181
182 # Index of first data line
182 # Index of first data line
183 self.datastarty = 0
183 self.datastarty = 0
184
184
185 # height of the data display area
185 # height of the data display area
186 self.mainsizey = mainsizey
186 self.mainsizey = mainsizey
187
187
188 # width of the data display area (changes when scrolling)
188 # width of the data display area (changes when scrolling)
189 self.mainsizex = 0
189 self.mainsizex = 0
190
190
191 # Size of row number (changes when scrolling)
191 # Size of row number (changes when scrolling)
192 self.numbersizex = 0
192 self.numbersizex = 0
193
193
194 # Attributes to display (in this order)
194 # Attributes to display (in this order)
195 self.displayattrs = []
195 self.displayattrs = []
196
196
197 # index and attribute under the cursor
197 # index and attribute under the cursor
198 self.displayattr = (None, ipipe.noitem)
198 self.displayattr = (None, ipipe.noitem)
199
199
200 # Maps attributes to column widths
200 # Maps attributes to column widths
201 self.colwidths = {}
201 self.colwidths = {}
202
202
203 # Set of hidden attributes
203 # Set of hidden attributes
204 self.hiddenattrs = set()
204 self.hiddenattrs = set()
205
205
206 # This takes care of all the caches etc.
206 # This takes care of all the caches etc.
207 self.moveto(0, 0, refresh=True)
207 self.moveto(0, 0, refresh=True)
208
208
209 def fetch(self, count):
209 def fetch(self, count):
210 # Try to fill ``self.items`` with at least ``count`` objects.
210 # Try to fill ``self.items`` with at least ``count`` objects.
211 have = len(self.items)
211 have = len(self.items)
212 while not self.exhausted and have < count:
212 while not self.exhausted and have < count:
213 try:
213 try:
214 item = self.iterator.next()
214 item = self.iterator.next()
215 except StopIteration:
215 except StopIteration:
216 self.exhausted = True
216 self.exhausted = True
217 break
217 break
218 except (KeyboardInterrupt, SystemExit):
218 except (KeyboardInterrupt, SystemExit):
219 raise
219 raise
220 except Exception, exc:
220 except Exception, exc:
221 have += 1
221 have += 1
222 self.items.append(_BrowserCachedItem(exc))
222 self.items.append(_BrowserCachedItem(exc))
223 self.exhausted = True
223 self.exhausted = True
224 break
224 break
225 else:
225 else:
226 have += 1
226 have += 1
227 self.items.append(_BrowserCachedItem(item))
227 self.items.append(_BrowserCachedItem(item))
228
228
229 def calcdisplayattrs(self):
229 def calcdisplayattrs(self):
230 # Calculate which attributes are available from the objects that are
230 # Calculate which attributes are available from the objects that are
231 # currently visible on screen (and store it in ``self.displayattrs``)
231 # currently visible on screen (and store it in ``self.displayattrs``)
232
232
233 attrs = set()
233 attrs = set()
234 self.displayattrs = []
234 self.displayattrs = []
235 if self.attrs:
235 if self.attrs:
236 # If the browser object specifies a fixed list of attributes,
236 # If the browser object specifies a fixed list of attributes,
237 # simply use it (removing hidden attributes).
237 # simply use it (removing hidden attributes).
238 for attr in self.attrs:
238 for attr in self.attrs:
239 attr = ipipe.upgradexattr(attr)
239 attr = ipipe.upgradexattr(attr)
240 if attr not in attrs and attr not in self.hiddenattrs:
240 if attr not in attrs and attr not in self.hiddenattrs:
241 self.displayattrs.append(attr)
241 self.displayattrs.append(attr)
242 attrs.add(attr)
242 attrs.add(attr)
243 else:
243 else:
244 endy = min(self.datastarty+self.mainsizey, len(self.items))
244 endy = min(self.datastarty+self.mainsizey, len(self.items))
245 for i in xrange(self.datastarty, endy):
245 for i in xrange(self.datastarty, endy):
246 for attr in ipipe.xattrs(self.items[i].item, "default"):
246 for attr in ipipe.xattrs(self.items[i].item, "default"):
247 if attr not in attrs and attr not in self.hiddenattrs:
247 if attr not in attrs and attr not in self.hiddenattrs:
248 self.displayattrs.append(attr)
248 self.displayattrs.append(attr)
249 attrs.add(attr)
249 attrs.add(attr)
250
250
251 def getrow(self, i):
251 def getrow(self, i):
252 # Return a dictionary with the attributes for the object
252 # Return a dictionary with the attributes for the object
253 # ``self.items[i]``. Attribute names are taken from
253 # ``self.items[i]``. Attribute names are taken from
254 # ``self.displayattrs`` so ``calcdisplayattrs()`` must have been
254 # ``self.displayattrs`` so ``calcdisplayattrs()`` must have been
255 # called before.
255 # called before.
256 row = {}
256 row = {}
257 item = self.items[i].item
257 item = self.items[i].item
258 for attr in self.displayattrs:
258 for attr in self.displayattrs:
259 try:
259 try:
260 value = attr.value(item)
260 value = attr.value(item)
261 except (KeyboardInterrupt, SystemExit):
261 except (KeyboardInterrupt, SystemExit):
262 raise
262 raise
263 except Exception, exc:
263 except Exception, exc:
264 value = exc
264 value = exc
265 # only store attribute if it exists (or we got an exception)
265 # only store attribute if it exists (or we got an exception)
266 if value is not ipipe.noitem:
266 if value is not ipipe.noitem:
267 # remember alignment, length and colored text
267 # remember alignment, length and colored text
268 row[attr] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
268 row[attr] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
269 return row
269 return row
270
270
271 def calcwidths(self):
271 def calcwidths(self):
272 # Recalculate the displayed fields and their widths.
272 # Recalculate the displayed fields and their widths.
273 # ``calcdisplayattrs()'' must have been called and the cache
273 # ``calcdisplayattrs()'' must have been called and the cache
274 # for attributes of the objects on screen (``self.displayrows``)
274 # for attributes of the objects on screen (``self.displayrows``)
275 # must have been filled. This sets ``self.colwidths`` which maps
275 # must have been filled. This sets ``self.colwidths`` which maps
276 # attribute descriptors to widths.
276 # attribute descriptors to widths.
277 self.colwidths = {}
277 self.colwidths = {}
278 for row in self.displayrows:
278 for row in self.displayrows:
279 for attr in self.displayattrs:
279 for attr in self.displayattrs:
280 try:
280 try:
281 length = row[attr][1]
281 length = row[attr][1]
282 except KeyError:
282 except KeyError:
283 length = 0
283 length = 0
284 # always add attribute to colwidths, even if it doesn't exist
284 # always add attribute to colwidths, even if it doesn't exist
285 if attr not in self.colwidths:
285 if attr not in self.colwidths:
286 self.colwidths[attr] = len(attr.name())
286 self.colwidths[attr] = len(attr.name())
287 newwidth = max(self.colwidths[attr], length)
287 newwidth = max(self.colwidths[attr], length)
288 self.colwidths[attr] = newwidth
288 self.colwidths[attr] = newwidth
289
289
290 # How many characters do we need to paint the largest item number?
290 # How many characters do we need to paint the largest item number?
291 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
291 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
292 # How must space have we got to display data?
292 # How must space have we got to display data?
293 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
293 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
294 # width of all columns
294 # width of all columns
295 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
295 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
296
296
297 def calcdisplayattr(self):
297 def calcdisplayattr(self):
298 # Find out which attribute the cursor is on and store this
298 # Find out which attribute the cursor is on and store this
299 # information in ``self.displayattr``.
299 # information in ``self.displayattr``.
300 pos = 0
300 pos = 0
301 for (i, attr) in enumerate(self.displayattrs):
301 for (i, attr) in enumerate(self.displayattrs):
302 if pos+self.colwidths[attr] >= self.curx:
302 if pos+self.colwidths[attr] >= self.curx:
303 self.displayattr = (i, attr)
303 self.displayattr = (i, attr)
304 break
304 break
305 pos += self.colwidths[attr]+1
305 pos += self.colwidths[attr]+1
306 else:
306 else:
307 self.displayattr = (None, ipipe.noitem)
307 self.displayattr = (None, ipipe.noitem)
308
308
309 def moveto(self, x, y, refresh=False):
309 def moveto(self, x, y, refresh=False):
310 # Move the cursor to the position ``(x,y)`` (in data coordinates,
310 # Move the cursor to the position ``(x,y)`` (in data coordinates,
311 # not in screen coordinates). If ``refresh`` is true, all cached
311 # not in screen coordinates). If ``refresh`` is true, all cached
312 # values will be recalculated (e.g. because the list has been
312 # values will be recalculated (e.g. because the list has been
313 # resorted, so screen positions etc. are no longer valid).
313 # resorted, so screen positions etc. are no longer valid).
314 olddatastarty = self.datastarty
314 olddatastarty = self.datastarty
315 oldx = self.curx
315 oldx = self.curx
316 oldy = self.cury
316 oldy = self.cury
317 x = int(x+0.5)
317 x = int(x+0.5)
318 y = int(y+0.5)
318 y = int(y+0.5)
319 newx = x # remember where we wanted to move
319 newx = x # remember where we wanted to move
320 newy = y # remember where we wanted to move
320 newy = y # remember where we wanted to move
321
321
322 scrollbordery = min(self.browser.scrollbordery, self.mainsizey//2)
322 scrollbordery = min(self.browser.scrollbordery, self.mainsizey//2)
323 scrollborderx = min(self.browser.scrollborderx, self.mainsizex//2)
323 scrollborderx = min(self.browser.scrollborderx, self.mainsizex//2)
324
324
325 # Make sure that the cursor didn't leave the main area vertically
325 # Make sure that the cursor didn't leave the main area vertically
326 if y < 0:
326 if y < 0:
327 y = 0
327 y = 0
328 # try to get enough items to fill the screen
328 # try to get enough items to fill the screen
329 self.fetch(max(y+scrollbordery+1, self.mainsizey))
329 self.fetch(max(y+scrollbordery+1, self.mainsizey))
330 if y >= len(self.items):
330 if y >= len(self.items):
331 y = max(0, len(self.items)-1)
331 y = max(0, len(self.items)-1)
332
332
333 # Make sure that the cursor stays on screen vertically
333 # Make sure that the cursor stays on screen vertically
334 if y < self.datastarty+scrollbordery:
334 if y < self.datastarty+scrollbordery:
335 self.datastarty = max(0, y-scrollbordery)
335 self.datastarty = max(0, y-scrollbordery)
336 elif y >= self.datastarty+self.mainsizey-scrollbordery:
336 elif y >= self.datastarty+self.mainsizey-scrollbordery:
337 self.datastarty = max(0, min(y-self.mainsizey+scrollbordery+1,
337 self.datastarty = max(0, min(y-self.mainsizey+scrollbordery+1,
338 len(self.items)-self.mainsizey))
338 len(self.items)-self.mainsizey))
339
339
340 if refresh: # Do we need to refresh the complete display?
340 if refresh: # Do we need to refresh the complete display?
341 self.calcdisplayattrs()
341 self.calcdisplayattrs()
342 endy = min(self.datastarty+self.mainsizey, len(self.items))
342 endy = min(self.datastarty+self.mainsizey, len(self.items))
343 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
343 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
344 self.calcwidths()
344 self.calcwidths()
345 # Did we scroll vertically => update displayrows
345 # Did we scroll vertically => update displayrows
346 # and various other attributes
346 # and various other attributes
347 elif self.datastarty != olddatastarty:
347 elif self.datastarty != olddatastarty:
348 # Recalculate which attributes we have to display
348 # Recalculate which attributes we have to display
349 olddisplayattrs = self.displayattrs
349 olddisplayattrs = self.displayattrs
350 self.calcdisplayattrs()
350 self.calcdisplayattrs()
351 # If there are new attributes, recreate the cache
351 # If there are new attributes, recreate the cache
352 if self.displayattrs != olddisplayattrs:
352 if self.displayattrs != olddisplayattrs:
353 endy = min(self.datastarty+self.mainsizey, len(self.items))
353 endy = min(self.datastarty+self.mainsizey, len(self.items))
354 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
354 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
355 elif self.datastarty<olddatastarty: # we did scroll up
355 elif self.datastarty<olddatastarty: # we did scroll up
356 # drop rows from the end
356 # drop rows from the end
357 del self.displayrows[self.datastarty-olddatastarty:]
357 del self.displayrows[self.datastarty-olddatastarty:]
358 # fetch new items
358 # fetch new items
359 for i in xrange(min(olddatastarty, self.datastarty+self.mainsizey)-1,
359 for i in xrange(min(olddatastarty, self.datastarty+self.mainsizey)-1,
360 self.datastarty-1, -1):
360 self.datastarty-1, -1):
361 try:
361 try:
362 row = self.getrow(i)
362 row = self.getrow(i)
363 except IndexError:
363 except IndexError:
364 # we didn't have enough objects to fill the screen
364 # we didn't have enough objects to fill the screen
365 break
365 break
366 self.displayrows.insert(0, row)
366 self.displayrows.insert(0, row)
367 else: # we did scroll down
367 else: # we did scroll down
368 # drop rows from the start
368 # drop rows from the start
369 del self.displayrows[:self.datastarty-olddatastarty]
369 del self.displayrows[:self.datastarty-olddatastarty]
370 # fetch new items
370 # fetch new items
371 for i in xrange(max(olddatastarty+self.mainsizey, self.datastarty),
371 for i in xrange(max(olddatastarty+self.mainsizey, self.datastarty),
372 self.datastarty+self.mainsizey):
372 self.datastarty+self.mainsizey):
373 try:
373 try:
374 row = self.getrow(i)
374 row = self.getrow(i)
375 except IndexError:
375 except IndexError:
376 # we didn't have enough objects to fill the screen
376 # we didn't have enough objects to fill the screen
377 break
377 break
378 self.displayrows.append(row)
378 self.displayrows.append(row)
379 self.calcwidths()
379 self.calcwidths()
380
380
381 # Make sure that the cursor didn't leave the data area horizontally
381 # Make sure that the cursor didn't leave the data area horizontally
382 if x < 0:
382 if x < 0:
383 x = 0
383 x = 0
384 elif x >= self.datasizex:
384 elif x >= self.datasizex:
385 x = max(0, self.datasizex-1)
385 x = max(0, self.datasizex-1)
386
386
387 # Make sure that the cursor stays on screen horizontally
387 # Make sure that the cursor stays on screen horizontally
388 if x < self.datastartx+scrollborderx:
388 if x < self.datastartx+scrollborderx:
389 self.datastartx = max(0, x-scrollborderx)
389 self.datastartx = max(0, x-scrollborderx)
390 elif x >= self.datastartx+self.mainsizex-scrollborderx:
390 elif x >= self.datastartx+self.mainsizex-scrollborderx:
391 self.datastartx = max(0, min(x-self.mainsizex+scrollborderx+1,
391 self.datastartx = max(0, min(x-self.mainsizex+scrollborderx+1,
392 self.datasizex-self.mainsizex))
392 self.datasizex-self.mainsizex))
393
393
394 if x == oldx and y == oldy and (x != newx or y != newy): # couldn't move
394 if x == oldx and y == oldy and (x != newx or y != newy): # couldn't move
395 self.browser.beep()
395 self.browser.beep()
396 else:
396 else:
397 self.curx = x
397 self.curx = x
398 self.cury = y
398 self.cury = y
399 self.calcdisplayattr()
399 self.calcdisplayattr()
400
400
401 def sort(self, key, reverse=False):
401 def sort(self, key, reverse=False):
402 """
402 """
403 Sort the currently list of items using the key function ``key``. If
403 Sort the currently list of items using the key function ``key``. If
404 ``reverse`` is true the sort order is reversed.
404 ``reverse`` is true the sort order is reversed.
405 """
405 """
406 curitem = self.items[self.cury] # Remember where the cursor is now
406 curitem = self.items[self.cury] # Remember where the cursor is now
407
407
408 # Sort items
408 # Sort items
409 def realkey(item):
409 def realkey(item):
410 return key(item.item)
410 return key(item.item)
411 self.items = ipipe.deque(sorted(self.items, key=realkey, reverse=reverse))
411 self.items = ipipe.deque(sorted(self.items, key=realkey, reverse=reverse))
412
412
413 # Find out where the object under the cursor went
413 # Find out where the object under the cursor went
414 cury = self.cury
414 cury = self.cury
415 for (i, item) in enumerate(self.items):
415 for (i, item) in enumerate(self.items):
416 if item is curitem:
416 if item is curitem:
417 cury = i
417 cury = i
418 break
418 break
419
419
420 self.moveto(self.curx, cury, refresh=True)
420 self.moveto(self.curx, cury, refresh=True)
421
421
422 def refresh(self):
422 def refresh(self):
423 """
423 """
424 Restart iterating the input.
424 Restart iterating the input.
425 """
425 """
426 self.iterator = ipipe.xiter(self.input)
426 self.iterator = ipipe.xiter(self.input)
427 self.items.clear()
427 self.items.clear()
428 self.exhausted = False
428 self.exhausted = False
429 self.datastartx = self.datastarty = 0
429 self.datastartx = self.datastarty = 0
430 self.moveto(0, 0, refresh=True)
430 self.moveto(0, 0, refresh=True)
431
431
432 def refreshfind(self):
432 def refreshfind(self):
433 """
433 """
434 Restart iterating the input and go back to the same object as before
434 Restart iterating the input and go back to the same object as before
435 (if it can be found in the new iterator).
435 (if it can be found in the new iterator).
436 """
436 """
437 try:
437 try:
438 oldobject = self.items[self.cury].item
438 oldobject = self.items[self.cury].item
439 except IndexError:
439 except IndexError:
440 oldobject = ipipe.noitem
440 oldobject = ipipe.noitem
441 self.iterator = ipipe.xiter(self.input)
441 self.iterator = ipipe.xiter(self.input)
442 self.items.clear()
442 self.items.clear()
443 self.exhausted = False
443 self.exhausted = False
444 while True:
444 while True:
445 self.fetch(len(self.items)+1)
445 self.fetch(len(self.items)+1)
446 if self.exhausted:
446 if self.exhausted:
447 curses.beep()
447 curses.beep()
448 self.datastartx = self.datastarty = 0
448 self.datastartx = self.datastarty = 0
449 self.moveto(self.curx, 0, refresh=True)
449 self.moveto(self.curx, 0, refresh=True)
450 break
450 break
451 if self.items[-1].item == oldobject:
451 if self.items[-1].item == oldobject:
452 self.datastartx = self.datastarty = 0
452 self.datastartx = self.datastarty = 0
453 self.moveto(self.curx, len(self.items)-1, refresh=True)
453 self.moveto(self.curx, len(self.items)-1, refresh=True)
454 break
454 break
455
455
456
456
457 class _CommandInput(object):
457 class _CommandInput(object):
458 keymap = Keymap()
458 keymap = Keymap()
459 keymap.register("left", curses.KEY_LEFT)
459 keymap.register("left", curses.KEY_LEFT)
460 keymap.register("right", curses.KEY_RIGHT)
460 keymap.register("right", curses.KEY_RIGHT)
461 keymap.register("home", curses.KEY_HOME, "\x01") # Ctrl-A
461 keymap.register("home", curses.KEY_HOME, "\x01") # Ctrl-A
462 keymap.register("end", curses.KEY_END, "\x05") # Ctrl-E
462 keymap.register("end", curses.KEY_END, "\x05") # Ctrl-E
463 # FIXME: What's happening here?
463 # FIXME: What's happening here?
464 keymap.register("backspace", curses.KEY_BACKSPACE, "\x08\x7f")
464 keymap.register("backspace", curses.KEY_BACKSPACE, "\x08\x7f")
465 keymap.register("delete", curses.KEY_DC)
465 keymap.register("delete", curses.KEY_DC)
466 keymap.register("delend", 0x0b) # Ctrl-K
466 keymap.register("delend", 0x0b) # Ctrl-K
467 keymap.register("execute", "\r\n")
467 keymap.register("execute", "\r\n")
468 keymap.register("up", curses.KEY_UP)
468 keymap.register("up", curses.KEY_UP)
469 keymap.register("down", curses.KEY_DOWN)
469 keymap.register("down", curses.KEY_DOWN)
470 keymap.register("incsearchup", curses.KEY_PPAGE)
470 keymap.register("incsearchup", curses.KEY_PPAGE)
471 keymap.register("incsearchdown", curses.KEY_NPAGE)
471 keymap.register("incsearchdown", curses.KEY_NPAGE)
472 keymap.register("exit", "\x18"), # Ctrl-X
472 keymap.register("exit", "\x18"), # Ctrl-X
473
473
474 def __init__(self, prompt):
474 def __init__(self, prompt):
475 self.prompt = prompt
475 self.prompt = prompt
476 self.history = []
476 self.history = []
477 self.maxhistory = 100
477 self.maxhistory = 100
478 self.input = ""
478 self.input = ""
479 self.curx = 0
479 self.curx = 0
480 self.cury = -1 # blank line
480 self.cury = -1 # blank line
481
481
482 def start(self):
482 def start(self):
483 self.input = ""
483 self.input = ""
484 self.curx = 0
484 self.curx = 0
485 self.cury = -1 # blank line
485 self.cury = -1 # blank line
486
486
487 def handlekey(self, browser, key):
487 def handlekey(self, browser, key):
488 cmdname = self.keymap.get(key, None)
488 cmdname = self.keymap.get(key, None)
489 if cmdname is not None:
489 if cmdname is not None:
490 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
490 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
491 if cmdfunc is not None:
491 if cmdfunc is not None:
492 return cmdfunc(browser)
492 return cmdfunc(browser)
493 curses.beep()
493 curses.beep()
494 elif key != -1:
494 elif key != -1:
495 try:
495 try:
496 char = chr(key)
496 char = chr(key)
497 except ValueError:
497 except ValueError:
498 curses.beep()
498 curses.beep()
499 else:
499 else:
500 return self.handlechar(browser, char)
500 return self.handlechar(browser, char)
501
501
502 def handlechar(self, browser, char):
502 def handlechar(self, browser, char):
503 self.input = self.input[:self.curx] + char + self.input[self.curx:]
503 self.input = self.input[:self.curx] + char + self.input[self.curx:]
504 self.curx += 1
504 self.curx += 1
505 return True
505 return True
506
506
507 def dohistory(self):
507 def dohistory(self):
508 self.history.insert(0, self.input)
508 self.history.insert(0, self.input)
509 del self.history[:-self.maxhistory]
509 del self.history[:-self.maxhistory]
510
510
511 def cmd_backspace(self, browser):
511 def cmd_backspace(self, browser):
512 if self.curx:
512 if self.curx:
513 self.input = self.input[:self.curx-1] + self.input[self.curx:]
513 self.input = self.input[:self.curx-1] + self.input[self.curx:]
514 self.curx -= 1
514 self.curx -= 1
515 return True
515 return True
516 else:
516 else:
517 curses.beep()
517 curses.beep()
518
518
519 def cmd_delete(self, browser):
519 def cmd_delete(self, browser):
520 if self.curx<len(self.input):
520 if self.curx<len(self.input):
521 self.input = self.input[:self.curx] + self.input[self.curx+1:]
521 self.input = self.input[:self.curx] + self.input[self.curx+1:]
522 return True
522 return True
523 else:
523 else:
524 curses.beep()
524 curses.beep()
525
525
526 def cmd_delend(self, browser):
526 def cmd_delend(self, browser):
527 if self.curx<len(self.input):
527 if self.curx<len(self.input):
528 self.input = self.input[:self.curx]
528 self.input = self.input[:self.curx]
529 return True
529 return True
530
530
531 def cmd_left(self, browser):
531 def cmd_left(self, browser):
532 if self.curx:
532 if self.curx:
533 self.curx -= 1
533 self.curx -= 1
534 return True
534 return True
535 else:
535 else:
536 curses.beep()
536 curses.beep()
537
537
538 def cmd_right(self, browser):
538 def cmd_right(self, browser):
539 if self.curx < len(self.input):
539 if self.curx < len(self.input):
540 self.curx += 1
540 self.curx += 1
541 return True
541 return True
542 else:
542 else:
543 curses.beep()
543 curses.beep()
544
544
545 def cmd_home(self, browser):
545 def cmd_home(self, browser):
546 if self.curx:
546 if self.curx:
547 self.curx = 0
547 self.curx = 0
548 return True
548 return True
549 else:
549 else:
550 curses.beep()
550 curses.beep()
551
551
552 def cmd_end(self, browser):
552 def cmd_end(self, browser):
553 if self.curx < len(self.input):
553 if self.curx < len(self.input):
554 self.curx = len(self.input)
554 self.curx = len(self.input)
555 return True
555 return True
556 else:
556 else:
557 curses.beep()
557 curses.beep()
558
558
559 def cmd_up(self, browser):
559 def cmd_up(self, browser):
560 if self.cury < len(self.history)-1:
560 if self.cury < len(self.history)-1:
561 self.cury += 1
561 self.cury += 1
562 self.input = self.history[self.cury]
562 self.input = self.history[self.cury]
563 self.curx = len(self.input)
563 self.curx = len(self.input)
564 return True
564 return True
565 else:
565 else:
566 curses.beep()
566 curses.beep()
567
567
568 def cmd_down(self, browser):
568 def cmd_down(self, browser):
569 if self.cury >= 0:
569 if self.cury >= 0:
570 self.cury -= 1
570 self.cury -= 1
571 if self.cury>=0:
571 if self.cury>=0:
572 self.input = self.history[self.cury]
572 self.input = self.history[self.cury]
573 else:
573 else:
574 self.input = ""
574 self.input = ""
575 self.curx = len(self.input)
575 self.curx = len(self.input)
576 return True
576 return True
577 else:
577 else:
578 curses.beep()
578 curses.beep()
579
579
580 def cmd_incsearchup(self, browser):
580 def cmd_incsearchup(self, browser):
581 prefix = self.input[:self.curx]
581 prefix = self.input[:self.curx]
582 cury = self.cury
582 cury = self.cury
583 while True:
583 while True:
584 cury += 1
584 cury += 1
585 if cury >= len(self.history):
585 if cury >= len(self.history):
586 break
586 break
587 if self.history[cury].startswith(prefix):
587 if self.history[cury].startswith(prefix):
588 self.input = self.history[cury]
588 self.input = self.history[cury]
589 self.cury = cury
589 self.cury = cury
590 return True
590 return True
591 curses.beep()
591 curses.beep()
592
592
593 def cmd_incsearchdown(self, browser):
593 def cmd_incsearchdown(self, browser):
594 prefix = self.input[:self.curx]
594 prefix = self.input[:self.curx]
595 cury = self.cury
595 cury = self.cury
596 while True:
596 while True:
597 cury -= 1
597 cury -= 1
598 if cury <= 0:
598 if cury <= 0:
599 break
599 break
600 if self.history[cury].startswith(prefix):
600 if self.history[cury].startswith(prefix):
601 self.input = self.history[self.cury]
601 self.input = self.history[self.cury]
602 self.cury = cury
602 self.cury = cury
603 return True
603 return True
604 curses.beep()
604 curses.beep()
605
605
606 def cmd_exit(self, browser):
606 def cmd_exit(self, browser):
607 browser.mode = "default"
607 browser.mode = "default"
608 return True
608 return True
609
609
610 def cmd_execute(self, browser):
610 def cmd_execute(self, browser):
611 raise NotImplementedError
611 raise NotImplementedError
612
612
613
613
614 class _CommandGoto(_CommandInput):
614 class _CommandGoto(_CommandInput):
615 def __init__(self):
615 def __init__(self):
616 _CommandInput.__init__(self, "goto object #")
616 _CommandInput.__init__(self, "goto object #")
617
617
618 def handlechar(self, browser, char):
618 def handlechar(self, browser, char):
619 # Only accept digits
619 # Only accept digits
620 if not "0" <= char <= "9":
620 if not "0" <= char <= "9":
621 curses.beep()
621 curses.beep()
622 else:
622 else:
623 return _CommandInput.handlechar(self, browser, char)
623 return _CommandInput.handlechar(self, browser, char)
624
624
625 def cmd_execute(self, browser):
625 def cmd_execute(self, browser):
626 level = browser.levels[-1]
626 level = browser.levels[-1]
627 if self.input:
627 if self.input:
628 self.dohistory()
628 self.dohistory()
629 level.moveto(level.curx, int(self.input))
629 level.moveto(level.curx, int(self.input))
630 browser.mode = "default"
630 browser.mode = "default"
631 return True
631 return True
632
632
633
633
634 class _CommandFind(_CommandInput):
634 class _CommandFind(_CommandInput):
635 def __init__(self):
635 def __init__(self):
636 _CommandInput.__init__(self, "find expression")
636 _CommandInput.__init__(self, "find expression")
637
637
638 def cmd_execute(self, browser):
638 def cmd_execute(self, browser):
639 level = browser.levels[-1]
639 level = browser.levels[-1]
640 if self.input:
640 if self.input:
641 self.dohistory()
641 self.dohistory()
642 while True:
642 while True:
643 cury = level.cury
643 cury = level.cury
644 level.moveto(level.curx, cury+1)
644 level.moveto(level.curx, cury+1)
645 if cury == level.cury:
645 if cury == level.cury:
646 curses.beep()
646 curses.beep()
647 break # hit end
647 break # hit end
648 item = level.items[level.cury].item
648 item = level.items[level.cury].item
649 try:
649 try:
650 globals = ipipe.getglobals(None)
650 globals = ipipe.getglobals(None)
651 if eval(self.input, globals, ipipe.AttrNamespace(item)):
651 if eval(self.input, globals, ipipe.AttrNamespace(item)):
652 break # found something
652 break # found something
653 except (KeyboardInterrupt, SystemExit):
653 except (KeyboardInterrupt, SystemExit):
654 raise
654 raise
655 except Exception, exc:
655 except Exception, exc:
656 browser.report(exc)
656 browser.report(exc)
657 curses.beep()
657 curses.beep()
658 break # break on error
658 break # break on error
659 browser.mode = "default"
659 browser.mode = "default"
660 return True
660 return True
661
661
662
662
663 class _CommandFindBackwards(_CommandInput):
663 class _CommandFindBackwards(_CommandInput):
664 def __init__(self):
664 def __init__(self):
665 _CommandInput.__init__(self, "find backwards expression")
665 _CommandInput.__init__(self, "find backwards expression")
666
666
667 def cmd_execute(self, browser):
667 def cmd_execute(self, browser):
668 level = browser.levels[-1]
668 level = browser.levels[-1]
669 if self.input:
669 if self.input:
670 self.dohistory()
670 self.dohistory()
671 while level.cury:
671 while level.cury:
672 level.moveto(level.curx, level.cury-1)
672 level.moveto(level.curx, level.cury-1)
673 item = level.items[level.cury].item
673 item = level.items[level.cury].item
674 try:
674 try:
675 globals = ipipe.getglobals(None)
675 globals = ipipe.getglobals(None)
676 if eval(self.input, globals, ipipe.AttrNamespace(item)):
676 if eval(self.input, globals, ipipe.AttrNamespace(item)):
677 break # found something
677 break # found something
678 except (KeyboardInterrupt, SystemExit):
678 except (KeyboardInterrupt, SystemExit):
679 raise
679 raise
680 except Exception, exc:
680 except Exception, exc:
681 browser.report(exc)
681 browser.report(exc)
682 curses.beep()
682 curses.beep()
683 break # break on error
683 break # break on error
684 else:
684 else:
685 curses.beep()
685 curses.beep()
686 browser.mode = "default"
686 browser.mode = "default"
687 return True
687 return True
688
688
689
689
690 class ibrowse(ipipe.Display):
690 class ibrowse(ipipe.Display):
691 # Show this many lines from the previous screen when paging horizontally
691 # Show this many lines from the previous screen when paging horizontally
692 pageoverlapx = 1
692 pageoverlapx = 1
693
693
694 # Show this many lines from the previous screen when paging vertically
694 # Show this many lines from the previous screen when paging vertically
695 pageoverlapy = 1
695 pageoverlapy = 1
696
696
697 # Start scrolling when the cursor is less than this number of columns
697 # Start scrolling when the cursor is less than this number of columns
698 # away from the left or right screen edge
698 # away from the left or right screen edge
699 scrollborderx = 10
699 scrollborderx = 10
700
700
701 # Start scrolling when the cursor is less than this number of lines
701 # Start scrolling when the cursor is less than this number of lines
702 # away from the top or bottom screen edge
702 # away from the top or bottom screen edge
703 scrollbordery = 5
703 scrollbordery = 5
704
704
705 # Accelerate by this factor when scrolling horizontally
705 # Accelerate by this factor when scrolling horizontally
706 acceleratex = 1.05
706 acceleratex = 1.05
707
707
708 # Accelerate by this factor when scrolling vertically
708 # Accelerate by this factor when scrolling vertically
709 acceleratey = 1.05
709 acceleratey = 1.05
710
710
711 # The maximum horizontal scroll speed
711 # The maximum horizontal scroll speed
712 # (as a factor of the screen width (i.e. 0.5 == half a screen width)
712 # (as a factor of the screen width (i.e. 0.5 == half a screen width)
713 maxspeedx = 0.5
713 maxspeedx = 0.5
714
714
715 # The maximum vertical scroll speed
715 # The maximum vertical scroll speed
716 # (as a factor of the screen height (i.e. 0.5 == half a screen height)
716 # (as a factor of the screen height (i.e. 0.5 == half a screen height)
717 maxspeedy = 0.5
717 maxspeedy = 0.5
718
718
719 # The maximum number of header lines for browser level
719 # The maximum number of header lines for browser level
720 # if the nesting is deeper, only the innermost levels are displayed
720 # if the nesting is deeper, only the innermost levels are displayed
721 maxheaders = 5
721 maxheaders = 5
722
722
723 # The approximate maximum length of a column entry
723 # The approximate maximum length of a column entry
724 maxattrlength = 200
724 maxattrlength = 200
725
725
726 # Styles for various parts of the GUI
726 # Styles for various parts of the GUI
727 style_objheadertext = astyle.Style.fromstr("white:black:bold|reverse")
727 style_objheadertext = astyle.Style.fromstr("white:black:bold|reverse")
728 style_objheadernumber = astyle.Style.fromstr("white:blue:bold|reverse")
728 style_objheadernumber = astyle.Style.fromstr("white:blue:bold|reverse")
729 style_objheaderobject = astyle.Style.fromstr("white:black:reverse")
729 style_objheaderobject = astyle.Style.fromstr("white:black:reverse")
730 style_colheader = astyle.Style.fromstr("blue:white:reverse")
730 style_colheader = astyle.Style.fromstr("blue:white:reverse")
731 style_colheaderhere = astyle.Style.fromstr("green:black:bold|reverse")
731 style_colheaderhere = astyle.Style.fromstr("green:black:bold|reverse")
732 style_colheadersep = astyle.Style.fromstr("blue:black:reverse")
732 style_colheadersep = astyle.Style.fromstr("blue:black:reverse")
733 style_number = astyle.Style.fromstr("blue:white:reverse")
733 style_number = astyle.Style.fromstr("blue:white:reverse")
734 style_numberhere = astyle.Style.fromstr("green:black:bold|reverse")
734 style_numberhere = astyle.Style.fromstr("green:black:bold|reverse")
735 style_sep = astyle.Style.fromstr("blue:black")
735 style_sep = astyle.Style.fromstr("blue:black")
736 style_data = astyle.Style.fromstr("white:black")
736 style_data = astyle.Style.fromstr("white:black")
737 style_datapad = astyle.Style.fromstr("blue:black:bold")
737 style_datapad = astyle.Style.fromstr("blue:black:bold")
738 style_footer = astyle.Style.fromstr("black:white")
738 style_footer = astyle.Style.fromstr("black:white")
739 style_report = astyle.Style.fromstr("white:black")
739 style_report = astyle.Style.fromstr("white:black")
740
740
741 # Column separator in header
741 # Column separator in header
742 headersepchar = "|"
742 headersepchar = "|"
743
743
744 # Character for padding data cell entries
744 # Character for padding data cell entries
745 datapadchar = "."
745 datapadchar = "."
746
746
747 # Column separator in data area
747 # Column separator in data area
748 datasepchar = "|"
748 datasepchar = "|"
749
749
750 # Character to use for "empty" cell (i.e. for non-existing attributes)
750 # Character to use for "empty" cell (i.e. for non-existing attributes)
751 nodatachar = "-"
751 nodatachar = "-"
752
752
753 # Prompts for modes that require keyboard input
753 # Prompts for modes that require keyboard input
754 prompts = {
754 prompts = {
755 "goto": _CommandGoto(),
755 "goto": _CommandGoto(),
756 "find": _CommandFind(),
756 "find": _CommandFind(),
757 "findbackwards": _CommandFindBackwards()
757 "findbackwards": _CommandFindBackwards()
758 }
758 }
759
759
760 # Maps curses key codes to "function" names
760 # Maps curses key codes to "function" names
761 keymap = Keymap()
761 keymap = Keymap()
762 keymap.register("quit", "q")
762 keymap.register("quit", "q")
763 keymap.register("up", curses.KEY_UP)
763 keymap.register("up", curses.KEY_UP)
764 keymap.register("down", curses.KEY_DOWN)
764 keymap.register("down", curses.KEY_DOWN)
765 keymap.register("pageup", curses.KEY_PPAGE)
765 keymap.register("pageup", curses.KEY_PPAGE)
766 keymap.register("pagedown", curses.KEY_NPAGE)
766 keymap.register("pagedown", curses.KEY_NPAGE)
767 keymap.register("left", curses.KEY_LEFT)
767 keymap.register("left", curses.KEY_LEFT)
768 keymap.register("right", curses.KEY_RIGHT)
768 keymap.register("right", curses.KEY_RIGHT)
769 keymap.register("home", curses.KEY_HOME, "\x01")
769 keymap.register("home", curses.KEY_HOME, "\x01")
770 keymap.register("end", curses.KEY_END, "\x05")
770 keymap.register("end", curses.KEY_END, "\x05")
771 keymap.register("prevattr", "<\x1b")
771 keymap.register("prevattr", "<\x1b")
772 keymap.register("nextattr", ">\t")
772 keymap.register("nextattr", ">\t")
773 keymap.register("pick", "p")
773 keymap.register("pick", "p")
774 keymap.register("pickattr", "P")
774 keymap.register("pickattr", "P")
775 keymap.register("pickallattrs", "C")
775 keymap.register("pickallattrs", "C")
776 keymap.register("pickmarked", "m")
776 keymap.register("pickmarked", "m")
777 keymap.register("pickmarkedattr", "M")
777 keymap.register("pickmarkedattr", "M")
778 keymap.register("pickinput", "i")
778 keymap.register("pickinput", "i")
779 keymap.register("pickinputattr", "I")
779 keymap.register("pickinputattr", "I")
780 keymap.register("hideattr", "h")
780 keymap.register("hideattr", "h")
781 keymap.register("unhideattrs", "H")
781 keymap.register("unhideattrs", "H")
782 keymap.register("help", "?")
782 keymap.register("help", "?")
783 keymap.register("enter", "\r\n")
783 keymap.register("enter", "\r\n")
784 keymap.register("enterattr", "E")
784 keymap.register("enterattr", "E")
785 # FIXME: What's happening here?
785 # FIXME: What's happening here?
786 keymap.register("leave", curses.KEY_BACKSPACE, "x\x08\x7f")
786 keymap.register("leave", curses.KEY_BACKSPACE, "x\x08\x7f")
787 keymap.register("detail", "d")
787 keymap.register("detail", "d")
788 keymap.register("detailattr", "D")
788 keymap.register("detailattr", "D")
789 keymap.register("tooglemark", " ")
789 keymap.register("tooglemark", " ")
790 keymap.register("markrange", "%")
790 keymap.register("markrange", "%")
791 keymap.register("sortattrasc", "v")
791 keymap.register("sortattrasc", "v")
792 keymap.register("sortattrdesc", "V")
792 keymap.register("sortattrdesc", "V")
793 keymap.register("goto", "g")
793 keymap.register("goto", "g")
794 keymap.register("find", "f")
794 keymap.register("find", "f")
795 keymap.register("findbackwards", "b")
795 keymap.register("findbackwards", "b")
796 keymap.register("refresh", "r")
796 keymap.register("refresh", "r")
797 keymap.register("refreshfind", "R")
797 keymap.register("refreshfind", "R")
798
798
799 def __init__(self, input=None, attrs=None):
799 def __init__(self, input=None, *attrs):
800 """
800 """
801 Create a new browser. If ``attrs`` is not empty, it is the list
801 Create a new browser. If ``attrs`` is not empty, it is the list
802 of attributes that will be displayed in the browser, otherwise
802 of attributes that will be displayed in the browser, otherwise
803 these will be determined by the objects on screen.
803 these will be determined by the objects on screen.
804 """
804 """
805 self.input = input
805 ipipe.Display.__init__(self, input)
806
806
807 if attrs is None:
808 attrs = ()
809 self.attrs = attrs
807 self.attrs = attrs
810
808
811 # Stack of browser levels
809 # Stack of browser levels
812 self.levels = []
810 self.levels = []
813 # how many colums to scroll (Changes when accelerating)
811 # how many colums to scroll (Changes when accelerating)
814 self.stepx = 1.
812 self.stepx = 1.
815
813
816 # how many rows to scroll (Changes when accelerating)
814 # how many rows to scroll (Changes when accelerating)
817 self.stepy = 1.
815 self.stepy = 1.
818
816
819 # Beep on the edges of the data area? (Will be set to ``False``
817 # Beep on the edges of the data area? (Will be set to ``False``
820 # once the cursor hits the edge of the screen, so we don't get
818 # once the cursor hits the edge of the screen, so we don't get
821 # multiple beeps).
819 # multiple beeps).
822 self._dobeep = True
820 self._dobeep = True
823
821
824 # Cache for registered ``curses`` colors and styles.
822 # Cache for registered ``curses`` colors and styles.
825 self._styles = {}
823 self._styles = {}
826 self._colors = {}
824 self._colors = {}
827 self._maxcolor = 1
825 self._maxcolor = 1
828
826
829 # How many header lines do we want to paint (the numbers of levels
827 # How many header lines do we want to paint (the numbers of levels
830 # we have, but with an upper bound)
828 # we have, but with an upper bound)
831 self._headerlines = 1
829 self._headerlines = 1
832
830
833 # Index of first header line
831 # Index of first header line
834 self._firstheaderline = 0
832 self._firstheaderline = 0
835
833
836 # curses window
834 # curses window
837 self.scr = None
835 self.scr = None
838 # report in the footer line (error, executed command etc.)
836 # report in the footer line (error, executed command etc.)
839 self._report = None
837 self._report = None
840
838
841 # value to be returned to the caller (set by commands)
839 # value to be returned to the caller (set by commands)
842 self.returnvalue = None
840 self.returnvalue = None
843
841
844 # The mode the browser is in
842 # The mode the browser is in
845 # e.g. normal browsing or entering an argument for a command
843 # e.g. normal browsing or entering an argument for a command
846 self.mode = "default"
844 self.mode = "default"
847
845
848 # set by the SIGWINCH signal handler
846 # set by the SIGWINCH signal handler
849 self.resized = False
847 self.resized = False
850
848
851 def nextstepx(self, step):
849 def nextstepx(self, step):
852 """
850 """
853 Accelerate horizontally.
851 Accelerate horizontally.
854 """
852 """
855 return max(1., min(step*self.acceleratex,
853 return max(1., min(step*self.acceleratex,
856 self.maxspeedx*self.levels[-1].mainsizex))
854 self.maxspeedx*self.levels[-1].mainsizex))
857
855
858 def nextstepy(self, step):
856 def nextstepy(self, step):
859 """
857 """
860 Accelerate vertically.
858 Accelerate vertically.
861 """
859 """
862 return max(1., min(step*self.acceleratey,
860 return max(1., min(step*self.acceleratey,
863 self.maxspeedy*self.levels[-1].mainsizey))
861 self.maxspeedy*self.levels[-1].mainsizey))
864
862
865 def getstyle(self, style):
863 def getstyle(self, style):
866 """
864 """
867 Register the ``style`` with ``curses`` or get it from the cache,
865 Register the ``style`` with ``curses`` or get it from the cache,
868 if it has been registered before.
866 if it has been registered before.
869 """
867 """
870 try:
868 try:
871 return self._styles[style.fg, style.bg, style.attrs]
869 return self._styles[style.fg, style.bg, style.attrs]
872 except KeyError:
870 except KeyError:
873 attrs = 0
871 attrs = 0
874 for b in astyle.A2CURSES:
872 for b in astyle.A2CURSES:
875 if style.attrs & b:
873 if style.attrs & b:
876 attrs |= astyle.A2CURSES[b]
874 attrs |= astyle.A2CURSES[b]
877 try:
875 try:
878 color = self._colors[style.fg, style.bg]
876 color = self._colors[style.fg, style.bg]
879 except KeyError:
877 except KeyError:
880 curses.init_pair(
878 curses.init_pair(
881 self._maxcolor,
879 self._maxcolor,
882 astyle.COLOR2CURSES[style.fg],
880 astyle.COLOR2CURSES[style.fg],
883 astyle.COLOR2CURSES[style.bg]
881 astyle.COLOR2CURSES[style.bg]
884 )
882 )
885 color = curses.color_pair(self._maxcolor)
883 color = curses.color_pair(self._maxcolor)
886 self._colors[style.fg, style.bg] = color
884 self._colors[style.fg, style.bg] = color
887 self._maxcolor += 1
885 self._maxcolor += 1
888 c = color | attrs
886 c = color | attrs
889 self._styles[style.fg, style.bg, style.attrs] = c
887 self._styles[style.fg, style.bg, style.attrs] = c
890 return c
888 return c
891
889
892 def addstr(self, y, x, begx, endx, text, style):
890 def addstr(self, y, x, begx, endx, text, style):
893 """
891 """
894 A version of ``curses.addstr()`` that can handle ``x`` coordinates
892 A version of ``curses.addstr()`` that can handle ``x`` coordinates
895 that are outside the screen.
893 that are outside the screen.
896 """
894 """
897 text2 = text[max(0, begx-x):max(0, endx-x)]
895 text2 = text[max(0, begx-x):max(0, endx-x)]
898 if text2:
896 if text2:
899 self.scr.addstr(y, max(x, begx), text2, self.getstyle(style))
897 self.scr.addstr(y, max(x, begx), text2, self.getstyle(style))
900 return len(text)
898 return len(text)
901
899
902 def addchr(self, y, x, begx, endx, c, l, style):
900 def addchr(self, y, x, begx, endx, c, l, style):
903 x0 = max(x, begx)
901 x0 = max(x, begx)
904 x1 = min(x+l, endx)
902 x1 = min(x+l, endx)
905 if x1>x0:
903 if x1>x0:
906 self.scr.addstr(y, x0, c*(x1-x0), self.getstyle(style))
904 self.scr.addstr(y, x0, c*(x1-x0), self.getstyle(style))
907 return l
905 return l
908
906
909 def _calcheaderlines(self, levels):
907 def _calcheaderlines(self, levels):
910 # Calculate how many headerlines do we have to display, if we have
908 # Calculate how many headerlines do we have to display, if we have
911 # ``levels`` browser levels
909 # ``levels`` browser levels
912 if levels is None:
910 if levels is None:
913 levels = len(self.levels)
911 levels = len(self.levels)
914 self._headerlines = min(self.maxheaders, levels)
912 self._headerlines = min(self.maxheaders, levels)
915 self._firstheaderline = levels-self._headerlines
913 self._firstheaderline = levels-self._headerlines
916
914
917 def getstylehere(self, style):
915 def getstylehere(self, style):
918 """
916 """
919 Return a style for displaying the original style ``style``
917 Return a style for displaying the original style ``style``
920 in the row the cursor is on.
918 in the row the cursor is on.
921 """
919 """
922 return astyle.Style(style.fg, astyle.COLOR_BLUE, style.attrs | astyle.A_BOLD)
920 return astyle.Style(style.fg, astyle.COLOR_BLUE, style.attrs | astyle.A_BOLD)
923
921
924 def report(self, msg):
922 def report(self, msg):
925 """
923 """
926 Store the message ``msg`` for display below the footer line. This
924 Store the message ``msg`` for display below the footer line. This
927 will be displayed as soon as the screen is redrawn.
925 will be displayed as soon as the screen is redrawn.
928 """
926 """
929 self._report = msg
927 self._report = msg
930
928
931 def enter(self, item, *attrs):
929 def enter(self, item, *attrs):
932 """
930 """
933 Enter the object ``item``. If ``attrs`` is specified, it will be used
931 Enter the object ``item``. If ``attrs`` is specified, it will be used
934 as a fixed list of attributes to display.
932 as a fixed list of attributes to display.
935 """
933 """
936 if self.levels and item is self.levels[-1].input:
934 if self.levels and item is self.levels[-1].input:
937 curses.beep()
935 curses.beep()
938 self.report(CommandError("Recursion on input object"))
936 self.report(CommandError("Recursion on input object"))
939 else:
937 else:
940 oldlevels = len(self.levels)
938 oldlevels = len(self.levels)
941 self._calcheaderlines(oldlevels+1)
939 self._calcheaderlines(oldlevels+1)
942 try:
940 try:
943 level = _BrowserLevel(
941 level = _BrowserLevel(
944 self,
942 self,
945 item,
943 item,
946 self.scrsizey-1-self._headerlines-2,
944 self.scrsizey-1-self._headerlines-2,
947 *attrs
945 *attrs
948 )
946 )
949 except (KeyboardInterrupt, SystemExit):
947 except (KeyboardInterrupt, SystemExit):
950 raise
948 raise
951 except Exception, exc:
949 except Exception, exc:
952 if not self.levels:
950 if not self.levels:
953 raise
951 raise
954 self._calcheaderlines(oldlevels)
952 self._calcheaderlines(oldlevels)
955 curses.beep()
953 curses.beep()
956 self.report(exc)
954 self.report(exc)
957 else:
955 else:
958 self.levels.append(level)
956 self.levels.append(level)
959
957
960 def startkeyboardinput(self, mode):
958 def startkeyboardinput(self, mode):
961 """
959 """
962 Enter mode ``mode``, which requires keyboard input.
960 Enter mode ``mode``, which requires keyboard input.
963 """
961 """
964 self.mode = mode
962 self.mode = mode
965 self.prompts[mode].start()
963 self.prompts[mode].start()
966
964
967 def keylabel(self, keycode):
965 def keylabel(self, keycode):
968 """
966 """
969 Return a pretty name for the ``curses`` key ``keycode`` (used in the
967 Return a pretty name for the ``curses`` key ``keycode`` (used in the
970 help screen and in reports about unassigned keys).
968 help screen and in reports about unassigned keys).
971 """
969 """
972 if keycode <= 0xff:
970 if keycode <= 0xff:
973 specialsnames = {
971 specialsnames = {
974 ord("\n"): "RETURN",
972 ord("\n"): "RETURN",
975 ord(" "): "SPACE",
973 ord(" "): "SPACE",
976 ord("\t"): "TAB",
974 ord("\t"): "TAB",
977 ord("\x7f"): "DELETE",
975 ord("\x7f"): "DELETE",
978 ord("\x08"): "BACKSPACE",
976 ord("\x08"): "BACKSPACE",
979 }
977 }
980 if keycode in specialsnames:
978 if keycode in specialsnames:
981 return specialsnames[keycode]
979 return specialsnames[keycode]
982 elif 0x00 < keycode < 0x20:
980 elif 0x00 < keycode < 0x20:
983 return "CTRL-%s" % chr(keycode + 64)
981 return "CTRL-%s" % chr(keycode + 64)
984 return repr(chr(keycode))
982 return repr(chr(keycode))
985 for name in dir(curses):
983 for name in dir(curses):
986 if name.startswith("KEY_") and getattr(curses, name) == keycode:
984 if name.startswith("KEY_") and getattr(curses, name) == keycode:
987 return name
985 return name
988 return str(keycode)
986 return str(keycode)
989
987
990 def beep(self, force=False):
988 def beep(self, force=False):
991 if force or self._dobeep:
989 if force or self._dobeep:
992 curses.beep()
990 curses.beep()
993 # don't beep again (as long as the same key is pressed)
991 # don't beep again (as long as the same key is pressed)
994 self._dobeep = False
992 self._dobeep = False
995
993
996 def cmd_up(self):
994 def cmd_up(self):
997 """
995 """
998 Move the cursor to the previous row.
996 Move the cursor to the previous row.
999 """
997 """
1000 level = self.levels[-1]
998 level = self.levels[-1]
1001 self.report("up")
999 self.report("up")
1002 level.moveto(level.curx, level.cury-self.stepy)
1000 level.moveto(level.curx, level.cury-self.stepy)
1003
1001
1004 def cmd_down(self):
1002 def cmd_down(self):
1005 """
1003 """
1006 Move the cursor to the next row.
1004 Move the cursor to the next row.
1007 """
1005 """
1008 level = self.levels[-1]
1006 level = self.levels[-1]
1009 self.report("down")
1007 self.report("down")
1010 level.moveto(level.curx, level.cury+self.stepy)
1008 level.moveto(level.curx, level.cury+self.stepy)
1011
1009
1012 def cmd_pageup(self):
1010 def cmd_pageup(self):
1013 """
1011 """
1014 Move the cursor up one page.
1012 Move the cursor up one page.
1015 """
1013 """
1016 level = self.levels[-1]
1014 level = self.levels[-1]
1017 self.report("page up")
1015 self.report("page up")
1018 level.moveto(level.curx, level.cury-level.mainsizey+self.pageoverlapy)
1016 level.moveto(level.curx, level.cury-level.mainsizey+self.pageoverlapy)
1019
1017
1020 def cmd_pagedown(self):
1018 def cmd_pagedown(self):
1021 """
1019 """
1022 Move the cursor down one page.
1020 Move the cursor down one page.
1023 """
1021 """
1024 level = self.levels[-1]
1022 level = self.levels[-1]
1025 self.report("page down")
1023 self.report("page down")
1026 level.moveto(level.curx, level.cury+level.mainsizey-self.pageoverlapy)
1024 level.moveto(level.curx, level.cury+level.mainsizey-self.pageoverlapy)
1027
1025
1028 def cmd_left(self):
1026 def cmd_left(self):
1029 """
1027 """
1030 Move the cursor left.
1028 Move the cursor left.
1031 """
1029 """
1032 level = self.levels[-1]
1030 level = self.levels[-1]
1033 self.report("left")
1031 self.report("left")
1034 level.moveto(level.curx-self.stepx, level.cury)
1032 level.moveto(level.curx-self.stepx, level.cury)
1035
1033
1036 def cmd_right(self):
1034 def cmd_right(self):
1037 """
1035 """
1038 Move the cursor right.
1036 Move the cursor right.
1039 """
1037 """
1040 level = self.levels[-1]
1038 level = self.levels[-1]
1041 self.report("right")
1039 self.report("right")
1042 level.moveto(level.curx+self.stepx, level.cury)
1040 level.moveto(level.curx+self.stepx, level.cury)
1043
1041
1044 def cmd_home(self):
1042 def cmd_home(self):
1045 """
1043 """
1046 Move the cursor to the first column.
1044 Move the cursor to the first column.
1047 """
1045 """
1048 level = self.levels[-1]
1046 level = self.levels[-1]
1049 self.report("home")
1047 self.report("home")
1050 level.moveto(0, level.cury)
1048 level.moveto(0, level.cury)
1051
1049
1052 def cmd_end(self):
1050 def cmd_end(self):
1053 """
1051 """
1054 Move the cursor to the last column.
1052 Move the cursor to the last column.
1055 """
1053 """
1056 level = self.levels[-1]
1054 level = self.levels[-1]
1057 self.report("end")
1055 self.report("end")
1058 level.moveto(level.datasizex+level.mainsizey-self.pageoverlapx, level.cury)
1056 level.moveto(level.datasizex+level.mainsizey-self.pageoverlapx, level.cury)
1059
1057
1060 def cmd_prevattr(self):
1058 def cmd_prevattr(self):
1061 """
1059 """
1062 Move the cursor one attribute column to the left.
1060 Move the cursor one attribute column to the left.
1063 """
1061 """
1064 level = self.levels[-1]
1062 level = self.levels[-1]
1065 if level.displayattr[0] is None or level.displayattr[0] == 0:
1063 if level.displayattr[0] is None or level.displayattr[0] == 0:
1066 self.beep()
1064 self.beep()
1067 else:
1065 else:
1068 self.report("prevattr")
1066 self.report("prevattr")
1069 pos = 0
1067 pos = 0
1070 for (i, attrname) in enumerate(level.displayattrs):
1068 for (i, attrname) in enumerate(level.displayattrs):
1071 if i == level.displayattr[0]-1:
1069 if i == level.displayattr[0]-1:
1072 break
1070 break
1073 pos += level.colwidths[attrname] + 1
1071 pos += level.colwidths[attrname] + 1
1074 level.moveto(pos, level.cury)
1072 level.moveto(pos, level.cury)
1075
1073
1076 def cmd_nextattr(self):
1074 def cmd_nextattr(self):
1077 """
1075 """
1078 Move the cursor one attribute column to the right.
1076 Move the cursor one attribute column to the right.
1079 """
1077 """
1080 level = self.levels[-1]
1078 level = self.levels[-1]
1081 if level.displayattr[0] is None or level.displayattr[0] == len(level.displayattrs)-1:
1079 if level.displayattr[0] is None or level.displayattr[0] == len(level.displayattrs)-1:
1082 self.beep()
1080 self.beep()
1083 else:
1081 else:
1084 self.report("nextattr")
1082 self.report("nextattr")
1085 pos = 0
1083 pos = 0
1086 for (i, attrname) in enumerate(level.displayattrs):
1084 for (i, attrname) in enumerate(level.displayattrs):
1087 if i == level.displayattr[0]+1:
1085 if i == level.displayattr[0]+1:
1088 break
1086 break
1089 pos += level.colwidths[attrname] + 1
1087 pos += level.colwidths[attrname] + 1
1090 level.moveto(pos, level.cury)
1088 level.moveto(pos, level.cury)
1091
1089
1092 def cmd_pick(self):
1090 def cmd_pick(self):
1093 """
1091 """
1094 'Pick' the object under the cursor (i.e. the row the cursor is on).
1092 'Pick' the object under the cursor (i.e. the row the cursor is on).
1095 This leaves the browser and returns the picked object to the caller.
1093 This leaves the browser and returns the picked object to the caller.
1096 (In IPython this object will be available as the ``_`` variable.)
1094 (In IPython this object will be available as the ``_`` variable.)
1097 """
1095 """
1098 level = self.levels[-1]
1096 level = self.levels[-1]
1099 self.returnvalue = level.items[level.cury].item
1097 self.returnvalue = level.items[level.cury].item
1100 return True
1098 return True
1101
1099
1102 def cmd_pickattr(self):
1100 def cmd_pickattr(self):
1103 """
1101 """
1104 'Pick' the attribute under the cursor (i.e. the row/column the
1102 'Pick' the attribute under the cursor (i.e. the row/column the
1105 cursor is on).
1103 cursor is on).
1106 """
1104 """
1107 level = self.levels[-1]
1105 level = self.levels[-1]
1108 attr = level.displayattr[1]
1106 attr = level.displayattr[1]
1109 if attr is ipipe.noitem:
1107 if attr is ipipe.noitem:
1110 curses.beep()
1108 curses.beep()
1111 self.report(CommandError("no column under cursor"))
1109 self.report(CommandError("no column under cursor"))
1112 return
1110 return
1113 value = attr.value(level.items[level.cury].item)
1111 value = attr.value(level.items[level.cury].item)
1114 if value is ipipe.noitem:
1112 if value is ipipe.noitem:
1115 curses.beep()
1113 curses.beep()
1116 self.report(AttributeError(attr.name()))
1114 self.report(AttributeError(attr.name()))
1117 else:
1115 else:
1118 self.returnvalue = value
1116 self.returnvalue = value
1119 return True
1117 return True
1120
1118
1121 def cmd_pickallattrs(self):
1119 def cmd_pickallattrs(self):
1122 """
1120 """
1123 Pick' the complete column under the cursor (i.e. the attribute under
1121 Pick' the complete column under the cursor (i.e. the attribute under
1124 the cursor) from all currently fetched objects. These attributes
1122 the cursor) from all currently fetched objects. These attributes
1125 will be returned as a list.
1123 will be returned as a list.
1126 """
1124 """
1127 level = self.levels[-1]
1125 level = self.levels[-1]
1128 attr = level.displayattr[1]
1126 attr = level.displayattr[1]
1129 if attr is ipipe.noitem:
1127 if attr is ipipe.noitem:
1130 curses.beep()
1128 curses.beep()
1131 self.report(CommandError("no column under cursor"))
1129 self.report(CommandError("no column under cursor"))
1132 return
1130 return
1133 result = []
1131 result = []
1134 for cache in level.items:
1132 for cache in level.items:
1135 value = attr.value(cache.item)
1133 value = attr.value(cache.item)
1136 if value is not ipipe.noitem:
1134 if value is not ipipe.noitem:
1137 result.append(value)
1135 result.append(value)
1138 self.returnvalue = result
1136 self.returnvalue = result
1139 return True
1137 return True
1140
1138
1141 def cmd_pickmarked(self):
1139 def cmd_pickmarked(self):
1142 """
1140 """
1143 'Pick' marked objects. Marked objects will be returned as a list.
1141 'Pick' marked objects. Marked objects will be returned as a list.
1144 """
1142 """
1145 level = self.levels[-1]
1143 level = self.levels[-1]
1146 self.returnvalue = [cache.item for cache in level.items if cache.marked]
1144 self.returnvalue = [cache.item for cache in level.items if cache.marked]
1147 return True
1145 return True
1148
1146
1149 def cmd_pickmarkedattr(self):
1147 def cmd_pickmarkedattr(self):
1150 """
1148 """
1151 'Pick' the attribute under the cursor from all marked objects
1149 'Pick' the attribute under the cursor from all marked objects
1152 (This returns a list).
1150 (This returns a list).
1153 """
1151 """
1154
1152
1155 level = self.levels[-1]
1153 level = self.levels[-1]
1156 attr = level.displayattr[1]
1154 attr = level.displayattr[1]
1157 if attr is ipipe.noitem:
1155 if attr is ipipe.noitem:
1158 curses.beep()
1156 curses.beep()
1159 self.report(CommandError("no column under cursor"))
1157 self.report(CommandError("no column under cursor"))
1160 return
1158 return
1161 result = []
1159 result = []
1162 for cache in level.items:
1160 for cache in level.items:
1163 if cache.marked:
1161 if cache.marked:
1164 value = attr.value(cache.item)
1162 value = attr.value(cache.item)
1165 if value is not ipipe.noitem:
1163 if value is not ipipe.noitem:
1166 result.append(value)
1164 result.append(value)
1167 self.returnvalue = result
1165 self.returnvalue = result
1168 return True
1166 return True
1169
1167
1170 def cmd_pickinput(self):
1168 def cmd_pickinput(self):
1171 """
1169 """
1172 Use the object under the cursor (i.e. the row the cursor is on) as
1170 Use the object under the cursor (i.e. the row the cursor is on) as
1173 the next input line. This leaves the browser and puts the picked object
1171 the next input line. This leaves the browser and puts the picked object
1174 in the input.
1172 in the input.
1175 """
1173 """
1176 level = self.levels[-1]
1174 level = self.levels[-1]
1177 value = level.items[level.cury].item
1175 value = level.items[level.cury].item
1178 self.returnvalue = None
1176 self.returnvalue = None
1179 api = ipapi.get()
1177 api = ipapi.get()
1180 api.set_next_input(str(value))
1178 api.set_next_input(str(value))
1181 return True
1179 return True
1182
1180
1183 def cmd_pickinputattr(self):
1181 def cmd_pickinputattr(self):
1184 """
1182 """
1185 Use the attribute under the cursor i.e. the row/column the cursor is on)
1183 Use the attribute under the cursor i.e. the row/column the cursor is on)
1186 as the next input line. This leaves the browser and puts the picked
1184 as the next input line. This leaves the browser and puts the picked
1187 object in the input.
1185 object in the input.
1188 """
1186 """
1189 level = self.levels[-1]
1187 level = self.levels[-1]
1190 attr = level.displayattr[1]
1188 attr = level.displayattr[1]
1191 if attr is ipipe.noitem:
1189 if attr is ipipe.noitem:
1192 curses.beep()
1190 curses.beep()
1193 self.report(CommandError("no column under cursor"))
1191 self.report(CommandError("no column under cursor"))
1194 return
1192 return
1195 value = attr.value(level.items[level.cury].item)
1193 value = attr.value(level.items[level.cury].item)
1196 if value is ipipe.noitem:
1194 if value is ipipe.noitem:
1197 curses.beep()
1195 curses.beep()
1198 self.report(AttributeError(attr.name()))
1196 self.report(AttributeError(attr.name()))
1199 self.returnvalue = None
1197 self.returnvalue = None
1200 api = ipapi.get()
1198 api = ipapi.get()
1201 api.set_next_input(str(value))
1199 api.set_next_input(str(value))
1202 return True
1200 return True
1203
1201
1204 def cmd_markrange(self):
1202 def cmd_markrange(self):
1205 """
1203 """
1206 Mark all objects from the last marked object before the current cursor
1204 Mark all objects from the last marked object before the current cursor
1207 position to the cursor position.
1205 position to the cursor position.
1208 """
1206 """
1209 level = self.levels[-1]
1207 level = self.levels[-1]
1210 self.report("markrange")
1208 self.report("markrange")
1211 start = None
1209 start = None
1212 if level.items:
1210 if level.items:
1213 for i in xrange(level.cury, -1, -1):
1211 for i in xrange(level.cury, -1, -1):
1214 if level.items[i].marked:
1212 if level.items[i].marked:
1215 start = i
1213 start = i
1216 break
1214 break
1217 if start is None:
1215 if start is None:
1218 self.report(CommandError("no mark before cursor"))
1216 self.report(CommandError("no mark before cursor"))
1219 curses.beep()
1217 curses.beep()
1220 else:
1218 else:
1221 for i in xrange(start, level.cury+1):
1219 for i in xrange(start, level.cury+1):
1222 cache = level.items[i]
1220 cache = level.items[i]
1223 if not cache.marked:
1221 if not cache.marked:
1224 cache.marked = True
1222 cache.marked = True
1225 level.marked += 1
1223 level.marked += 1
1226
1224
1227 def cmd_enter(self):
1225 def cmd_enter(self):
1228 """
1226 """
1229 Enter the object under the cursor. (what this mean depends on the object
1227 Enter the object under the cursor. (what this mean depends on the object
1230 itself (i.e. how it implements iteration). This opens a new browser 'level'.
1228 itself (i.e. how it implements iteration). This opens a new browser 'level'.
1231 """
1229 """
1232 level = self.levels[-1]
1230 level = self.levels[-1]
1233 try:
1231 try:
1234 item = level.items[level.cury].item
1232 item = level.items[level.cury].item
1235 except IndexError:
1233 except IndexError:
1236 self.report(CommandError("No object"))
1234 self.report(CommandError("No object"))
1237 curses.beep()
1235 curses.beep()
1238 else:
1236 else:
1239 self.report("entering object...")
1237 self.report("entering object...")
1240 self.enter(item)
1238 self.enter(item)
1241
1239
1242 def cmd_leave(self):
1240 def cmd_leave(self):
1243 """
1241 """
1244 Leave the current browser level and go back to the previous one.
1242 Leave the current browser level and go back to the previous one.
1245 """
1243 """
1246 self.report("leave")
1244 self.report("leave")
1247 if len(self.levels) > 1:
1245 if len(self.levels) > 1:
1248 self._calcheaderlines(len(self.levels)-1)
1246 self._calcheaderlines(len(self.levels)-1)
1249 self.levels.pop(-1)
1247 self.levels.pop(-1)
1250 else:
1248 else:
1251 self.report(CommandError("This is the last level"))
1249 self.report(CommandError("This is the last level"))
1252 curses.beep()
1250 curses.beep()
1253
1251
1254 def cmd_enterattr(self):
1252 def cmd_enterattr(self):
1255 """
1253 """
1256 Enter the attribute under the cursor.
1254 Enter the attribute under the cursor.
1257 """
1255 """
1258 level = self.levels[-1]
1256 level = self.levels[-1]
1259 attr = level.displayattr[1]
1257 attr = level.displayattr[1]
1260 if attr is ipipe.noitem:
1258 if attr is ipipe.noitem:
1261 curses.beep()
1259 curses.beep()
1262 self.report(CommandError("no column under cursor"))
1260 self.report(CommandError("no column under cursor"))
1263 return
1261 return
1264 try:
1262 try:
1265 item = level.items[level.cury].item
1263 item = level.items[level.cury].item
1266 except IndexError:
1264 except IndexError:
1267 self.report(CommandError("No object"))
1265 self.report(CommandError("No object"))
1268 curses.beep()
1266 curses.beep()
1269 else:
1267 else:
1270 value = attr.value(item)
1268 value = attr.value(item)
1271 name = attr.name()
1269 name = attr.name()
1272 if value is ipipe.noitem:
1270 if value is ipipe.noitem:
1273 self.report(AttributeError(name))
1271 self.report(AttributeError(name))
1274 else:
1272 else:
1275 self.report("entering object attribute %s..." % name)
1273 self.report("entering object attribute %s..." % name)
1276 self.enter(value)
1274 self.enter(value)
1277
1275
1278 def cmd_detail(self):
1276 def cmd_detail(self):
1279 """
1277 """
1280 Show a detail view of the object under the cursor. This shows the
1278 Show a detail view of the object under the cursor. This shows the
1281 name, type, doc string and value of the object attributes (and it
1279 name, type, doc string and value of the object attributes (and it
1282 might show more attributes than in the list view, depending on
1280 might show more attributes than in the list view, depending on
1283 the object).
1281 the object).
1284 """
1282 """
1285 level = self.levels[-1]
1283 level = self.levels[-1]
1286 try:
1284 try:
1287 item = level.items[level.cury].item
1285 item = level.items[level.cury].item
1288 except IndexError:
1286 except IndexError:
1289 self.report(CommandError("No object"))
1287 self.report(CommandError("No object"))
1290 curses.beep()
1288 curses.beep()
1291 else:
1289 else:
1292 self.report("entering detail view for object...")
1290 self.report("entering detail view for object...")
1293 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1291 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1294 self.enter(attrs)
1292 self.enter(attrs)
1295
1293
1296 def cmd_detailattr(self):
1294 def cmd_detailattr(self):
1297 """
1295 """
1298 Show a detail view of the attribute under the cursor.
1296 Show a detail view of the attribute under the cursor.
1299 """
1297 """
1300 level = self.levels[-1]
1298 level = self.levels[-1]
1301 attr = level.displayattr[1]
1299 attr = level.displayattr[1]
1302 if attr is ipipe.noitem:
1300 if attr is ipipe.noitem:
1303 curses.beep()
1301 curses.beep()
1304 self.report(CommandError("no attribute"))
1302 self.report(CommandError("no attribute"))
1305 return
1303 return
1306 try:
1304 try:
1307 item = level.items[level.cury].item
1305 item = level.items[level.cury].item
1308 except IndexError:
1306 except IndexError:
1309 self.report(CommandError("No object"))
1307 self.report(CommandError("No object"))
1310 curses.beep()
1308 curses.beep()
1311 else:
1309 else:
1312 try:
1310 try:
1313 item = attr.value(item)
1311 item = attr.value(item)
1314 except (KeyboardInterrupt, SystemExit):
1312 except (KeyboardInterrupt, SystemExit):
1315 raise
1313 raise
1316 except Exception, exc:
1314 except Exception, exc:
1317 self.report(exc)
1315 self.report(exc)
1318 else:
1316 else:
1319 self.report("entering detail view for attribute %s..." % attr.name())
1317 self.report("entering detail view for attribute %s..." % attr.name())
1320 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1318 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1321 self.enter(attrs)
1319 self.enter(attrs)
1322
1320
1323 def cmd_tooglemark(self):
1321 def cmd_tooglemark(self):
1324 """
1322 """
1325 Mark/unmark the object under the cursor. Marked objects have a '!'
1323 Mark/unmark the object under the cursor. Marked objects have a '!'
1326 after the row number).
1324 after the row number).
1327 """
1325 """
1328 level = self.levels[-1]
1326 level = self.levels[-1]
1329 self.report("toggle mark")
1327 self.report("toggle mark")
1330 try:
1328 try:
1331 item = level.items[level.cury]
1329 item = level.items[level.cury]
1332 except IndexError: # no items?
1330 except IndexError: # no items?
1333 pass
1331 pass
1334 else:
1332 else:
1335 if item.marked:
1333 if item.marked:
1336 item.marked = False
1334 item.marked = False
1337 level.marked -= 1
1335 level.marked -= 1
1338 else:
1336 else:
1339 item.marked = True
1337 item.marked = True
1340 level.marked += 1
1338 level.marked += 1
1341
1339
1342 def cmd_sortattrasc(self):
1340 def cmd_sortattrasc(self):
1343 """
1341 """
1344 Sort the objects (in ascending order) using the attribute under
1342 Sort the objects (in ascending order) using the attribute under
1345 the cursor as the sort key.
1343 the cursor as the sort key.
1346 """
1344 """
1347 level = self.levels[-1]
1345 level = self.levels[-1]
1348 attr = level.displayattr[1]
1346 attr = level.displayattr[1]
1349 if attr is ipipe.noitem:
1347 if attr is ipipe.noitem:
1350 curses.beep()
1348 curses.beep()
1351 self.report(CommandError("no column under cursor"))
1349 self.report(CommandError("no column under cursor"))
1352 return
1350 return
1353 self.report("sort by %s (ascending)" % attr.name())
1351 self.report("sort by %s (ascending)" % attr.name())
1354 def key(item):
1352 def key(item):
1355 try:
1353 try:
1356 return attr.value(item)
1354 return attr.value(item)
1357 except (KeyboardInterrupt, SystemExit):
1355 except (KeyboardInterrupt, SystemExit):
1358 raise
1356 raise
1359 except Exception:
1357 except Exception:
1360 return None
1358 return None
1361 level.sort(key)
1359 level.sort(key)
1362
1360
1363 def cmd_sortattrdesc(self):
1361 def cmd_sortattrdesc(self):
1364 """
1362 """
1365 Sort the objects (in descending order) using the attribute under
1363 Sort the objects (in descending order) using the attribute under
1366 the cursor as the sort key.
1364 the cursor as the sort key.
1367 """
1365 """
1368 level = self.levels[-1]
1366 level = self.levels[-1]
1369 attr = level.displayattr[1]
1367 attr = level.displayattr[1]
1370 if attr is ipipe.noitem:
1368 if attr is ipipe.noitem:
1371 curses.beep()
1369 curses.beep()
1372 self.report(CommandError("no column under cursor"))
1370 self.report(CommandError("no column under cursor"))
1373 return
1371 return
1374 self.report("sort by %s (descending)" % attr.name())
1372 self.report("sort by %s (descending)" % attr.name())
1375 def key(item):
1373 def key(item):
1376 try:
1374 try:
1377 return attr.value(item)
1375 return attr.value(item)
1378 except (KeyboardInterrupt, SystemExit):
1376 except (KeyboardInterrupt, SystemExit):
1379 raise
1377 raise
1380 except Exception:
1378 except Exception:
1381 return None
1379 return None
1382 level.sort(key, reverse=True)
1380 level.sort(key, reverse=True)
1383
1381
1384 def cmd_hideattr(self):
1382 def cmd_hideattr(self):
1385 """
1383 """
1386 Hide the attribute under the cursor.
1384 Hide the attribute under the cursor.
1387 """
1385 """
1388 level = self.levels[-1]
1386 level = self.levels[-1]
1389 if level.displayattr[0] is None:
1387 if level.displayattr[0] is None:
1390 self.beep()
1388 self.beep()
1391 else:
1389 else:
1392 self.report("hideattr")
1390 self.report("hideattr")
1393 level.hiddenattrs.add(level.displayattr[1])
1391 level.hiddenattrs.add(level.displayattr[1])
1394 level.moveto(level.curx, level.cury, refresh=True)
1392 level.moveto(level.curx, level.cury, refresh=True)
1395
1393
1396 def cmd_unhideattrs(self):
1394 def cmd_unhideattrs(self):
1397 """
1395 """
1398 Make all attributes visible again.
1396 Make all attributes visible again.
1399 """
1397 """
1400 level = self.levels[-1]
1398 level = self.levels[-1]
1401 self.report("unhideattrs")
1399 self.report("unhideattrs")
1402 level.hiddenattrs.clear()
1400 level.hiddenattrs.clear()
1403 level.moveto(level.curx, level.cury, refresh=True)
1401 level.moveto(level.curx, level.cury, refresh=True)
1404
1402
1405 def cmd_goto(self):
1403 def cmd_goto(self):
1406 """
1404 """
1407 Jump to a row. The row number can be entered at the
1405 Jump to a row. The row number can be entered at the
1408 bottom of the screen.
1406 bottom of the screen.
1409 """
1407 """
1410 self.startkeyboardinput("goto")
1408 self.startkeyboardinput("goto")
1411
1409
1412 def cmd_find(self):
1410 def cmd_find(self):
1413 """
1411 """
1414 Search forward for a row. The search condition can be entered at the
1412 Search forward for a row. The search condition can be entered at the
1415 bottom of the screen.
1413 bottom of the screen.
1416 """
1414 """
1417 self.startkeyboardinput("find")
1415 self.startkeyboardinput("find")
1418
1416
1419 def cmd_findbackwards(self):
1417 def cmd_findbackwards(self):
1420 """
1418 """
1421 Search backward for a row. The search condition can be entered at the
1419 Search backward for a row. The search condition can be entered at the
1422 bottom of the screen.
1420 bottom of the screen.
1423 """
1421 """
1424 self.startkeyboardinput("findbackwards")
1422 self.startkeyboardinput("findbackwards")
1425
1423
1426 def cmd_refresh(self):
1424 def cmd_refresh(self):
1427 """
1425 """
1428 Refreshes the display by restarting the iterator.
1426 Refreshes the display by restarting the iterator.
1429 """
1427 """
1430 level = self.levels[-1]
1428 level = self.levels[-1]
1431 self.report("refresh")
1429 self.report("refresh")
1432 level.refresh()
1430 level.refresh()
1433
1431
1434 def cmd_refreshfind(self):
1432 def cmd_refreshfind(self):
1435 """
1433 """
1436 Refreshes the display by restarting the iterator and goes back to the
1434 Refreshes the display by restarting the iterator and goes back to the
1437 same object the cursor was on before restarting (if this object can't be
1435 same object the cursor was on before restarting (if this object can't be
1438 found the cursor jumps back to the first object).
1436 found the cursor jumps back to the first object).
1439 """
1437 """
1440 level = self.levels[-1]
1438 level = self.levels[-1]
1441 self.report("refreshfind")
1439 self.report("refreshfind")
1442 level.refreshfind()
1440 level.refreshfind()
1443
1441
1444 def cmd_help(self):
1442 def cmd_help(self):
1445 """
1443 """
1446 Opens the help screen as a new browser level, describing keyboard
1444 Opens the help screen as a new browser level, describing keyboard
1447 shortcuts.
1445 shortcuts.
1448 """
1446 """
1449 for level in self.levels:
1447 for level in self.levels:
1450 if isinstance(level.input, _BrowserHelp):
1448 if isinstance(level.input, _BrowserHelp):
1451 curses.beep()
1449 curses.beep()
1452 self.report(CommandError("help already active"))
1450 self.report(CommandError("help already active"))
1453 return
1451 return
1454
1452
1455 self.enter(_BrowserHelp(self))
1453 self.enter(_BrowserHelp(self))
1456
1454
1457 def cmd_quit(self):
1455 def cmd_quit(self):
1458 """
1456 """
1459 Quit the browser and return to the IPython prompt.
1457 Quit the browser and return to the IPython prompt.
1460 """
1458 """
1461 self.returnvalue = None
1459 self.returnvalue = None
1462 return True
1460 return True
1463
1461
1464 def sigwinchhandler(self, signal, frame):
1462 def sigwinchhandler(self, signal, frame):
1465 self.resized = True
1463 self.resized = True
1466
1464
1467 def _dodisplay(self, scr):
1465 def _dodisplay(self, scr):
1468 """
1466 """
1469 This method is the workhorse of the browser. It handles screen
1467 This method is the workhorse of the browser. It handles screen
1470 drawing and the keyboard.
1468 drawing and the keyboard.
1471 """
1469 """
1472 self.scr = scr
1470 self.scr = scr
1473 curses.halfdelay(1)
1471 curses.halfdelay(1)
1474 footery = 2
1472 footery = 2
1475
1473
1476 keys = []
1474 keys = []
1477 for cmd in ("quit", "help"):
1475 for cmd in ("quit", "help"):
1478 key = self.keymap.findkey(cmd, None)
1476 key = self.keymap.findkey(cmd, None)
1479 if key is not None:
1477 if key is not None:
1480 keys.append("%s=%s" % (self.keylabel(key), cmd))
1478 keys.append("%s=%s" % (self.keylabel(key), cmd))
1481 helpmsg = " | %s" % " ".join(keys)
1479 helpmsg = " | %s" % " ".join(keys)
1482
1480
1483 scr.clear()
1481 scr.clear()
1484 msg = "Fetching first batch of objects..."
1482 msg = "Fetching first batch of objects..."
1485 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1483 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1486 scr.addstr(self.scrsizey//2, (self.scrsizex-len(msg))//2, msg)
1484 scr.addstr(self.scrsizey//2, (self.scrsizex-len(msg))//2, msg)
1487 scr.refresh()
1485 scr.refresh()
1488
1486
1489 lastc = -1
1487 lastc = -1
1490
1488
1491 self.levels = []
1489 self.levels = []
1492 # enter the first level
1490 # enter the first level
1493 self.enter(self.input, *self.attrs)
1491 self.enter(self.input, *self.attrs)
1494
1492
1495 self._calcheaderlines(None)
1493 self._calcheaderlines(None)
1496
1494
1497 while True:
1495 while True:
1498 level = self.levels[-1]
1496 level = self.levels[-1]
1499 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1497 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1500 level.mainsizey = self.scrsizey-1-self._headerlines-footery
1498 level.mainsizey = self.scrsizey-1-self._headerlines-footery
1501
1499
1502 # Paint object header
1500 # Paint object header
1503 for i in xrange(self._firstheaderline, self._firstheaderline+self._headerlines):
1501 for i in xrange(self._firstheaderline, self._firstheaderline+self._headerlines):
1504 lv = self.levels[i]
1502 lv = self.levels[i]
1505 posx = 0
1503 posx = 0
1506 posy = i-self._firstheaderline
1504 posy = i-self._firstheaderline
1507 endx = self.scrsizex
1505 endx = self.scrsizex
1508 if i: # not the first level
1506 if i: # not the first level
1509 msg = " (%d/%d" % (self.levels[i-1].cury, len(self.levels[i-1].items))
1507 msg = " (%d/%d" % (self.levels[i-1].cury, len(self.levels[i-1].items))
1510 if not self.levels[i-1].exhausted:
1508 if not self.levels[i-1].exhausted:
1511 msg += "+"
1509 msg += "+"
1512 msg += ") "
1510 msg += ") "
1513 endx -= len(msg)+1
1511 endx -= len(msg)+1
1514 posx += self.addstr(posy, posx, 0, endx, " ibrowse #%d: " % i, self.style_objheadertext)
1512 posx += self.addstr(posy, posx, 0, endx, " ibrowse #%d: " % i, self.style_objheadertext)
1515 for (style, text) in lv.header:
1513 for (style, text) in lv.header:
1516 posx += self.addstr(posy, posx, 0, endx, text, self.style_objheaderobject)
1514 posx += self.addstr(posy, posx, 0, endx, text, self.style_objheaderobject)
1517 if posx >= endx:
1515 if posx >= endx:
1518 break
1516 break
1519 if i:
1517 if i:
1520 posx += self.addstr(posy, posx, 0, self.scrsizex, msg, self.style_objheadernumber)
1518 posx += self.addstr(posy, posx, 0, self.scrsizex, msg, self.style_objheadernumber)
1521 posx += self.addchr(posy, posx, 0, self.scrsizex, " ", self.scrsizex-posx, self.style_objheadernumber)
1519 posx += self.addchr(posy, posx, 0, self.scrsizex, " ", self.scrsizex-posx, self.style_objheadernumber)
1522
1520
1523 if not level.items:
1521 if not level.items:
1524 self.addchr(self._headerlines, 0, 0, self.scrsizex, " ", self.scrsizex, self.style_colheader)
1522 self.addchr(self._headerlines, 0, 0, self.scrsizex, " ", self.scrsizex, self.style_colheader)
1525 self.addstr(self._headerlines+1, 0, 0, self.scrsizex, " <empty>", astyle.style_error)
1523 self.addstr(self._headerlines+1, 0, 0, self.scrsizex, " <empty>", astyle.style_error)
1526 scr.clrtobot()
1524 scr.clrtobot()
1527 else:
1525 else:
1528 # Paint column headers
1526 # Paint column headers
1529 scr.move(self._headerlines, 0)
1527 scr.move(self._headerlines, 0)
1530 scr.addstr(" %*s " % (level.numbersizex, "#"), self.getstyle(self.style_colheader))
1528 scr.addstr(" %*s " % (level.numbersizex, "#"), self.getstyle(self.style_colheader))
1531 scr.addstr(self.headersepchar, self.getstyle(self.style_colheadersep))
1529 scr.addstr(self.headersepchar, self.getstyle(self.style_colheadersep))
1532 begx = level.numbersizex+3
1530 begx = level.numbersizex+3
1533 posx = begx-level.datastartx
1531 posx = begx-level.datastartx
1534 for attr in level.displayattrs:
1532 for attr in level.displayattrs:
1535 attrname = attr.name()
1533 attrname = attr.name()
1536 cwidth = level.colwidths[attr]
1534 cwidth = level.colwidths[attr]
1537 header = attrname.ljust(cwidth)
1535 header = attrname.ljust(cwidth)
1538 if attr is level.displayattr[1]:
1536 if attr is level.displayattr[1]:
1539 style = self.style_colheaderhere
1537 style = self.style_colheaderhere
1540 else:
1538 else:
1541 style = self.style_colheader
1539 style = self.style_colheader
1542 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, header, style)
1540 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, header, style)
1543 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, self.headersepchar, self.style_colheadersep)
1541 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, self.headersepchar, self.style_colheadersep)
1544 if posx >= self.scrsizex:
1542 if posx >= self.scrsizex:
1545 break
1543 break
1546 else:
1544 else:
1547 scr.addstr(" "*(self.scrsizex-posx), self.getstyle(self.style_colheader))
1545 scr.addstr(" "*(self.scrsizex-posx), self.getstyle(self.style_colheader))
1548
1546
1549 # Paint rows
1547 # Paint rows
1550 posy = self._headerlines+1+level.datastarty
1548 posy = self._headerlines+1+level.datastarty
1551 for i in xrange(level.datastarty, min(level.datastarty+level.mainsizey, len(level.items))):
1549 for i in xrange(level.datastarty, min(level.datastarty+level.mainsizey, len(level.items))):
1552 cache = level.items[i]
1550 cache = level.items[i]
1553 if i == level.cury:
1551 if i == level.cury:
1554 style = self.style_numberhere
1552 style = self.style_numberhere
1555 else:
1553 else:
1556 style = self.style_number
1554 style = self.style_number
1557
1555
1558 posy = self._headerlines+1+i-level.datastarty
1556 posy = self._headerlines+1+i-level.datastarty
1559 posx = begx-level.datastartx
1557 posx = begx-level.datastartx
1560
1558
1561 scr.move(posy, 0)
1559 scr.move(posy, 0)
1562 scr.addstr(" %*d%s" % (level.numbersizex, i, " !"[cache.marked]), self.getstyle(style))
1560 scr.addstr(" %*d%s" % (level.numbersizex, i, " !"[cache.marked]), self.getstyle(style))
1563 scr.addstr(self.headersepchar, self.getstyle(self.style_sep))
1561 scr.addstr(self.headersepchar, self.getstyle(self.style_sep))
1564
1562
1565 for attrname in level.displayattrs:
1563 for attrname in level.displayattrs:
1566 cwidth = level.colwidths[attrname]
1564 cwidth = level.colwidths[attrname]
1567 try:
1565 try:
1568 (align, length, parts) = level.displayrows[i-level.datastarty][attrname]
1566 (align, length, parts) = level.displayrows[i-level.datastarty][attrname]
1569 except KeyError:
1567 except KeyError:
1570 align = 2
1568 align = 2
1571 style = astyle.style_nodata
1569 style = astyle.style_nodata
1572 if i == level.cury:
1570 if i == level.cury:
1573 style = self.getstylehere(style)
1571 style = self.getstylehere(style)
1574 padstyle = self.style_datapad
1572 padstyle = self.style_datapad
1575 sepstyle = self.style_sep
1573 sepstyle = self.style_sep
1576 if i == level.cury:
1574 if i == level.cury:
1577 padstyle = self.getstylehere(padstyle)
1575 padstyle = self.getstylehere(padstyle)
1578 sepstyle = self.getstylehere(sepstyle)
1576 sepstyle = self.getstylehere(sepstyle)
1579 if align == 2:
1577 if align == 2:
1580 posx += self.addchr(posy, posx, begx, self.scrsizex, self.nodatachar, cwidth, style)
1578 posx += self.addchr(posy, posx, begx, self.scrsizex, self.nodatachar, cwidth, style)
1581 else:
1579 else:
1582 if align == 1:
1580 if align == 1:
1583 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1581 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1584 elif align == 0:
1582 elif align == 0:
1585 pad1 = (cwidth-length)//2
1583 pad1 = (cwidth-length)//2
1586 pad2 = cwidth-length-len(pad1)
1584 pad2 = cwidth-length-len(pad1)
1587 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad1, padstyle)
1585 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad1, padstyle)
1588 for (style, text) in parts:
1586 for (style, text) in parts:
1589 if i == level.cury:
1587 if i == level.cury:
1590 style = self.getstylehere(style)
1588 style = self.getstylehere(style)
1591 posx += self.addstr(posy, posx, begx, self.scrsizex, text, style)
1589 posx += self.addstr(posy, posx, begx, self.scrsizex, text, style)
1592 if posx >= self.scrsizex:
1590 if posx >= self.scrsizex:
1593 break
1591 break
1594 if align == -1:
1592 if align == -1:
1595 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1593 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1596 elif align == 0:
1594 elif align == 0:
1597 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad2, padstyle)
1595 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad2, padstyle)
1598 posx += self.addstr(posy, posx, begx, self.scrsizex, self.datasepchar, sepstyle)
1596 posx += self.addstr(posy, posx, begx, self.scrsizex, self.datasepchar, sepstyle)
1599 else:
1597 else:
1600 scr.clrtoeol()
1598 scr.clrtoeol()
1601
1599
1602 # Add blank row headers for the rest of the screen
1600 # Add blank row headers for the rest of the screen
1603 for posy in xrange(posy+1, self.scrsizey-2):
1601 for posy in xrange(posy+1, self.scrsizey-2):
1604 scr.addstr(posy, 0, " " * (level.numbersizex+2), self.getstyle(self.style_colheader))
1602 scr.addstr(posy, 0, " " * (level.numbersizex+2), self.getstyle(self.style_colheader))
1605 scr.clrtoeol()
1603 scr.clrtoeol()
1606
1604
1607 posy = self.scrsizey-footery
1605 posy = self.scrsizey-footery
1608 # Display footer
1606 # Display footer
1609 scr.addstr(posy, 0, " "*self.scrsizex, self.getstyle(self.style_footer))
1607 scr.addstr(posy, 0, " "*self.scrsizex, self.getstyle(self.style_footer))
1610
1608
1611 if level.exhausted:
1609 if level.exhausted:
1612 flag = ""
1610 flag = ""
1613 else:
1611 else:
1614 flag = "+"
1612 flag = "+"
1615
1613
1616 endx = self.scrsizex-len(helpmsg)-1
1614 endx = self.scrsizex-len(helpmsg)-1
1617 scr.addstr(posy, endx, helpmsg, self.getstyle(self.style_footer))
1615 scr.addstr(posy, endx, helpmsg, self.getstyle(self.style_footer))
1618
1616
1619 posx = 0
1617 posx = 0
1620 msg = " %d%s objects (%d marked): " % (len(level.items), flag, level.marked)
1618 msg = " %d%s objects (%d marked): " % (len(level.items), flag, level.marked)
1621 posx += self.addstr(posy, posx, 0, endx, msg, self.style_footer)
1619 posx += self.addstr(posy, posx, 0, endx, msg, self.style_footer)
1622 try:
1620 try:
1623 item = level.items[level.cury].item
1621 item = level.items[level.cury].item
1624 except IndexError: # empty
1622 except IndexError: # empty
1625 pass
1623 pass
1626 else:
1624 else:
1627 for (nostyle, text) in ipipe.xrepr(item, "footer"):
1625 for (nostyle, text) in ipipe.xrepr(item, "footer"):
1628 if not isinstance(nostyle, int):
1626 if not isinstance(nostyle, int):
1629 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1627 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1630 if posx >= endx:
1628 if posx >= endx:
1631 break
1629 break
1632
1630
1633 attrstyle = [(astyle.style_default, "no attribute")]
1631 attrstyle = [(astyle.style_default, "no attribute")]
1634 attr = level.displayattr[1]
1632 attr = level.displayattr[1]
1635 if attr is not ipipe.noitem and not isinstance(attr, ipipe.SelfDescriptor):
1633 if attr is not ipipe.noitem and not isinstance(attr, ipipe.SelfDescriptor):
1636 posx += self.addstr(posy, posx, 0, endx, " | ", self.style_footer)
1634 posx += self.addstr(posy, posx, 0, endx, " | ", self.style_footer)
1637 posx += self.addstr(posy, posx, 0, endx, attr.name(), self.style_footer)
1635 posx += self.addstr(posy, posx, 0, endx, attr.name(), self.style_footer)
1638 posx += self.addstr(posy, posx, 0, endx, ": ", self.style_footer)
1636 posx += self.addstr(posy, posx, 0, endx, ": ", self.style_footer)
1639 try:
1637 try:
1640 value = attr.value(item)
1638 value = attr.value(item)
1641 except (SystemExit, KeyboardInterrupt):
1639 except (SystemExit, KeyboardInterrupt):
1642 raise
1640 raise
1643 except Exception, exc:
1641 except Exception, exc:
1644 value = exc
1642 value = exc
1645 if value is not ipipe.noitem:
1643 if value is not ipipe.noitem:
1646 attrstyle = ipipe.xrepr(value, "footer")
1644 attrstyle = ipipe.xrepr(value, "footer")
1647 for (nostyle, text) in attrstyle:
1645 for (nostyle, text) in attrstyle:
1648 if not isinstance(nostyle, int):
1646 if not isinstance(nostyle, int):
1649 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1647 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1650 if posx >= endx:
1648 if posx >= endx:
1651 break
1649 break
1652
1650
1653 try:
1651 try:
1654 # Display input prompt
1652 # Display input prompt
1655 if self.mode in self.prompts:
1653 if self.mode in self.prompts:
1656 history = self.prompts[self.mode]
1654 history = self.prompts[self.mode]
1657 posx = 0
1655 posx = 0
1658 posy = self.scrsizey-1
1656 posy = self.scrsizey-1
1659 posx += self.addstr(posy, posx, 0, endx, history.prompt, astyle.style_default)
1657 posx += self.addstr(posy, posx, 0, endx, history.prompt, astyle.style_default)
1660 posx += self.addstr(posy, posx, 0, endx, " [", astyle.style_default)
1658 posx += self.addstr(posy, posx, 0, endx, " [", astyle.style_default)
1661 if history.cury==-1:
1659 if history.cury==-1:
1662 text = "new"
1660 text = "new"
1663 else:
1661 else:
1664 text = str(history.cury+1)
1662 text = str(history.cury+1)
1665 posx += self.addstr(posy, posx, 0, endx, text, astyle.style_type_number)
1663 posx += self.addstr(posy, posx, 0, endx, text, astyle.style_type_number)
1666 if history.history:
1664 if history.history:
1667 posx += self.addstr(posy, posx, 0, endx, "/", astyle.style_default)
1665 posx += self.addstr(posy, posx, 0, endx, "/", astyle.style_default)
1668 posx += self.addstr(posy, posx, 0, endx, str(len(history.history)), astyle.style_type_number)
1666 posx += self.addstr(posy, posx, 0, endx, str(len(history.history)), astyle.style_type_number)
1669 posx += self.addstr(posy, posx, 0, endx, "]: ", astyle.style_default)
1667 posx += self.addstr(posy, posx, 0, endx, "]: ", astyle.style_default)
1670 inputstartx = posx
1668 inputstartx = posx
1671 posx += self.addstr(posy, posx, 0, endx, history.input, astyle.style_default)
1669 posx += self.addstr(posy, posx, 0, endx, history.input, astyle.style_default)
1672 # Display report
1670 # Display report
1673 else:
1671 else:
1674 if self._report is not None:
1672 if self._report is not None:
1675 if isinstance(self._report, Exception):
1673 if isinstance(self._report, Exception):
1676 style = self.getstyle(astyle.style_error)
1674 style = self.getstyle(astyle.style_error)
1677 if self._report.__class__.__module__ == "exceptions":
1675 if self._report.__class__.__module__ == "exceptions":
1678 msg = "%s: %s" % \
1676 msg = "%s: %s" % \
1679 (self._report.__class__.__name__, self._report)
1677 (self._report.__class__.__name__, self._report)
1680 else:
1678 else:
1681 msg = "%s.%s: %s" % \
1679 msg = "%s.%s: %s" % \
1682 (self._report.__class__.__module__,
1680 (self._report.__class__.__module__,
1683 self._report.__class__.__name__, self._report)
1681 self._report.__class__.__name__, self._report)
1684 else:
1682 else:
1685 style = self.getstyle(self.style_report)
1683 style = self.getstyle(self.style_report)
1686 msg = self._report
1684 msg = self._report
1687 scr.addstr(self.scrsizey-1, 0, msg[:self.scrsizex], style)
1685 scr.addstr(self.scrsizey-1, 0, msg[:self.scrsizex], style)
1688 self._report = None
1686 self._report = None
1689 else:
1687 else:
1690 scr.move(self.scrsizey-1, 0)
1688 scr.move(self.scrsizey-1, 0)
1691 except curses.error:
1689 except curses.error:
1692 # Protect against errors from writing to the last line
1690 # Protect against errors from writing to the last line
1693 pass
1691 pass
1694 scr.clrtoeol()
1692 scr.clrtoeol()
1695
1693
1696 # Position cursor
1694 # Position cursor
1697 if self.mode in self.prompts:
1695 if self.mode in self.prompts:
1698 history = self.prompts[self.mode]
1696 history = self.prompts[self.mode]
1699 scr.move(self.scrsizey-1, inputstartx+history.curx)
1697 scr.move(self.scrsizey-1, inputstartx+history.curx)
1700 else:
1698 else:
1701 scr.move(
1699 scr.move(
1702 1+self._headerlines+level.cury-level.datastarty,
1700 1+self._headerlines+level.cury-level.datastarty,
1703 level.numbersizex+3+level.curx-level.datastartx
1701 level.numbersizex+3+level.curx-level.datastartx
1704 )
1702 )
1705 scr.refresh()
1703 scr.refresh()
1706
1704
1707 # Check keyboard
1705 # Check keyboard
1708 while True:
1706 while True:
1709 c = scr.getch()
1707 c = scr.getch()
1710 if self.resized:
1708 if self.resized:
1711 size = fcntl.ioctl(0, tty.TIOCGWINSZ, "12345678")
1709 size = fcntl.ioctl(0, tty.TIOCGWINSZ, "12345678")
1712 size = struct.unpack("4H", size)
1710 size = struct.unpack("4H", size)
1713 oldsize = scr.getmaxyx()
1711 oldsize = scr.getmaxyx()
1714 scr.erase()
1712 scr.erase()
1715 curses.resize_term(size[0], size[1])
1713 curses.resize_term(size[0], size[1])
1716 newsize = scr.getmaxyx()
1714 newsize = scr.getmaxyx()
1717 scr.erase()
1715 scr.erase()
1718 for l in self.levels:
1716 for l in self.levels:
1719 l.mainsizey += newsize[0]-oldsize[0]
1717 l.mainsizey += newsize[0]-oldsize[0]
1720 l.moveto(l.curx, l.cury, refresh=True)
1718 l.moveto(l.curx, l.cury, refresh=True)
1721 scr.refresh()
1719 scr.refresh()
1722 self.resized = False
1720 self.resized = False
1723 break # Redisplay
1721 break # Redisplay
1724 if self.mode in self.prompts:
1722 if self.mode in self.prompts:
1725 if self.prompts[self.mode].handlekey(self, c):
1723 if self.prompts[self.mode].handlekey(self, c):
1726 break # Redisplay
1724 break # Redisplay
1727 else:
1725 else:
1728 # if no key is pressed slow down and beep again
1726 # if no key is pressed slow down and beep again
1729 if c == -1:
1727 if c == -1:
1730 self.stepx = 1.
1728 self.stepx = 1.
1731 self.stepy = 1.
1729 self.stepy = 1.
1732 self._dobeep = True
1730 self._dobeep = True
1733 else:
1731 else:
1734 # if a different key was pressed slow down and beep too
1732 # if a different key was pressed slow down and beep too
1735 if c != lastc:
1733 if c != lastc:
1736 lastc = c
1734 lastc = c
1737 self.stepx = 1.
1735 self.stepx = 1.
1738 self.stepy = 1.
1736 self.stepy = 1.
1739 self._dobeep = True
1737 self._dobeep = True
1740 cmdname = self.keymap.get(c, None)
1738 cmdname = self.keymap.get(c, None)
1741 if cmdname is None:
1739 if cmdname is None:
1742 self.report(
1740 self.report(
1743 UnassignedKeyError("Unassigned key %s" %
1741 UnassignedKeyError("Unassigned key %s" %
1744 self.keylabel(c)))
1742 self.keylabel(c)))
1745 else:
1743 else:
1746 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
1744 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
1747 if cmdfunc is None:
1745 if cmdfunc is None:
1748 self.report(
1746 self.report(
1749 UnknownCommandError("Unknown command %r" %
1747 UnknownCommandError("Unknown command %r" %
1750 (cmdname,)))
1748 (cmdname,)))
1751 elif cmdfunc():
1749 elif cmdfunc():
1752 returnvalue = self.returnvalue
1750 returnvalue = self.returnvalue
1753 self.returnvalue = None
1751 self.returnvalue = None
1754 return returnvalue
1752 return returnvalue
1755 self.stepx = self.nextstepx(self.stepx)
1753 self.stepx = self.nextstepx(self.stepx)
1756 self.stepy = self.nextstepy(self.stepy)
1754 self.stepy = self.nextstepy(self.stepy)
1757 curses.flushinp() # get rid of type ahead
1755 curses.flushinp() # get rid of type ahead
1758 break # Redisplay
1756 break # Redisplay
1759 self.scr = None
1757 self.scr = None
1760
1758
1761 def display(self):
1759 def display(self):
1762 if hasattr(curses, "resize_term"):
1760 if hasattr(curses, "resize_term"):
1763 oldhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler)
1761 oldhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler)
1764 try:
1762 try:
1765 return curses.wrapper(self._dodisplay)
1763 return curses.wrapper(self._dodisplay)
1766 finally:
1764 finally:
1767 signal.signal(signal.SIGWINCH, oldhandler)
1765 signal.signal(signal.SIGWINCH, oldhandler)
1768 else:
1766 else:
1769 return curses.wrapper(self._dodisplay)
1767 return curses.wrapper(self._dodisplay)
@@ -1,1129 +1,1126 b''
1 # -*- coding: iso-8859-1 -*-
1 # -*- coding: iso-8859-1 -*-
2
2
3 import ipipe, os, webbrowser, urllib
3 import ipipe, os, webbrowser, urllib
4 from IPython import ipapi
4 from IPython import ipapi
5 import wx
5 import wx
6 import wx.grid, wx.html
6 import wx.grid, wx.html
7
7
8 try:
8 try:
9 sorted
9 sorted
10 except NameError:
10 except NameError:
11 from ipipe import sorted
11 from ipipe import sorted
12 try:
12 try:
13 set
13 set
14 except:
14 except:
15 from sets import Set as set
15 from sets import Set as set
16
16
17
17
18 __all__ = ["igrid"]
18 __all__ = ["igrid"]
19
19
20
20
21 help = """
21 help = """
22 <?xml version='1.0' encoding='iso-8859-1'?>
22 <?xml version='1.0' encoding='iso-8859-1'?>
23 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
23 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
24 <html>
24 <html>
25 <head>
25 <head>
26 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
26 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
27 <link rel="stylesheet" href="igrid_help.css" type="text/css" />
27 <link rel="stylesheet" href="igrid_help.css" type="text/css" />
28 <title>igrid help</title>
28 <title>igrid help</title>
29 </head>
29 </head>
30 <body>
30 <body>
31 <h1>igrid help</h1>
31 <h1>igrid help</h1>
32
32
33
33
34 <h2>Commands</h2>
34 <h2>Commands</h2>
35
35
36
36
37 <h3>pick (P)</h3>
37 <h3>pick (P)</h3>
38 <p>Pick the whole row (object is available as "_")</p>
38 <p>Pick the whole row (object is available as "_")</p>
39
39
40 <h3>pickattr (Shift-P)</h3>
40 <h3>pickattr (Shift-P)</h3>
41 <p>Pick the attribute under the cursor</p>
41 <p>Pick the attribute under the cursor</p>
42
42
43 <h3>pickallattrs (Shift-C)</h3>
43 <h3>pickallattrs (Shift-C)</h3>
44 <p>Pick the complete column under the cursor (i.e. the attribute under the
44 <p>Pick the complete column under the cursor (i.e. the attribute under the
45 cursor) from all currently fetched objects. These attributes will be returned
45 cursor) from all currently fetched objects. These attributes will be returned
46 as a list.</p>
46 as a list.</p>
47
47
48 <h3>pickinput (I)</h3>
48 <h3>pickinput (I)</h3>
49 <p>Pick the current row as next input line in IPython. Additionally the row is stored as "_"</p>
49 <p>Pick the current row as next input line in IPython. Additionally the row is stored as "_"</p>
50
50
51 <h3>pickinputattr (Shift-I)</h3>
51 <h3>pickinputattr (Shift-I)</h3>
52 <p>Pick the attribute under the cursor as next input line in IPython. Additionally the row is stored as "_"</p>
52 <p>Pick the attribute under the cursor as next input line in IPython. Additionally the row is stored as "_"</p>
53
53
54 <h3>enter (E)</h3>
54 <h3>enter (E)</h3>
55 <p>Enter the object under the cursor. (what this mean depends on the object
55 <p>Enter the object under the cursor. (what this mean depends on the object
56 itself, i.e. how it implements iteration). This opens a new browser 'level'.</p>
56 itself, i.e. how it implements iteration). This opens a new browser 'level'.</p>
57
57
58 <h3>enterattr (Shift-E)</h3>
58 <h3>enterattr (Shift-E)</h3>
59 <p>Enter the attribute under the cursor.</p>
59 <p>Enter the attribute under the cursor.</p>
60
60
61 <h3>detail (D)</h3>
61 <h3>detail (D)</h3>
62 <p>Show a detail view of the object under the cursor. This shows the name,
62 <p>Show a detail view of the object under the cursor. This shows the name,
63 type, doc string and value of the object attributes (and it might show more
63 type, doc string and value of the object attributes (and it might show more
64 attributes than in the list view, depending on the object).</p>
64 attributes than in the list view, depending on the object).</p>
65
65
66 <h3>detailattr (Shift-D)</h3>
66 <h3>detailattr (Shift-D)</h3>
67 <p>Show a detail view of the attribute under the cursor.</p>
67 <p>Show a detail view of the attribute under the cursor.</p>
68
68
69 <h3>pickrows (M)</h3>
69 <h3>pickrows (M)</h3>
70 <p>Pick multiple selected rows (M)</p>
70 <p>Pick multiple selected rows (M)</p>
71
71
72 <h3>pickrowsattr (CTRL-M)</h3>
72 <h3>pickrowsattr (CTRL-M)</h3>
73 <p>From multiple selected rows pick the cells matching the attribute the cursor is in (CTRL-M)</p>
73 <p>From multiple selected rows pick the cells matching the attribute the cursor is in (CTRL-M)</p>
74
74
75 <h3>find (CTRL-F)</h3>
75 <h3>find (CTRL-F)</h3>
76 <p>Find text</p>
76 <p>Find text</p>
77
77
78 <h3>find_expression (CTRL-Shift-F)</h3>
78 <h3>find_expression (CTRL-Shift-F)</h3>
79 <p>Find entries matching an expression</p>
79 <p>Find entries matching an expression</p>
80
80
81 <h3>find_next (F3)</h3>
81 <h3>find_next (F3)</h3>
82 <p>Find next occurrence</p>
82 <p>Find next occurrence</p>
83
83
84 <h3>find_previous (Shift-F3)</h3>
84 <h3>find_previous (Shift-F3)</h3>
85 <p>Find previous occurrence</p>
85 <p>Find previous occurrence</p>
86
86
87 <h3>sortattrasc (V)</h3>
87 <h3>sortattrasc (V)</h3>
88 <p>Sort the objects (in ascending order) using the attribute under the cursor as the sort key.</p>
88 <p>Sort the objects (in ascending order) using the attribute under the cursor as the sort key.</p>
89
89
90 <h3>sortattrdesc (Shift-V)</h3>
90 <h3>sortattrdesc (Shift-V)</h3>
91 <p>Sort the objects (in descending order) using the attribute under the cursor as the sort key.</p>
91 <p>Sort the objects (in descending order) using the attribute under the cursor as the sort key.</p>
92
92
93 <h3>refresh_once (R, F5)</h3>
93 <h3>refresh_once (R, F5)</h3>
94 <p>Refreshes the display by restarting the iterator</p>
94 <p>Refreshes the display by restarting the iterator</p>
95
95
96 <h3>refresh_every_second</h3>
96 <h3>refresh_every_second</h3>
97 <p>Refreshes the display by restarting the iterator every second until stopped by stop_refresh.</p>
97 <p>Refreshes the display by restarting the iterator every second until stopped by stop_refresh.</p>
98
98
99 <h3>refresh_interval</h3>
99 <h3>refresh_interval</h3>
100 <p>Refreshes the display by restarting the iterator every X ms (X is a custom interval set by the user) until stopped by stop_refresh.</p>
100 <p>Refreshes the display by restarting the iterator every X ms (X is a custom interval set by the user) until stopped by stop_refresh.</p>
101
101
102 <h3>stop_refresh</h3>
102 <h3>stop_refresh</h3>
103 <p>Stops all refresh timers.</p>
103 <p>Stops all refresh timers.</p>
104
104
105 <h3>leave (Backspace, DEL, X)</h3>
105 <h3>leave (Backspace, DEL, X)</h3>
106 <p>Close current tab (and all the tabs to the right of the current one).</h3>
106 <p>Close current tab (and all the tabs to the right of the current one).</h3>
107
107
108 <h3>quit (ESC,Q)</h3>
108 <h3>quit (ESC,Q)</h3>
109 <p>Quit igrid and return to the IPython prompt.</p>
109 <p>Quit igrid and return to the IPython prompt.</p>
110
110
111
111
112 <h2>Navigation</h2>
112 <h2>Navigation</h2>
113
113
114
114
115 <h3>Jump to the last column of the current row (END, CTRL-E, CTRL-Right)</h3>
115 <h3>Jump to the last column of the current row (END, CTRL-E, CTRL-Right)</h3>
116
116
117 <h3>Jump to the first column of the current row (HOME, CTRL-A, CTRL-Left)</h3>
117 <h3>Jump to the first column of the current row (HOME, CTRL-A, CTRL-Left)</h3>
118
118
119 <h3>Move the cursor one column to the left (&lt;)</h3>
119 <h3>Move the cursor one column to the left (&lt;)</h3>
120
120
121 <h3>Move the cursor one column to the right (&gt;)</h3>
121 <h3>Move the cursor one column to the right (&gt;)</h3>
122
122
123 <h3>Jump to the first row in the current column (CTRL-Up)</h3>
123 <h3>Jump to the first row in the current column (CTRL-Up)</h3>
124
124
125 <h3>Jump to the last row in the current column (CTRL-Down)</h3>
125 <h3>Jump to the last row in the current column (CTRL-Down)</h3>
126
126
127 </body>
127 </body>
128 </html>
128 </html>
129
129
130 """
130 """
131
131
132
132
133 class IGridRenderer(wx.grid.PyGridCellRenderer):
133 class IGridRenderer(wx.grid.PyGridCellRenderer):
134 """
134 """
135 This is a custom renderer for our IGridGrid
135 This is a custom renderer for our IGridGrid
136 """
136 """
137 def __init__(self, table):
137 def __init__(self, table):
138 self.maxchars = 200
138 self.maxchars = 200
139 self.table = table
139 self.table = table
140 self.colormap = (
140 self.colormap = (
141 ( 0, 0, 0),
141 ( 0, 0, 0),
142 (174, 0, 0),
142 (174, 0, 0),
143 ( 0, 174, 0),
143 ( 0, 174, 0),
144 (174, 174, 0),
144 (174, 174, 0),
145 ( 0, 0, 174),
145 ( 0, 0, 174),
146 (174, 0, 174),
146 (174, 0, 174),
147 ( 0, 174, 174),
147 ( 0, 174, 174),
148 ( 64, 64, 64)
148 ( 64, 64, 64)
149 )
149 )
150
150
151 wx.grid.PyGridCellRenderer.__init__(self)
151 wx.grid.PyGridCellRenderer.__init__(self)
152
152
153 def _getvalue(self, row, col):
153 def _getvalue(self, row, col):
154 try:
154 try:
155 value = self.table._displayattrs[col].value(self.table.items[row])
155 value = self.table._displayattrs[col].value(self.table.items[row])
156 (align, width, text) = ipipe.xformat(value, "cell", self.maxchars)
156 (align, width, text) = ipipe.xformat(value, "cell", self.maxchars)
157 except Exception, exc:
157 except Exception, exc:
158 (align, width, text) = ipipe.xformat(exc, "cell", self.maxchars)
158 (align, width, text) = ipipe.xformat(exc, "cell", self.maxchars)
159 return (align, text)
159 return (align, text)
160
160
161 def GetBestSize(self, grid, attr, dc, row, col):
161 def GetBestSize(self, grid, attr, dc, row, col):
162 text = grid.GetCellValue(row, col)
162 text = grid.GetCellValue(row, col)
163 (align, text) = self._getvalue(row, col)
163 (align, text) = self._getvalue(row, col)
164 dc.SetFont(attr.GetFont())
164 dc.SetFont(attr.GetFont())
165 (w, h) = dc.GetTextExtent(str(text))
165 (w, h) = dc.GetTextExtent(str(text))
166 return wx.Size(min(w+2, 600), h+2) # add border
166 return wx.Size(min(w+2, 600), h+2) # add border
167
167
168 def Draw(self, grid, attr, dc, rect, row, col, isSelected):
168 def Draw(self, grid, attr, dc, rect, row, col, isSelected):
169 """
169 """
170 Takes care of drawing everything in the cell; aligns the text
170 Takes care of drawing everything in the cell; aligns the text
171 """
171 """
172 text = grid.GetCellValue(row, col)
172 text = grid.GetCellValue(row, col)
173 (align, text) = self._getvalue(row, col)
173 (align, text) = self._getvalue(row, col)
174 if isSelected:
174 if isSelected:
175 bg = grid.GetSelectionBackground()
175 bg = grid.GetSelectionBackground()
176 else:
176 else:
177 bg = ["white", (240, 240, 240)][row%2]
177 bg = ["white", (240, 240, 240)][row%2]
178 dc.SetTextBackground(bg)
178 dc.SetTextBackground(bg)
179 dc.SetBrush(wx.Brush(bg, wx.SOLID))
179 dc.SetBrush(wx.Brush(bg, wx.SOLID))
180 dc.SetPen(wx.TRANSPARENT_PEN)
180 dc.SetPen(wx.TRANSPARENT_PEN)
181 dc.SetFont(attr.GetFont())
181 dc.SetFont(attr.GetFont())
182 dc.DrawRectangleRect(rect)
182 dc.DrawRectangleRect(rect)
183 dc.SetClippingRect(rect)
183 dc.SetClippingRect(rect)
184 # Format the text
184 # Format the text
185 if align == -1: # left alignment
185 if align == -1: # left alignment
186 (width, height) = dc.GetTextExtent(str(text))
186 (width, height) = dc.GetTextExtent(str(text))
187 x = rect[0]+1
187 x = rect[0]+1
188 y = rect[1]+0.5*(rect[3]-height)
188 y = rect[1]+0.5*(rect[3]-height)
189
189
190 for (style, part) in text:
190 for (style, part) in text:
191 if isSelected:
191 if isSelected:
192 fg = grid.GetSelectionForeground()
192 fg = grid.GetSelectionForeground()
193 else:
193 else:
194 fg = self.colormap[style.fg]
194 fg = self.colormap[style.fg]
195 dc.SetTextForeground(fg)
195 dc.SetTextForeground(fg)
196 (w, h) = dc.GetTextExtent(part)
196 (w, h) = dc.GetTextExtent(part)
197 dc.DrawText(part, x, y)
197 dc.DrawText(part, x, y)
198 x += w
198 x += w
199 elif align == 0: # center alignment
199 elif align == 0: # center alignment
200 (width, height) = dc.GetTextExtent(str(text))
200 (width, height) = dc.GetTextExtent(str(text))
201 x = rect[0]+0.5*(rect[2]-width)
201 x = rect[0]+0.5*(rect[2]-width)
202 y = rect[1]+0.5*(rect[3]-height)
202 y = rect[1]+0.5*(rect[3]-height)
203 for (style, part) in text:
203 for (style, part) in text:
204 if isSelected:
204 if isSelected:
205 fg = grid.GetSelectionForeground()
205 fg = grid.GetSelectionForeground()
206 else:
206 else:
207 fg = self.colormap[style.fg]
207 fg = self.colormap[style.fg]
208 dc.SetTextForeground(fg)
208 dc.SetTextForeground(fg)
209 (w, h) = dc.GetTextExtent(part)
209 (w, h) = dc.GetTextExtent(part)
210 dc.DrawText(part, x, y)
210 dc.DrawText(part, x, y)
211 x += w
211 x += w
212 else: # right alignment
212 else: # right alignment
213 (width, height) = dc.GetTextExtent(str(text))
213 (width, height) = dc.GetTextExtent(str(text))
214 x = rect[0]+rect[2]-1
214 x = rect[0]+rect[2]-1
215 y = rect[1]+0.5*(rect[3]-height)
215 y = rect[1]+0.5*(rect[3]-height)
216 for (style, part) in reversed(text):
216 for (style, part) in reversed(text):
217 (w, h) = dc.GetTextExtent(part)
217 (w, h) = dc.GetTextExtent(part)
218 x -= w
218 x -= w
219 if isSelected:
219 if isSelected:
220 fg = grid.GetSelectionForeground()
220 fg = grid.GetSelectionForeground()
221 else:
221 else:
222 fg = self.colormap[style.fg]
222 fg = self.colormap[style.fg]
223 dc.SetTextForeground(fg)
223 dc.SetTextForeground(fg)
224 dc.DrawText(part, x, y)
224 dc.DrawText(part, x, y)
225 dc.DestroyClippingRegion()
225 dc.DestroyClippingRegion()
226
226
227 def Clone(self):
227 def Clone(self):
228 return IGridRenderer(self.table)
228 return IGridRenderer(self.table)
229
229
230
230
231 class IGridTable(wx.grid.PyGridTableBase):
231 class IGridTable(wx.grid.PyGridTableBase):
232 # The data table for the ``IGridGrid``. Some dirty tricks were used here:
232 # The data table for the ``IGridGrid``. Some dirty tricks were used here:
233 # ``GetValue()`` does not get any values (or at least it does not return
233 # ``GetValue()`` does not get any values (or at least it does not return
234 # anything, accessing the values is done by the renderer)
234 # anything, accessing the values is done by the renderer)
235 # but rather tries to fetch the objects which were requested into the table.
235 # but rather tries to fetch the objects which were requested into the table.
236 # General behaviour is: Fetch the first X objects. If the user scrolls down
236 # General behaviour is: Fetch the first X objects. If the user scrolls down
237 # to the last object another bunch of X objects is fetched (if possible)
237 # to the last object another bunch of X objects is fetched (if possible)
238 def __init__(self, input, fontsize, *attrs):
238 def __init__(self, input, fontsize, *attrs):
239 wx.grid.PyGridTableBase.__init__(self)
239 wx.grid.PyGridTableBase.__init__(self)
240 self.input = input
240 self.input = input
241 self.iterator = ipipe.xiter(input)
241 self.iterator = ipipe.xiter(input)
242 self.items = []
242 self.items = []
243 self.attrs = [ipipe.upgradexattr(attr) for attr in attrs]
243 self.attrs = [ipipe.upgradexattr(attr) for attr in attrs]
244 self._displayattrs = self.attrs[:]
244 self._displayattrs = self.attrs[:]
245 self._displayattrset = set(self.attrs)
245 self._displayattrset = set(self.attrs)
246 self.fontsize = fontsize
246 self.fontsize = fontsize
247 self._fetch(1)
247 self._fetch(1)
248 self.timer = wx.Timer()
248 self.timer = wx.Timer()
249 self.timer.Bind(wx.EVT_TIMER, self.refresh_content)
249 self.timer.Bind(wx.EVT_TIMER, self.refresh_content)
250
250
251 def GetAttr(self, *args):
251 def GetAttr(self, *args):
252 attr = wx.grid.GridCellAttr()
252 attr = wx.grid.GridCellAttr()
253 attr.SetFont(wx.Font(self.fontsize, wx.TELETYPE, wx.NORMAL, wx.NORMAL))
253 attr.SetFont(wx.Font(self.fontsize, wx.TELETYPE, wx.NORMAL, wx.NORMAL))
254 return attr
254 return attr
255
255
256 def GetNumberRows(self):
256 def GetNumberRows(self):
257 return len(self.items)
257 return len(self.items)
258
258
259 def GetNumberCols(self):
259 def GetNumberCols(self):
260 return len(self._displayattrs)
260 return len(self._displayattrs)
261
261
262 def GetColLabelValue(self, col):
262 def GetColLabelValue(self, col):
263 if col < len(self._displayattrs):
263 if col < len(self._displayattrs):
264 return self._displayattrs[col].name()
264 return self._displayattrs[col].name()
265 else:
265 else:
266 return ""
266 return ""
267
267
268 def GetRowLabelValue(self, row):
268 def GetRowLabelValue(self, row):
269 return str(row)
269 return str(row)
270
270
271 def IsEmptyCell(self, row, col):
271 def IsEmptyCell(self, row, col):
272 return False
272 return False
273
273
274 def _append(self, item):
274 def _append(self, item):
275 self.items.append(item)
275 self.items.append(item)
276 # Nothing to do if the set of attributes has been fixed by the user
276 # Nothing to do if the set of attributes has been fixed by the user
277 if not self.attrs:
277 if not self.attrs:
278 for attr in ipipe.xattrs(item):
278 for attr in ipipe.xattrs(item):
279 attr = ipipe.upgradexattr(attr)
279 attr = ipipe.upgradexattr(attr)
280 if attr not in self._displayattrset:
280 if attr not in self._displayattrset:
281 self._displayattrs.append(attr)
281 self._displayattrs.append(attr)
282 self._displayattrset.add(attr)
282 self._displayattrset.add(attr)
283
283
284 def _fetch(self, count):
284 def _fetch(self, count):
285 # Try to fill ``self.items`` with at least ``count`` objects.
285 # Try to fill ``self.items`` with at least ``count`` objects.
286 have = len(self.items)
286 have = len(self.items)
287 while self.iterator is not None and have < count:
287 while self.iterator is not None and have < count:
288 try:
288 try:
289 item = self.iterator.next()
289 item = self.iterator.next()
290 except StopIteration:
290 except StopIteration:
291 self.iterator = None
291 self.iterator = None
292 break
292 break
293 except (KeyboardInterrupt, SystemExit):
293 except (KeyboardInterrupt, SystemExit):
294 raise
294 raise
295 except Exception, exc:
295 except Exception, exc:
296 have += 1
296 have += 1
297 self._append(exc)
297 self._append(exc)
298 self.iterator = None
298 self.iterator = None
299 break
299 break
300 else:
300 else:
301 have += 1
301 have += 1
302 self._append(item)
302 self._append(item)
303
303
304 def GetValue(self, row, col):
304 def GetValue(self, row, col):
305 # some kind of dummy-function: does not return anything but "";
305 # some kind of dummy-function: does not return anything but "";
306 # (The value isn't use anyway)
306 # (The value isn't use anyway)
307 # its main task is to trigger the fetch of new objects
307 # its main task is to trigger the fetch of new objects
308 sizing_needed = False
308 sizing_needed = False
309 had_cols = len(self._displayattrs)
309 had_cols = len(self._displayattrs)
310 had_rows = len(self.items)
310 had_rows = len(self.items)
311 if row == had_rows - 1 and self.iterator is not None:
311 if row == had_rows - 1 and self.iterator is not None:
312 self._fetch(row + 20)
312 self._fetch(row + 20)
313 sizing_needed = True
313 sizing_needed = True
314 have_rows = len(self.items)
314 have_rows = len(self.items)
315 have_cols = len(self._displayattrs)
315 have_cols = len(self._displayattrs)
316 if have_rows > had_rows:
316 if have_rows > had_rows:
317 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED, have_rows - had_rows)
317 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED, have_rows - had_rows)
318 self.GetView().ProcessTableMessage(msg)
318 self.GetView().ProcessTableMessage(msg)
319 sizing_needed = True
319 sizing_needed = True
320 if row >= have_rows:
320 if row >= have_rows:
321 return ""
321 return ""
322 if have_cols != had_cols:
322 if have_cols != had_cols:
323 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED, have_cols - had_cols)
323 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED, have_cols - had_cols)
324 self.GetView().ProcessTableMessage(msg)
324 self.GetView().ProcessTableMessage(msg)
325 sizing_needed = True
325 sizing_needed = True
326 if sizing_needed:
326 if sizing_needed:
327 self.GetView().AutoSizeColumns(False)
327 self.GetView().AutoSizeColumns(False)
328 return ""
328 return ""
329
329
330 def SetValue(self, row, col, value):
330 def SetValue(self, row, col, value):
331 pass
331 pass
332
332
333 def refresh_content(self, event):
333 def refresh_content(self, event):
334 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, 0, self.GetNumberRows())
334 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, 0, self.GetNumberRows())
335 self.GetView().ProcessTableMessage(msg)
335 self.GetView().ProcessTableMessage(msg)
336 self.iterator = ipipe.xiter(self.input)
336 self.iterator = ipipe.xiter(self.input)
337 self.items = []
337 self.items = []
338 self.attrs = [] # _append will calculate new displayattrs
338 self.attrs = [] # _append will calculate new displayattrs
339 self._fetch(1) # fetch one...
339 self._fetch(1) # fetch one...
340 if self.items:
340 if self.items:
341 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED, 1)
341 msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED, 1)
342 self.GetView().ProcessTableMessage(msg)
342 self.GetView().ProcessTableMessage(msg)
343 self.GetValue(0, 0) # and trigger "fetch next 20"
343 self.GetValue(0, 0) # and trigger "fetch next 20"
344 item = self.items[0]
344 item = self.items[0]
345 self.GetView().AutoSizeColumns(False)
345 self.GetView().AutoSizeColumns(False)
346 panel = self.GetView().GetParent()
346 panel = self.GetView().GetParent()
347 nb = panel.GetParent()
347 nb = panel.GetParent()
348 current = nb.GetSelection()
348 current = nb.GetSelection()
349 if nb.GetPage(current) == panel:
349 if nb.GetPage(current) == panel:
350 self.GetView().set_footer(item)
350 self.GetView().set_footer(item)
351
351
352 class IGridGrid(wx.grid.Grid):
352 class IGridGrid(wx.grid.Grid):
353 # The actual grid
353 # The actual grid
354 # all methods for selecting/sorting/picking/... data are implemented here
354 # all methods for selecting/sorting/picking/... data are implemented here
355 def __init__(self, panel, input, *attrs):
355 def __init__(self, panel, input, *attrs):
356 wx.grid.Grid.__init__(self, panel)
356 wx.grid.Grid.__init__(self, panel)
357 fontsize = 9
357 fontsize = 9
358 self.input = input
358 self.input = input
359 self.table = IGridTable(self.input, fontsize, *attrs)
359 self.table = IGridTable(self.input, fontsize, *attrs)
360 self.SetTable(self.table, True)
360 self.SetTable(self.table, True)
361 self.SetSelectionMode(wx.grid.Grid.wxGridSelectRows)
361 self.SetSelectionMode(wx.grid.Grid.wxGridSelectRows)
362 self.SetDefaultRenderer(IGridRenderer(self.table))
362 self.SetDefaultRenderer(IGridRenderer(self.table))
363 self.EnableEditing(False)
363 self.EnableEditing(False)
364 self.Bind(wx.EVT_KEY_DOWN, self.key_pressed)
364 self.Bind(wx.EVT_KEY_DOWN, self.key_pressed)
365 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.cell_doubleclicked)
365 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.cell_doubleclicked)
366 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.cell_leftclicked)
366 self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.cell_leftclicked)
367 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.label_doubleclicked)
367 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.label_doubleclicked)
368 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_label_leftclick)
368 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_label_leftclick)
369 self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self._on_selected_range)
369 self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self._on_selected_range)
370 self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self._on_selected_cell)
370 self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self._on_selected_cell)
371 self.current_selection = set()
371 self.current_selection = set()
372 self.maxchars = 200
372 self.maxchars = 200
373
373
374 def on_label_leftclick(self, event):
374 def on_label_leftclick(self, event):
375 event.Skip()
375 event.Skip()
376
376
377 def error_output(self, text):
377 def error_output(self, text):
378 wx.Bell()
378 wx.Bell()
379 frame = self.GetParent().GetParent().GetParent()
379 frame = self.GetParent().GetParent().GetParent()
380 frame.SetStatusText(str(text))
380 frame.SetStatusText(str(text))
381
381
382 def _on_selected_range(self, event):
382 def _on_selected_range(self, event):
383 # Internal update to the selection tracking lists
383 # Internal update to the selection tracking lists
384 if event.Selecting():
384 if event.Selecting():
385 # adding to the list...
385 # adding to the list...
386 self.current_selection.update(xrange(event.GetTopRow(), event.GetBottomRow()+1))
386 self.current_selection.update(xrange(event.GetTopRow(), event.GetBottomRow()+1))
387 else:
387 else:
388 # removal from list
388 # removal from list
389 for index in xrange(event.GetTopRow(), event.GetBottomRow()+1):
389 for index in xrange(event.GetTopRow(), event.GetBottomRow()+1):
390 self.current_selection.discard(index)
390 self.current_selection.discard(index)
391 event.Skip()
391 event.Skip()
392
392
393 def _on_selected_cell(self, event):
393 def _on_selected_cell(self, event):
394 # Internal update to the selection tracking list
394 # Internal update to the selection tracking list
395 self.current_selection = set([event.GetRow()])
395 self.current_selection = set([event.GetRow()])
396 event.Skip()
396 event.Skip()
397
397
398 def sort(self, key, reverse=False):
398 def sort(self, key, reverse=False):
399 """
399 """
400 Sort the current list of items using the key function ``key``. If
400 Sort the current list of items using the key function ``key``. If
401 ``reverse`` is true the sort order is reversed.
401 ``reverse`` is true the sort order is reversed.
402 """
402 """
403 row = self.GetGridCursorRow()
403 row = self.GetGridCursorRow()
404 col = self.GetGridCursorCol()
404 col = self.GetGridCursorCol()
405 curitem = self.table.items[row] # Remember where the cursor is now
405 curitem = self.table.items[row] # Remember where the cursor is now
406 # Sort items
406 # Sort items
407 def realkey(item):
407 def realkey(item):
408 try:
408 try:
409 return key(item)
409 return key(item)
410 except (KeyboardInterrupt, SystemExit):
410 except (KeyboardInterrupt, SystemExit):
411 raise
411 raise
412 except Exception:
412 except Exception:
413 return None
413 return None
414 try:
414 try:
415 self.table.items = ipipe.deque(sorted(self.table.items, key=realkey, reverse=reverse))
415 self.table.items = ipipe.deque(sorted(self.table.items, key=realkey, reverse=reverse))
416 except TypeError, exc:
416 except TypeError, exc:
417 self.error_output("Exception encountered: %s" % exc)
417 self.error_output("Exception encountered: %s" % exc)
418 return
418 return
419 # Find out where the object under the cursor went
419 # Find out where the object under the cursor went
420 for (i, item) in enumerate(self.table.items):
420 for (i, item) in enumerate(self.table.items):
421 if item is curitem:
421 if item is curitem:
422 self.SetGridCursor(i,col)
422 self.SetGridCursor(i,col)
423 self.MakeCellVisible(i,col)
423 self.MakeCellVisible(i,col)
424 self.Refresh()
424 self.Refresh()
425
425
426 def sortattrasc(self):
426 def sortattrasc(self):
427 """
427 """
428 Sort in ascending order; sorting criteria is the current attribute
428 Sort in ascending order; sorting criteria is the current attribute
429 """
429 """
430 col = self.GetGridCursorCol()
430 col = self.GetGridCursorCol()
431 attr = self.table._displayattrs[col]
431 attr = self.table._displayattrs[col]
432 frame = self.GetParent().GetParent().GetParent()
432 frame = self.GetParent().GetParent().GetParent()
433 if attr is ipipe.noitem:
433 if attr is ipipe.noitem:
434 self.error_output("no column under cursor")
434 self.error_output("no column under cursor")
435 return
435 return
436 frame.SetStatusText("sort by %s (ascending)" % attr.name())
436 frame.SetStatusText("sort by %s (ascending)" % attr.name())
437 def key(item):
437 def key(item):
438 try:
438 try:
439 return attr.value(item)
439 return attr.value(item)
440 except (KeyboardInterrupt, SystemExit):
440 except (KeyboardInterrupt, SystemExit):
441 raise
441 raise
442 except Exception:
442 except Exception:
443 return None
443 return None
444 self.sort(key)
444 self.sort(key)
445
445
446 def sortattrdesc(self):
446 def sortattrdesc(self):
447 """
447 """
448 Sort in descending order; sorting criteria is the current attribute
448 Sort in descending order; sorting criteria is the current attribute
449 """
449 """
450 col = self.GetGridCursorCol()
450 col = self.GetGridCursorCol()
451 attr = self.table._displayattrs[col]
451 attr = self.table._displayattrs[col]
452 frame = self.GetParent().GetParent().GetParent()
452 frame = self.GetParent().GetParent().GetParent()
453 if attr is ipipe.noitem:
453 if attr is ipipe.noitem:
454 self.error_output("no column under cursor")
454 self.error_output("no column under cursor")
455 return
455 return
456 frame.SetStatusText("sort by %s (descending)" % attr.name())
456 frame.SetStatusText("sort by %s (descending)" % attr.name())
457 def key(item):
457 def key(item):
458 try:
458 try:
459 return attr.value(item)
459 return attr.value(item)
460 except (KeyboardInterrupt, SystemExit):
460 except (KeyboardInterrupt, SystemExit):
461 raise
461 raise
462 except Exception:
462 except Exception:
463 return None
463 return None
464 self.sort(key, reverse=True)
464 self.sort(key, reverse=True)
465
465
466 def label_doubleclicked(self, event):
466 def label_doubleclicked(self, event):
467 row = event.GetRow()
467 row = event.GetRow()
468 col = event.GetCol()
468 col = event.GetCol()
469 if col == -1:
469 if col == -1:
470 self.enter(row)
470 self.enter(row)
471
471
472 def _getvalue(self, row, col):
472 def _getvalue(self, row, col):
473 """
473 """
474 Gets the text which is displayed at ``(row, col)``
474 Gets the text which is displayed at ``(row, col)``
475 """
475 """
476 try:
476 try:
477 value = self.table._displayattrs[col].value(self.table.items[row])
477 value = self.table._displayattrs[col].value(self.table.items[row])
478 (align, width, text) = ipipe.xformat(value, "cell", self.maxchars)
478 (align, width, text) = ipipe.xformat(value, "cell", self.maxchars)
479 except IndexError:
479 except IndexError:
480 raise IndexError
480 raise IndexError
481 except Exception, exc:
481 except Exception, exc:
482 (align, width, text) = ipipe.xformat(exc, "cell", self.maxchars)
482 (align, width, text) = ipipe.xformat(exc, "cell", self.maxchars)
483 return text
483 return text
484
484
485 def searchexpression(self, searchexp, startrow=None, search_forward=True ):
485 def searchexpression(self, searchexp, startrow=None, search_forward=True ):
486 """
486 """
487 Find by expression
487 Find by expression
488 """
488 """
489 frame = self.GetParent().GetParent().GetParent()
489 frame = self.GetParent().GetParent().GetParent()
490 if searchexp:
490 if searchexp:
491 if search_forward:
491 if search_forward:
492 if not startrow:
492 if not startrow:
493 row = self.GetGridCursorRow()+1
493 row = self.GetGridCursorRow()+1
494 else:
494 else:
495 row = startrow + 1
495 row = startrow + 1
496 while True:
496 while True:
497 try:
497 try:
498 foo = self.table.GetValue(row, 0)
498 foo = self.table.GetValue(row, 0)
499 item = self.table.items[row]
499 item = self.table.items[row]
500 try:
500 try:
501 globals = ipipe.getglobals(None)
501 globals = ipipe.getglobals(None)
502 if eval(searchexp, globals, ipipe.AttrNamespace(item)):
502 if eval(searchexp, globals, ipipe.AttrNamespace(item)):
503 self.SetGridCursor(row, 0) # found something
503 self.SetGridCursor(row, 0) # found something
504 self.MakeCellVisible(row, 0)
504 self.MakeCellVisible(row, 0)
505 break
505 break
506 except (KeyboardInterrupt, SystemExit):
506 except (KeyboardInterrupt, SystemExit):
507 raise
507 raise
508 except Exception, exc:
508 except Exception, exc:
509 frame.SetStatusText(str(exc))
509 frame.SetStatusText(str(exc))
510 wx.Bell()
510 wx.Bell()
511 break # break on error
511 break # break on error
512 except IndexError:
512 except IndexError:
513 return
513 return
514 row += 1
514 row += 1
515 else:
515 else:
516 if not startrow:
516 if not startrow:
517 row = self.GetGridCursorRow() - 1
517 row = self.GetGridCursorRow() - 1
518 else:
518 else:
519 row = startrow - 1
519 row = startrow - 1
520 while True:
520 while True:
521 try:
521 try:
522 foo = self.table.GetValue(row, 0)
522 foo = self.table.GetValue(row, 0)
523 item = self.table.items[row]
523 item = self.table.items[row]
524 try:
524 try:
525 globals = ipipe.getglobals(None)
525 globals = ipipe.getglobals(None)
526 if eval(searchexp, globals, ipipe.AttrNamespace(item)):
526 if eval(searchexp, globals, ipipe.AttrNamespace(item)):
527 self.SetGridCursor(row, 0) # found something
527 self.SetGridCursor(row, 0) # found something
528 self.MakeCellVisible(row, 0)
528 self.MakeCellVisible(row, 0)
529 break
529 break
530 except (KeyboardInterrupt, SystemExit):
530 except (KeyboardInterrupt, SystemExit):
531 raise
531 raise
532 except Exception, exc:
532 except Exception, exc:
533 frame.SetStatusText(str(exc))
533 frame.SetStatusText(str(exc))
534 wx.Bell()
534 wx.Bell()
535 break # break on error
535 break # break on error
536 except IndexError:
536 except IndexError:
537 return
537 return
538 row -= 1
538 row -= 1
539
539
540
540
541 def search(self, searchtext, startrow=None, startcol=None, search_forward=True):
541 def search(self, searchtext, startrow=None, startcol=None, search_forward=True):
542 """
542 """
543 search for ``searchtext``, starting in ``(startrow, startcol)``;
543 search for ``searchtext``, starting in ``(startrow, startcol)``;
544 if ``search_forward`` is true the direction is "forward"
544 if ``search_forward`` is true the direction is "forward"
545 """
545 """
546 searchtext = searchtext.lower()
546 searchtext = searchtext.lower()
547 if search_forward:
547 if search_forward:
548 if startrow is not None and startcol is not None:
548 if startrow is not None and startcol is not None:
549 row = startrow
549 row = startrow
550 else:
550 else:
551 startcol = self.GetGridCursorCol() + 1
551 startcol = self.GetGridCursorCol() + 1
552 row = self.GetGridCursorRow()
552 row = self.GetGridCursorRow()
553 if startcol >= self.GetNumberCols():
553 if startcol >= self.GetNumberCols():
554 startcol = 0
554 startcol = 0
555 row += 1
555 row += 1
556 while True:
556 while True:
557 for col in xrange(startcol, self.table.GetNumberCols()):
557 for col in xrange(startcol, self.table.GetNumberCols()):
558 try:
558 try:
559 foo = self.table.GetValue(row, col)
559 foo = self.table.GetValue(row, col)
560 text = self._getvalue(row, col)
560 text = self._getvalue(row, col)
561 if searchtext in text.string().lower():
561 if searchtext in text.string().lower():
562 self.SetGridCursor(row, col)
562 self.SetGridCursor(row, col)
563 self.MakeCellVisible(row, col)
563 self.MakeCellVisible(row, col)
564 return
564 return
565 except IndexError:
565 except IndexError:
566 return
566 return
567 startcol = 0
567 startcol = 0
568 row += 1
568 row += 1
569 else:
569 else:
570 if startrow is not None and startcol is not None:
570 if startrow is not None and startcol is not None:
571 row = startrow
571 row = startrow
572 else:
572 else:
573 startcol = self.GetGridCursorCol() - 1
573 startcol = self.GetGridCursorCol() - 1
574 row = self.GetGridCursorRow()
574 row = self.GetGridCursorRow()
575 if startcol < 0:
575 if startcol < 0:
576 startcol = self.GetNumberCols() - 1
576 startcol = self.GetNumberCols() - 1
577 row -= 1
577 row -= 1
578 while True:
578 while True:
579 for col in xrange(startcol, -1, -1):
579 for col in xrange(startcol, -1, -1):
580 try:
580 try:
581 foo = self.table.GetValue(row, col)
581 foo = self.table.GetValue(row, col)
582 text = self._getvalue(row, col)
582 text = self._getvalue(row, col)
583 if searchtext in text.string().lower():
583 if searchtext in text.string().lower():
584 self.SetGridCursor(row, col)
584 self.SetGridCursor(row, col)
585 self.MakeCellVisible(row, col)
585 self.MakeCellVisible(row, col)
586 return
586 return
587 except IndexError:
587 except IndexError:
588 return
588 return
589 startcol = self.table.GetNumberCols()-1
589 startcol = self.table.GetNumberCols()-1
590 row -= 1
590 row -= 1
591
591
592 def key_pressed(self, event):
592 def key_pressed(self, event):
593 """
593 """
594 Maps pressed keys to functions
594 Maps pressed keys to functions
595 """
595 """
596 frame = self.GetParent().GetParent().GetParent()
596 frame = self.GetParent().GetParent().GetParent()
597 frame.SetStatusText("")
597 frame.SetStatusText("")
598 sh = event.ShiftDown()
598 sh = event.ShiftDown()
599 ctrl = event.ControlDown()
599 ctrl = event.ControlDown()
600
600
601 keycode = event.GetKeyCode()
601 keycode = event.GetKeyCode()
602 if keycode == ord("P"):
602 if keycode == ord("P"):
603 row = self.GetGridCursorRow()
603 row = self.GetGridCursorRow()
604 if sh:
604 if sh:
605 col = self.GetGridCursorCol()
605 col = self.GetGridCursorCol()
606 self.pickattr(row, col)
606 self.pickattr(row, col)
607 else:
607 else:
608 self.pick(row)
608 self.pick(row)
609 elif keycode == ord("M"):
609 elif keycode == ord("M"):
610 if ctrl:
610 if ctrl:
611 col = self.GetGridCursorCol()
611 col = self.GetGridCursorCol()
612 self.pickrowsattr(sorted(self.current_selection), col)
612 self.pickrowsattr(sorted(self.current_selection), col)
613 else:
613 else:
614 self.pickrows(sorted(self.current_selection))
614 self.pickrows(sorted(self.current_selection))
615 elif keycode in (wx.WXK_BACK, wx.WXK_DELETE, ord("X")) and not (ctrl or sh):
615 elif keycode in (wx.WXK_BACK, wx.WXK_DELETE, ord("X")) and not (ctrl or sh):
616 self.delete_current_notebook()
616 self.delete_current_notebook()
617 elif keycode in (ord("E"), ord("\r")):
617 elif keycode in (ord("E"), ord("\r")):
618 row = self.GetGridCursorRow()
618 row = self.GetGridCursorRow()
619 if sh:
619 if sh:
620 col = self.GetGridCursorCol()
620 col = self.GetGridCursorCol()
621 self.enterattr(row, col)
621 self.enterattr(row, col)
622 else:
622 else:
623 self.enter(row)
623 self.enter(row)
624 elif keycode == ord("E") and ctrl:
624 elif keycode == ord("E") and ctrl:
625 row = self.GetGridCursorRow()
625 row = self.GetGridCursorRow()
626 self.SetGridCursor(row, self.GetNumberCols()-1)
626 self.SetGridCursor(row, self.GetNumberCols()-1)
627 elif keycode == wx.WXK_HOME or (keycode == ord("A") and ctrl):
627 elif keycode == wx.WXK_HOME or (keycode == ord("A") and ctrl):
628 row = self.GetGridCursorRow()
628 row = self.GetGridCursorRow()
629 self.SetGridCursor(row, 0)
629 self.SetGridCursor(row, 0)
630 elif keycode == ord("C") and sh:
630 elif keycode == ord("C") and sh:
631 col = self.GetGridCursorCol()
631 col = self.GetGridCursorCol()
632 attr = self.table._displayattrs[col]
632 attr = self.table._displayattrs[col]
633 result = []
633 result = []
634 for i in xrange(self.GetNumberRows()):
634 for i in xrange(self.GetNumberRows()):
635 result.append(self.table._displayattrs[col].value(self.table.items[i]))
635 result.append(self.table._displayattrs[col].value(self.table.items[i]))
636 self.quit(result)
636 self.quit(result)
637 elif keycode in (wx.WXK_ESCAPE, ord("Q")) and not (ctrl or sh):
637 elif keycode in (wx.WXK_ESCAPE, ord("Q")) and not (ctrl or sh):
638 self.quit()
638 self.quit()
639 elif keycode == ord("<"):
639 elif keycode == ord("<"):
640 row = self.GetGridCursorRow()
640 row = self.GetGridCursorRow()
641 col = self.GetGridCursorCol()
641 col = self.GetGridCursorCol()
642 if not event.ShiftDown():
642 if not event.ShiftDown():
643 newcol = col - 1
643 newcol = col - 1
644 if newcol >= 0:
644 if newcol >= 0:
645 self.SetGridCursor(row, col - 1)
645 self.SetGridCursor(row, col - 1)
646 else:
646 else:
647 newcol = col + 1
647 newcol = col + 1
648 if newcol < self.GetNumberCols():
648 if newcol < self.GetNumberCols():
649 self.SetGridCursor(row, col + 1)
649 self.SetGridCursor(row, col + 1)
650 elif keycode == ord("D"):
650 elif keycode == ord("D"):
651 col = self.GetGridCursorCol()
651 col = self.GetGridCursorCol()
652 row = self.GetGridCursorRow()
652 row = self.GetGridCursorRow()
653 if not sh:
653 if not sh:
654 self.detail(row, col)
654 self.detail(row, col)
655 else:
655 else:
656 self.detail_attr(row, col)
656 self.detail_attr(row, col)
657 elif keycode == ord("F") and ctrl:
657 elif keycode == ord("F") and ctrl:
658 if sh:
658 if sh:
659 frame.enter_searchexpression(event)
659 frame.enter_searchexpression(event)
660 else:
660 else:
661 frame.enter_searchtext(event)
661 frame.enter_searchtext(event)
662 elif keycode == wx.WXK_F3:
662 elif keycode == wx.WXK_F3:
663 if sh:
663 if sh:
664 frame.find_previous(event)
664 frame.find_previous(event)
665 else:
665 else:
666 frame.find_next(event)
666 frame.find_next(event)
667 elif keycode == ord("V"):
667 elif keycode == ord("V"):
668 if sh:
668 if sh:
669 self.sortattrdesc()
669 self.sortattrdesc()
670 else:
670 else:
671 self.sortattrasc()
671 self.sortattrasc()
672 elif keycode == wx.WXK_DOWN:
672 elif keycode == wx.WXK_DOWN:
673 row = self.GetGridCursorRow()
673 row = self.GetGridCursorRow()
674 try:
674 try:
675 item = self.table.items[row+1]
675 item = self.table.items[row+1]
676 except IndexError:
676 except IndexError:
677 item = self.table.items[row]
677 item = self.table.items[row]
678 self.set_footer(item)
678 self.set_footer(item)
679 event.Skip()
679 event.Skip()
680 elif keycode == wx.WXK_UP:
680 elif keycode == wx.WXK_UP:
681 row = self.GetGridCursorRow()
681 row = self.GetGridCursorRow()
682 if row >= 1:
682 if row >= 1:
683 item = self.table.items[row-1]
683 item = self.table.items[row-1]
684 else:
684 else:
685 item = self.table.items[row]
685 item = self.table.items[row]
686 self.set_footer(item)
686 self.set_footer(item)
687 event.Skip()
687 event.Skip()
688 elif keycode == wx.WXK_RIGHT:
688 elif keycode == wx.WXK_RIGHT:
689 row = self.GetGridCursorRow()
689 row = self.GetGridCursorRow()
690 item = self.table.items[row]
690 item = self.table.items[row]
691 self.set_footer(item)
691 self.set_footer(item)
692 event.Skip()
692 event.Skip()
693 elif keycode == wx.WXK_LEFT:
693 elif keycode == wx.WXK_LEFT:
694 row = self.GetGridCursorRow()
694 row = self.GetGridCursorRow()
695 item = self.table.items[row]
695 item = self.table.items[row]
696 self.set_footer(item)
696 self.set_footer(item)
697 event.Skip()
697 event.Skip()
698 elif keycode == ord("R") or keycode == wx.WXK_F5:
698 elif keycode == ord("R") or keycode == wx.WXK_F5:
699 self.table.refresh_content(event)
699 self.table.refresh_content(event)
700 elif keycode == ord("I"):
700 elif keycode == ord("I"):
701 row = self.GetGridCursorRow()
701 row = self.GetGridCursorRow()
702 if not sh:
702 if not sh:
703 self.pickinput(row)
703 self.pickinput(row)
704 else:
704 else:
705 col = self.GetGridCursorCol()
705 col = self.GetGridCursorCol()
706 self.pickinputattr(row, col)
706 self.pickinputattr(row, col)
707 else:
707 else:
708 event.Skip()
708 event.Skip()
709
709
710 def delete_current_notebook(self):
710 def delete_current_notebook(self):
711 """
711 """
712 deletes the current notebook tab
712 deletes the current notebook tab
713 """
713 """
714 panel = self.GetParent()
714 panel = self.GetParent()
715 nb = panel.GetParent()
715 nb = panel.GetParent()
716 current = nb.GetSelection()
716 current = nb.GetSelection()
717 count = nb.GetPageCount()
717 count = nb.GetPageCount()
718 if count > 1:
718 if count > 1:
719 for i in xrange(count-1, current-1, -1):
719 for i in xrange(count-1, current-1, -1):
720 nb.DeletePage(i)
720 nb.DeletePage(i)
721 nb.GetCurrentPage().grid.SetFocus()
721 nb.GetCurrentPage().grid.SetFocus()
722 else:
722 else:
723 frame = nb.GetParent()
723 frame = nb.GetParent()
724 frame.SetStatusText("This is the last level!")
724 frame.SetStatusText("This is the last level!")
725
725
726 def _doenter(self, value, *attrs):
726 def _doenter(self, value, *attrs):
727 """
727 """
728 "enter" a special item resulting in a new notebook tab
728 "enter" a special item resulting in a new notebook tab
729 """
729 """
730 panel = self.GetParent()
730 panel = self.GetParent()
731 nb = panel.GetParent()
731 nb = panel.GetParent()
732 frame = nb.GetParent()
732 frame = nb.GetParent()
733 current = nb.GetSelection()
733 current = nb.GetSelection()
734 count = nb.GetPageCount()
734 count = nb.GetPageCount()
735 try: # if we want to enter something non-iterable, e.g. a function
735 try: # if we want to enter something non-iterable, e.g. a function
736 if current + 1 == count and value is not self.input: # we have an event in the last tab
736 if current + 1 == count and value is not self.input: # we have an event in the last tab
737 frame._add_notebook(value, *attrs)
737 frame._add_notebook(value, *attrs)
738 elif value != self.input: # we have to delete all tabs newer than [panel] first
738 elif value != self.input: # we have to delete all tabs newer than [panel] first
739 for i in xrange(count-1, current, -1): # some tabs don't close if we don't close in *reverse* order
739 for i in xrange(count-1, current, -1): # some tabs don't close if we don't close in *reverse* order
740 nb.DeletePage(i)
740 nb.DeletePage(i)
741 frame._add_notebook(value)
741 frame._add_notebook(value)
742 except TypeError, exc:
742 except TypeError, exc:
743 if exc.__class__.__module__ == "exceptions":
743 if exc.__class__.__module__ == "exceptions":
744 msg = "%s: %s" % (exc.__class__.__name__, exc)
744 msg = "%s: %s" % (exc.__class__.__name__, exc)
745 else:
745 else:
746 msg = "%s.%s: %s" % (exc.__class__.__module__, exc.__class__.__name__, exc)
746 msg = "%s.%s: %s" % (exc.__class__.__module__, exc.__class__.__name__, exc)
747 frame.SetStatusText(msg)
747 frame.SetStatusText(msg)
748
748
749 def enterattr(self, row, col):
749 def enterattr(self, row, col):
750 try:
750 try:
751 attr = self.table._displayattrs[col]
751 attr = self.table._displayattrs[col]
752 value = attr.value(self.table.items[row])
752 value = attr.value(self.table.items[row])
753 except Exception, exc:
753 except Exception, exc:
754 self.error_output(str(exc))
754 self.error_output(str(exc))
755 else:
755 else:
756 self._doenter(value)
756 self._doenter(value)
757
757
758 def set_footer(self, item):
758 def set_footer(self, item):
759 frame = self.GetParent().GetParent().GetParent()
759 frame = self.GetParent().GetParent().GetParent()
760 frame.SetStatusText(" ".join([str(text) for (style, text) in ipipe.xformat(item, "footer", 20)[2]]), 0)
760 frame.SetStatusText(" ".join([str(text) for (style, text) in ipipe.xformat(item, "footer", 20)[2]]), 0)
761
761
762 def enter(self, row):
762 def enter(self, row):
763 try:
763 try:
764 value = self.table.items[row]
764 value = self.table.items[row]
765 except Exception, exc:
765 except Exception, exc:
766 self.error_output(str(exc))
766 self.error_output(str(exc))
767 else:
767 else:
768 self._doenter(value)
768 self._doenter(value)
769
769
770 def detail(self, row, col):
770 def detail(self, row, col):
771 """
771 """
772 shows a detail-view of the current cell
772 shows a detail-view of the current cell
773 """
773 """
774 try:
774 try:
775 attr = self.table._displayattrs[col]
775 attr = self.table._displayattrs[col]
776 item = self.table.items[row]
776 item = self.table.items[row]
777 except Exception, exc:
777 except Exception, exc:
778 self.error_output(str(exc))
778 self.error_output(str(exc))
779 else:
779 else:
780 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
780 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
781 self._doenter(attrs)
781 self._doenter(attrs)
782
782
783 def detail_attr(self, row, col):
783 def detail_attr(self, row, col):
784 try:
784 try:
785 attr = self.table._displayattrs[col]
785 attr = self.table._displayattrs[col]
786 item = attr.value(self.table.items[row])
786 item = attr.value(self.table.items[row])
787 except Exception, exc:
787 except Exception, exc:
788 self.error_output(str(exc))
788 self.error_output(str(exc))
789 else:
789 else:
790 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
790 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
791 self._doenter(attrs)
791 self._doenter(attrs)
792
792
793 def quit(self, result=None):
793 def quit(self, result=None):
794 """
794 """
795 quit
795 quit
796 """
796 """
797 frame = self.GetParent().GetParent().GetParent()
797 frame = self.GetParent().GetParent().GetParent()
798 if frame.helpdialog:
798 if frame.helpdialog:
799 frame.helpdialog.Destroy()
799 frame.helpdialog.Destroy()
800 app = frame.parent
800 app = frame.parent
801 if app is not None:
801 if app is not None:
802 app.result = result
802 app.result = result
803 frame.Close()
803 frame.Close()
804 frame.Destroy()
804 frame.Destroy()
805
805
806 def cell_doubleclicked(self, event):
806 def cell_doubleclicked(self, event):
807 self.enterattr(event.GetRow(), event.GetCol())
807 self.enterattr(event.GetRow(), event.GetCol())
808 event.Skip()
808 event.Skip()
809
809
810 def cell_leftclicked(self, event):
810 def cell_leftclicked(self, event):
811 row = event.GetRow()
811 row = event.GetRow()
812 item = self.table.items[row]
812 item = self.table.items[row]
813 self.set_footer(item)
813 self.set_footer(item)
814 event.Skip()
814 event.Skip()
815
815
816 def pick(self, row):
816 def pick(self, row):
817 """
817 """
818 pick a single row and return to the IPython prompt
818 pick a single row and return to the IPython prompt
819 """
819 """
820 try:
820 try:
821 value = self.table.items[row]
821 value = self.table.items[row]
822 except Exception, exc:
822 except Exception, exc:
823 self.error_output(str(exc))
823 self.error_output(str(exc))
824 else:
824 else:
825 self.quit(value)
825 self.quit(value)
826
826
827 def pickinput(self, row):
827 def pickinput(self, row):
828 try:
828 try:
829 value = self.table.items[row]
829 value = self.table.items[row]
830 except Exception, exc:
830 except Exception, exc:
831 self.error_output(str(exc))
831 self.error_output(str(exc))
832 else:
832 else:
833 api = ipapi.get()
833 api = ipapi.get()
834 api.set_next_input(str(value))
834 api.set_next_input(str(value))
835 self.quit(value)
835 self.quit(value)
836
836
837 def pickinputattr(self, row, col):
837 def pickinputattr(self, row, col):
838 try:
838 try:
839 attr = self.table._displayattrs[col]
839 attr = self.table._displayattrs[col]
840 value = attr.value(self.table.items[row])
840 value = attr.value(self.table.items[row])
841 except Exception, exc:
841 except Exception, exc:
842 self.error_output(str(exc))
842 self.error_output(str(exc))
843 else:
843 else:
844 api = ipapi.get()
844 api = ipapi.get()
845 api.set_next_input(str(value))
845 api.set_next_input(str(value))
846 self.quit(value)
846 self.quit(value)
847
847
848 def pickrows(self, rows):
848 def pickrows(self, rows):
849 """
849 """
850 pick multiple rows and return to the IPython prompt
850 pick multiple rows and return to the IPython prompt
851 """
851 """
852 try:
852 try:
853 value = [self.table.items[row] for row in rows]
853 value = [self.table.items[row] for row in rows]
854 except Exception, exc:
854 except Exception, exc:
855 self.error_output(str(exc))
855 self.error_output(str(exc))
856 else:
856 else:
857 self.quit(value)
857 self.quit(value)
858
858
859 def pickrowsattr(self, rows, col):
859 def pickrowsattr(self, rows, col):
860 """"
860 """"
861 pick one column from multiple rows
861 pick one column from multiple rows
862 """
862 """
863 values = []
863 values = []
864 try:
864 try:
865 attr = self.table._displayattrs[col]
865 attr = self.table._displayattrs[col]
866 for row in rows:
866 for row in rows:
867 try:
867 try:
868 values.append(attr.value(self.table.items[row]))
868 values.append(attr.value(self.table.items[row]))
869 except (SystemExit, KeyboardInterrupt):
869 except (SystemExit, KeyboardInterrupt):
870 raise
870 raise
871 except Exception:
871 except Exception:
872 raise #pass
872 raise #pass
873 except Exception, exc:
873 except Exception, exc:
874 self.error_output(str(exc))
874 self.error_output(str(exc))
875 else:
875 else:
876 self.quit(values)
876 self.quit(values)
877
877
878 def pickattr(self, row, col):
878 def pickattr(self, row, col):
879 try:
879 try:
880 attr = self.table._displayattrs[col]
880 attr = self.table._displayattrs[col]
881 value = attr.value(self.table.items[row])
881 value = attr.value(self.table.items[row])
882 except Exception, exc:
882 except Exception, exc:
883 self.error_output(str(exc))
883 self.error_output(str(exc))
884 else:
884 else:
885 self.quit(value)
885 self.quit(value)
886
886
887
887
888 class IGridPanel(wx.Panel):
888 class IGridPanel(wx.Panel):
889 # Each IGridPanel contains an IGridGrid
889 # Each IGridPanel contains an IGridGrid
890 def __init__(self, parent, input, *attrs):
890 def __init__(self, parent, input, *attrs):
891 wx.Panel.__init__(self, parent, -1)
891 wx.Panel.__init__(self, parent, -1)
892 self.grid = IGridGrid(self, input, *attrs)
892 self.grid = IGridGrid(self, input, *attrs)
893 self.grid.FitInside()
893 self.grid.FitInside()
894 sizer = wx.BoxSizer(wx.VERTICAL)
894 sizer = wx.BoxSizer(wx.VERTICAL)
895 sizer.Add(self.grid, proportion=1, flag=wx.EXPAND | wx.ALL, border=10)
895 sizer.Add(self.grid, proportion=1, flag=wx.EXPAND | wx.ALL, border=10)
896 self.SetSizer(sizer)
896 self.SetSizer(sizer)
897 sizer.Fit(self)
897 sizer.Fit(self)
898 sizer.SetSizeHints(self)
898 sizer.SetSizeHints(self)
899
899
900
900
901 class IGridHTMLHelp(wx.Frame):
901 class IGridHTMLHelp(wx.Frame):
902 def __init__(self, parent, title, size):
902 def __init__(self, parent, title, size):
903 wx.Frame.__init__(self, parent, -1, title, size=size)
903 wx.Frame.__init__(self, parent, -1, title, size=size)
904 html = wx.html.HtmlWindow(self)
904 html = wx.html.HtmlWindow(self)
905 if "gtk2" in wx.PlatformInfo:
905 if "gtk2" in wx.PlatformInfo:
906 html.SetStandardFonts()
906 html.SetStandardFonts()
907 html.SetPage(help)
907 html.SetPage(help)
908
908
909
909
910 class IGridFrame(wx.Frame):
910 class IGridFrame(wx.Frame):
911 maxtitlelen = 30
911 maxtitlelen = 30
912
912
913 def __init__(self, parent, input):
913 def __init__(self, parent, input):
914 title = " ".join([str(text) for (style, text) in ipipe.xformat(input, "header", 20)[2]])
914 title = " ".join([str(text) for (style, text) in ipipe.xformat(input, "header", 20)[2]])
915 wx.Frame.__init__(self, None, title=title, size=(640, 480))
915 wx.Frame.__init__(self, None, title=title, size=(640, 480))
916 self.menubar = wx.MenuBar()
916 self.menubar = wx.MenuBar()
917 self.menucounter = 100
917 self.menucounter = 100
918 self.m_help = wx.Menu()
918 self.m_help = wx.Menu()
919 self.m_search = wx.Menu()
919 self.m_search = wx.Menu()
920 self.m_sort = wx.Menu()
920 self.m_sort = wx.Menu()
921 self.m_refresh = wx.Menu()
921 self.m_refresh = wx.Menu()
922 self.notebook = wx.Notebook(self, -1, style=0)
922 self.notebook = wx.Notebook(self, -1, style=0)
923 self.statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP)
923 self.statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP)
924 self.statusbar.SetFieldsCount(2)
924 self.statusbar.SetFieldsCount(2)
925 self.SetStatusWidths([-1, 200])
925 self.SetStatusWidths([-1, 200])
926 self.parent = parent
926 self.parent = parent
927 self._add_notebook(input)
927 self._add_notebook(input)
928 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
928 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
929 self.makemenu(self.m_sort, "&Sort (asc)\tV", "Sort ascending", self.sortasc)
929 self.makemenu(self.m_sort, "&Sort (asc)\tV", "Sort ascending", self.sortasc)
930 self.makemenu(self.m_sort, "Sort (&desc)\tShift-V", "Sort descending", self.sortdesc)
930 self.makemenu(self.m_sort, "Sort (&desc)\tShift-V", "Sort descending", self.sortdesc)
931 self.makemenu(self.m_help, "&Help\tF1", "Help", self.display_help)
931 self.makemenu(self.m_help, "&Help\tF1", "Help", self.display_help)
932 # self.makemenu(self.m_help, "&Show help in browser", "Show help in browser", self.display_help_in_browser)
932 # self.makemenu(self.m_help, "&Show help in browser", "Show help in browser", self.display_help_in_browser)
933 self.makemenu(self.m_search, "&Find text\tCTRL-F", "Find text", self.enter_searchtext)
933 self.makemenu(self.m_search, "&Find text\tCTRL-F", "Find text", self.enter_searchtext)
934 self.makemenu(self.m_search, "Find by &expression\tCTRL-Shift-F", "Find by expression", self.enter_searchexpression)
934 self.makemenu(self.m_search, "Find by &expression\tCTRL-Shift-F", "Find by expression", self.enter_searchexpression)
935 self.makemenu(self.m_search, "Find &next\tF3", "Find next", self.find_next)
935 self.makemenu(self.m_search, "Find &next\tF3", "Find next", self.find_next)
936 self.makemenu(self.m_search, "Find &previous\tShift-F3", "Find previous", self.find_previous)
936 self.makemenu(self.m_search, "Find &previous\tShift-F3", "Find previous", self.find_previous)
937 self.makemenu(self.m_refresh, "&Refresh once \tF5", "Refresh once", self.refresh_once)
937 self.makemenu(self.m_refresh, "&Refresh once \tF5", "Refresh once", self.refresh_once)
938 self.makemenu(self.m_refresh, "Refresh every &1s", "Refresh every second", self.refresh_every_second)
938 self.makemenu(self.m_refresh, "Refresh every &1s", "Refresh every second", self.refresh_every_second)
939 self.makemenu(self.m_refresh, "Refresh every &X seconds", "Refresh every X seconds", self.refresh_interval)
939 self.makemenu(self.m_refresh, "Refresh every &X seconds", "Refresh every X seconds", self.refresh_interval)
940 self.makemenu(self.m_refresh, "&Stop all refresh timers", "Stop refresh timers", self.stop_refresh)
940 self.makemenu(self.m_refresh, "&Stop all refresh timers", "Stop refresh timers", self.stop_refresh)
941 self.menubar.Append(self.m_search, "&Find")
941 self.menubar.Append(self.m_search, "&Find")
942 self.menubar.Append(self.m_sort, "&Sort")
942 self.menubar.Append(self.m_sort, "&Sort")
943 self.menubar.Append(self.m_refresh, "&Refresh")
943 self.menubar.Append(self.m_refresh, "&Refresh")
944 self.menubar.Append(self.m_help, "&Help")
944 self.menubar.Append(self.m_help, "&Help")
945 self.SetMenuBar(self.menubar)
945 self.SetMenuBar(self.menubar)
946 self.searchtext = ""
946 self.searchtext = ""
947 self.searchexpression = ""
947 self.searchexpression = ""
948 self.helpdialog = None
948 self.helpdialog = None
949 self.refresh_interval = 1000
949 self.refresh_interval = 1000
950 self.SetStatusText("Refreshing inactive", 1)
950 self.SetStatusText("Refreshing inactive", 1)
951
951
952 def refresh_once(self, event):
952 def refresh_once(self, event):
953 table = self.notebook.GetPage(self.notebook.GetSelection()).grid.table
953 table = self.notebook.GetPage(self.notebook.GetSelection()).grid.table
954 table.refresh_content(event)
954 table.refresh_content(event)
955
955
956 def refresh_interval(self, event):
956 def refresh_interval(self, event):
957 table = self.notebook.GetPage(self.notebook.GetSelection()).grid.table
957 table = self.notebook.GetPage(self.notebook.GetSelection()).grid.table
958 dlg = wx.TextEntryDialog(self, "Enter refresh interval (milliseconds):", "Refresh timer:", defaultValue=str(self.refresh_interval))
958 dlg = wx.TextEntryDialog(self, "Enter refresh interval (milliseconds):", "Refresh timer:", defaultValue=str(self.refresh_interval))
959 if dlg.ShowModal() == wx.ID_OK:
959 if dlg.ShowModal() == wx.ID_OK:
960 try:
960 try:
961 milliseconds = int(dlg.GetValue())
961 milliseconds = int(dlg.GetValue())
962 except ValueError, exc:
962 except ValueError, exc:
963 self.SetStatusText(str(exc))
963 self.SetStatusText(str(exc))
964 else:
964 else:
965 table.timer.Start(milliseconds=milliseconds, oneShot=False)
965 table.timer.Start(milliseconds=milliseconds, oneShot=False)
966 self.SetStatusText("Refresh timer set to %s ms" % milliseconds)
966 self.SetStatusText("Refresh timer set to %s ms" % milliseconds)
967 self.SetStatusText("Refresh interval: %s ms" % milliseconds, 1)
967 self.SetStatusText("Refresh interval: %s ms" % milliseconds, 1)
968 self.refresh_interval = milliseconds
968 self.refresh_interval = milliseconds
969 dlg.Destroy()
969 dlg.Destroy()
970
970
971 def stop_refresh(self, event):
971 def stop_refresh(self, event):
972 for i in xrange(self.notebook.GetPageCount()):
972 for i in xrange(self.notebook.GetPageCount()):
973 nb = self.notebook.GetPage(i)
973 nb = self.notebook.GetPage(i)
974 nb.grid.table.timer.Stop()
974 nb.grid.table.timer.Stop()
975 self.SetStatusText("Refreshing inactive", 1)
975 self.SetStatusText("Refreshing inactive", 1)
976
976
977 def refresh_every_second(self, event):
977 def refresh_every_second(self, event):
978 table = self.notebook.GetPage(self.notebook.GetSelection()).grid.table
978 table = self.notebook.GetPage(self.notebook.GetSelection()).grid.table
979 table.timer.Start(milliseconds=1000, oneShot=False)
979 table.timer.Start(milliseconds=1000, oneShot=False)
980 self.SetStatusText("Refresh interval: 1000 ms", 1)
980 self.SetStatusText("Refresh interval: 1000 ms", 1)
981
981
982 def sortasc(self, event):
982 def sortasc(self, event):
983 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
983 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
984 grid.sortattrasc()
984 grid.sortattrasc()
985
985
986 def sortdesc(self, event):
986 def sortdesc(self, event):
987 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
987 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
988 grid.sortattrdesc()
988 grid.sortattrdesc()
989
989
990 def find_previous(self, event):
990 def find_previous(self, event):
991 """
991 """
992 find previous occurrences
992 find previous occurrences
993 """
993 """
994 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
994 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
995 if self.searchtext:
995 if self.searchtext:
996 row = grid.GetGridCursorRow()
996 row = grid.GetGridCursorRow()
997 col = grid.GetGridCursorCol()
997 col = grid.GetGridCursorCol()
998 self.SetStatusText('Search mode: text; looking for %s' % self.searchtext)
998 self.SetStatusText('Search mode: text; looking for %s' % self.searchtext)
999 if col-1 >= 0:
999 if col-1 >= 0:
1000 grid.search(self.searchtext, row, col-1, False)
1000 grid.search(self.searchtext, row, col-1, False)
1001 else:
1001 else:
1002 grid.search(self.searchtext, row-1, grid.table.GetNumberCols()-1, False)
1002 grid.search(self.searchtext, row-1, grid.table.GetNumberCols()-1, False)
1003 elif self.searchexpression:
1003 elif self.searchexpression:
1004 self.SetStatusText("Search mode: expression; looking for %s" % repr(self.searchexpression)[2:-1])
1004 self.SetStatusText("Search mode: expression; looking for %s" % repr(self.searchexpression)[2:-1])
1005 grid.searchexpression(searchexp=self.searchexpression, search_forward=False)
1005 grid.searchexpression(searchexp=self.searchexpression, search_forward=False)
1006 else:
1006 else:
1007 self.SetStatusText("No search yet: please enter search-text or -expression")
1007 self.SetStatusText("No search yet: please enter search-text or -expression")
1008
1008
1009 def find_next(self, event):
1009 def find_next(self, event):
1010 """
1010 """
1011 find the next occurrence
1011 find the next occurrence
1012 """
1012 """
1013 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
1013 grid = self.notebook.GetPage(self.notebook.GetSelection()).grid
1014 if self.searchtext != "":
1014 if self.searchtext != "":
1015 row = grid.GetGridCursorRow()
1015 row = grid.GetGridCursorRow()
1016 col = grid.GetGridCursorCol()
1016 col = grid.GetGridCursorCol()
1017 self.SetStatusText('Search mode: text; looking for %s' % self.searchtext)
1017 self.SetStatusText('Search mode: text; looking for %s' % self.searchtext)
1018 if col+1 < grid.table.GetNumberCols():
1018 if col+1 < grid.table.GetNumberCols():
1019 grid.search(self.searchtext, row, col+1)
1019 grid.search(self.searchtext, row, col+1)
1020 else:
1020 else:
1021 grid.search(self.searchtext, row+1, 0)
1021 grid.search(self.searchtext, row+1, 0)
1022 elif self.searchexpression != "":
1022 elif self.searchexpression != "":
1023 self.SetStatusText('Search mode: expression; looking for %s' % repr(self.searchexpression)[2:-1])
1023 self.SetStatusText('Search mode: expression; looking for %s' % repr(self.searchexpression)[2:-1])
1024 grid.searchexpression(searchexp=self.searchexpression)
1024 grid.searchexpression(searchexp=self.searchexpression)
1025 else:
1025 else:
1026 self.SetStatusText("No search yet: please enter search-text or -expression")
1026 self.SetStatusText("No search yet: please enter search-text or -expression")
1027
1027
1028 def display_help(self, event):
1028 def display_help(self, event):
1029 """
1029 """
1030 Display a help dialog
1030 Display a help dialog
1031 """
1031 """
1032 if self.helpdialog:
1032 if self.helpdialog:
1033 self.helpdialog.Destroy()
1033 self.helpdialog.Destroy()
1034 self.helpdialog = IGridHTMLHelp(None, title="Help", size=wx.Size(600,400))
1034 self.helpdialog = IGridHTMLHelp(None, title="Help", size=wx.Size(600,400))
1035 self.helpdialog.Show()
1035 self.helpdialog.Show()
1036
1036
1037 def display_help_in_browser(self, event):
1037 def display_help_in_browser(self, event):
1038 """
1038 """
1039 Show the help-HTML in a browser (as a ``HtmlWindow`` does not understand
1039 Show the help-HTML in a browser (as a ``HtmlWindow`` does not understand
1040 CSS this looks better)
1040 CSS this looks better)
1041 """
1041 """
1042 filename = urllib.pathname2url(os.path.abspath(os.path.join(os.path.dirname(__file__), "igrid_help.html")))
1042 filename = urllib.pathname2url(os.path.abspath(os.path.join(os.path.dirname(__file__), "igrid_help.html")))
1043 if not filename.startswith("file"):
1043 if not filename.startswith("file"):
1044 filename = "file:" + filename
1044 filename = "file:" + filename
1045 webbrowser.open(filename, new=1, autoraise=True)
1045 webbrowser.open(filename, new=1, autoraise=True)
1046
1046
1047 def enter_searchexpression(self, event):
1047 def enter_searchexpression(self, event):
1048 dlg = wx.TextEntryDialog(self, "Find:", "Find matching expression:", defaultValue=self.searchexpression)
1048 dlg = wx.TextEntryDialog(self, "Find:", "Find matching expression:", defaultValue=self.searchexpression)
1049 if dlg.ShowModal() == wx.ID_OK:
1049 if dlg.ShowModal() == wx.ID_OK:
1050 self.searchexpression = dlg.GetValue()
1050 self.searchexpression = dlg.GetValue()
1051 self.searchtext = ""
1051 self.searchtext = ""
1052 self.SetStatusText('Search mode: expression; looking for %s' % repr(self.searchexpression)[2:-1])
1052 self.SetStatusText('Search mode: expression; looking for %s' % repr(self.searchexpression)[2:-1])
1053 self.notebook.GetPage(self.notebook.GetSelection()).grid.searchexpression(self.searchexpression)
1053 self.notebook.GetPage(self.notebook.GetSelection()).grid.searchexpression(self.searchexpression)
1054 dlg.Destroy()
1054 dlg.Destroy()
1055
1055
1056 def makemenu(self, menu, label, help, cmd):
1056 def makemenu(self, menu, label, help, cmd):
1057 menu.Append(self.menucounter, label, help)
1057 menu.Append(self.menucounter, label, help)
1058 self.Bind(wx.EVT_MENU, cmd, id=self.menucounter)
1058 self.Bind(wx.EVT_MENU, cmd, id=self.menucounter)
1059 self.menucounter += 1
1059 self.menucounter += 1
1060
1060
1061 def _add_notebook(self, input, *attrs):
1061 def _add_notebook(self, input, *attrs):
1062 # Adds another notebook which has the starting object ``input``
1062 # Adds another notebook which has the starting object ``input``
1063 panel = IGridPanel(self.notebook, input, *attrs)
1063 panel = IGridPanel(self.notebook, input, *attrs)
1064 text = str(ipipe.xformat(input, "header", self.maxtitlelen)[2])
1064 text = str(ipipe.xformat(input, "header", self.maxtitlelen)[2])
1065 if len(text) >= self.maxtitlelen:
1065 if len(text) >= self.maxtitlelen:
1066 text = text[:self.maxtitlelen].rstrip(".") + "..."
1066 text = text[:self.maxtitlelen].rstrip(".") + "..."
1067 self.notebook.AddPage(panel, text, True)
1067 self.notebook.AddPage(panel, text, True)
1068 panel.grid.SetFocus()
1068 panel.grid.SetFocus()
1069 self.Layout()
1069 self.Layout()
1070
1070
1071 def OnCloseWindow(self, event):
1071 def OnCloseWindow(self, event):
1072 self.Destroy()
1072 self.Destroy()
1073
1073
1074 def enter_searchtext(self, event):
1074 def enter_searchtext(self, event):
1075 # Displays a dialog asking for the searchtext
1075 # Displays a dialog asking for the searchtext
1076 dlg = wx.TextEntryDialog(self, "Find:", "Find in list", defaultValue=self.searchtext)
1076 dlg = wx.TextEntryDialog(self, "Find:", "Find in list", defaultValue=self.searchtext)
1077 if dlg.ShowModal() == wx.ID_OK:
1077 if dlg.ShowModal() == wx.ID_OK:
1078 self.searchtext = dlg.GetValue()
1078 self.searchtext = dlg.GetValue()
1079 self.searchexpression = ""
1079 self.searchexpression = ""
1080 self.SetStatusText('Search mode: text; looking for %s' % self.searchtext)
1080 self.SetStatusText('Search mode: text; looking for %s' % self.searchtext)
1081 self.notebook.GetPage(self.notebook.GetSelection()).grid.search(self.searchtext)
1081 self.notebook.GetPage(self.notebook.GetSelection()).grid.search(self.searchtext)
1082 dlg.Destroy()
1082 dlg.Destroy()
1083
1083
1084
1084
1085 class App(wx.App):
1085 class App(wx.App):
1086 def __init__(self, input):
1086 def __init__(self, input):
1087 self.input = input
1087 self.input = input
1088 self.result = None # Result to be returned to IPython. Set by quit().
1088 self.result = None # Result to be returned to IPython. Set by quit().
1089 wx.App.__init__(self)
1089 wx.App.__init__(self)
1090
1090
1091 def OnInit(self):
1091 def OnInit(self):
1092 frame = IGridFrame(self, self.input)
1092 frame = IGridFrame(self, self.input)
1093 frame.Show()
1093 frame.Show()
1094 self.SetTopWindow(frame)
1094 self.SetTopWindow(frame)
1095 frame.Raise()
1095 frame.Raise()
1096 return True
1096 return True
1097
1097
1098
1098
1099 class igrid(ipipe.Display):
1099 class igrid(ipipe.Display):
1100 """
1100 """
1101 This is a wx-based display object that can be used instead of ``ibrowse``
1101 This is a wx-based display object that can be used instead of ``ibrowse``
1102 (which is curses-based) or ``idump`` (which simply does a print).
1102 (which is curses-based) or ``idump`` (which simply does a print).
1103 """
1103 """
1104
1104
1105 def __init__(self, input=None):
1106 self.input = input
1107
1108 if wx.VERSION < (2, 7):
1105 if wx.VERSION < (2, 7):
1109 def display(self):
1106 def display(self):
1110 try:
1107 try:
1111 # Try to create a "standalone" from. If this works we're probably
1108 # Try to create a "standalone" frame. If this works we're probably
1112 # running with -wthread.
1109 # running with -wthread.
1113 # Note that this sets the parent of the frame to None, but we can't
1110 # Note that this sets the parent of the frame to None, but we can't
1114 # pass a result object back to the shell anyway.
1111 # pass a result object back to the shell anyway.
1115 frame = IGridFrame(None, self.input)
1112 frame = IGridFrame(None, self.input)
1116 frame.Show()
1113 frame.Show()
1117 frame.Raise()
1114 frame.Raise()
1118 except wx.PyNoAppError:
1115 except wx.PyNoAppError:
1119 # There's no wx application yet => create one.
1116 # There's no wx application yet => create one.
1120 app = App(self.input)
1117 app = App(self.input)
1121 app.MainLoop()
1118 app.MainLoop()
1122 return app.result
1119 return app.result
1123 else:
1120 else:
1124 # With wx 2.7 it gets simpler.
1121 # With wx 2.7 it gets simpler.
1125 def display(self):
1122 def display(self):
1126 app = App(self.input)
1123 app = App(self.input)
1127 app.MainLoop()
1124 app.MainLoop()
1128 return app.result
1125 return app.result
1129
1126
@@ -1,2250 +1,2255 b''
1 # -*- coding: iso-8859-1 -*-
1 # -*- coding: iso-8859-1 -*-
2
2
3 """
3 """
4 ``ipipe`` provides classes to be used in an interactive Python session. Doing a
4 ``ipipe`` provides classes to be used in an interactive Python session. Doing a
5 ``from ipipe import *`` is the preferred way to do this. The name of all
5 ``from ipipe import *`` is the preferred way to do this. The name of all
6 objects imported this way starts with ``i`` to minimize collisions.
6 objects imported this way starts with ``i`` to minimize collisions.
7
7
8 ``ipipe`` supports "pipeline expressions", which is something resembling Unix
8 ``ipipe`` supports "pipeline expressions", which is something resembling Unix
9 pipes. An example is:
9 pipes. An example is:
10
10
11 >>> ienv | isort("key.lower()")
11 >>> ienv | isort("key.lower()")
12
12
13 This gives a listing of all environment variables sorted by name.
13 This gives a listing of all environment variables sorted by name.
14
14
15
15
16 There are three types of objects in a pipeline expression:
16 There are three types of objects in a pipeline expression:
17
17
18 * ``Table``s: These objects produce items. Examples are ``ils`` (listing the
18 * ``Table``s: These objects produce items. Examples are ``ils`` (listing the
19 current directory, ``ienv`` (listing environment variables), ``ipwd`` (listing
19 current directory, ``ienv`` (listing environment variables), ``ipwd`` (listing
20 user accounts) and ``igrp`` (listing user groups). A ``Table`` must be the
20 user accounts) and ``igrp`` (listing user groups). A ``Table`` must be the
21 first object in a pipe expression.
21 first object in a pipe expression.
22
22
23 * ``Pipe``s: These objects sit in the middle of a pipe expression. They
23 * ``Pipe``s: These objects sit in the middle of a pipe expression. They
24 transform the input in some way (e.g. filtering or sorting it). Examples are:
24 transform the input in some way (e.g. filtering or sorting it). Examples are:
25 ``ifilter`` (which filters the input pipe), ``isort`` (which sorts the input
25 ``ifilter`` (which filters the input pipe), ``isort`` (which sorts the input
26 pipe) and ``ieval`` (which evaluates a function or expression for each object
26 pipe) and ``ieval`` (which evaluates a function or expression for each object
27 in the input pipe).
27 in the input pipe).
28
28
29 * ``Display``s: These objects can be put as the last object in a pipeline
29 * ``Display``s: These objects can be put as the last object in a pipeline
30 expression. There are responsible for displaying the result of the pipeline
30 expression. There are responsible for displaying the result of the pipeline
31 expression. If a pipeline expression doesn't end in a display object a default
31 expression. If a pipeline expression doesn't end in a display object a default
32 display objects will be used. One example is ``ibrowse`` which is a ``curses``
32 display objects will be used. One example is ``ibrowse`` which is a ``curses``
33 based browser.
33 based browser.
34
34
35
35
36 Adding support for pipeline expressions to your own objects can be done through
36 Adding support for pipeline expressions to your own objects can be done through
37 three extensions points (all of them optional):
37 three extensions points (all of them optional):
38
38
39 * An object that will be displayed as a row by a ``Display`` object should
39 * An object that will be displayed as a row by a ``Display`` object should
40 implement the method ``__xattrs__(self, mode)`` method or register an
40 implement the method ``__xattrs__(self, mode)`` method or register an
41 implementation of the generic function ``xattrs``. For more info see ``xattrs``.
41 implementation of the generic function ``xattrs``. For more info see ``xattrs``.
42
42
43 * When an object ``foo`` is displayed by a ``Display`` object, the generic
43 * When an object ``foo`` is displayed by a ``Display`` object, the generic
44 function ``xrepr`` is used.
44 function ``xrepr`` is used.
45
45
46 * Objects that can be iterated by ``Pipe``s must iterable. For special cases,
46 * Objects that can be iterated by ``Pipe``s must iterable. For special cases,
47 where iteration for display is different than the normal iteration a special
47 where iteration for display is different than the normal iteration a special
48 implementation can be registered with the generic function ``xiter``. This makes
48 implementation can be registered with the generic function ``xiter``. This makes
49 it possible to use dictionaries and modules in pipeline expressions, for example:
49 it possible to use dictionaries and modules in pipeline expressions, for example:
50
50
51 >>> import sys
51 >>> import sys
52 >>> sys | ifilter("isinstance(value, int)") | idump
52 >>> sys | ifilter("isinstance(value, int)") | idump
53 key |value
53 key |value
54 api_version| 1012
54 api_version| 1012
55 dllhandle | 503316480
55 dllhandle | 503316480
56 hexversion | 33817328
56 hexversion | 33817328
57 maxint |2147483647
57 maxint |2147483647
58 maxunicode | 65535
58 maxunicode | 65535
59 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
59 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
60 ...
60 ...
61
61
62 Note: The expression strings passed to ``ifilter()`` and ``isort()`` can
62 Note: The expression strings passed to ``ifilter()`` and ``isort()`` can
63 refer to the object to be filtered or sorted via the variable ``_`` and to any
63 refer to the object to be filtered or sorted via the variable ``_`` and to any
64 of the attributes of the object, i.e.:
64 of the attributes of the object, i.e.:
65
65
66 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
66 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
67
67
68 does the same as
68 does the same as
69
69
70 >>> sys.modules | ifilter("value is not None") | isort("key.lower()")
70 >>> sys.modules | ifilter("value is not None") | isort("key.lower()")
71
71
72 In addition to expression strings, it's possible to pass callables (taking
72 In addition to expression strings, it's possible to pass callables (taking
73 the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``:
73 the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``:
74
74
75 >>> sys | ifilter(lambda _:isinstance(_.value, int)) \
75 >>> sys | ifilter(lambda _:isinstance(_.value, int)) \
76 ... | ieval(lambda _: (_.key, hex(_.value))) | idump
76 ... | ieval(lambda _: (_.key, hex(_.value))) | idump
77 0 |1
77 0 |1
78 api_version|0x3f4
78 api_version|0x3f4
79 dllhandle |0x1e000000
79 dllhandle |0x1e000000
80 hexversion |0x20402f0
80 hexversion |0x20402f0
81 maxint |0x7fffffff
81 maxint |0x7fffffff
82 maxunicode |0xffff
82 maxunicode |0xffff
83 """
83 """
84
84
85 import sys, os, os.path, stat, glob, new, csv, datetime, types
85 import sys, os, os.path, stat, glob, new, csv, datetime, types
86 import itertools, mimetypes, StringIO
86 import itertools, mimetypes, StringIO
87
87
88 try: # Python 2.3 compatibility
88 try: # Python 2.3 compatibility
89 import collections
89 import collections
90 except ImportError:
90 except ImportError:
91 deque = list
91 deque = list
92 else:
92 else:
93 deque = collections.deque
93 deque = collections.deque
94
94
95 try: # Python 2.3 compatibility
95 try: # Python 2.3 compatibility
96 set
96 set
97 except NameError:
97 except NameError:
98 import sets
98 import sets
99 set = sets.Set
99 set = sets.Set
100
100
101 try: # Python 2.3 compatibility
101 try: # Python 2.3 compatibility
102 sorted
102 sorted
103 except NameError:
103 except NameError:
104 def sorted(iterator, key=None, reverse=False):
104 def sorted(iterator, key=None, reverse=False):
105 items = list(iterator)
105 items = list(iterator)
106 if key is not None:
106 if key is not None:
107 items.sort(lambda i1, i2: cmp(key(i1), key(i2)))
107 items.sort(lambda i1, i2: cmp(key(i1), key(i2)))
108 else:
108 else:
109 items.sort()
109 items.sort()
110 if reverse:
110 if reverse:
111 items.reverse()
111 items.reverse()
112 return items
112 return items
113
113
114 try:
114 try:
115 import pwd
115 import pwd
116 except ImportError:
116 except ImportError:
117 pwd = None
117 pwd = None
118
118
119 try:
119 try:
120 import grp
120 import grp
121 except ImportError:
121 except ImportError:
122 grp = None
122 grp = None
123
123
124 from IPython.external import simplegeneric
124 from IPython.external import simplegeneric
125
125
126 import path
126 import path
127 try:
127 try:
128 from IPython import genutils, ipapi
128 from IPython import genutils, ipapi
129 except ImportError:
129 except ImportError:
130 genutils = None
130 genutils = None
131 ipapi = None
131 ipapi = None
132
132
133 import astyle
134
135
133
136 __all__ = [
134 __all__ = [
137 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
135 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
138 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum",
136 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum",
139 "ienv", "ihist", "icap", "idump", "iless"
137 "ienv", "ihist", "icap", "idump", "iless"
140 ]
138 ]
141
139
142
140
143 os.stat_float_times(True) # enable microseconds
141 os.stat_float_times(True) # enable microseconds
144
142
145
143
146 class AttrNamespace(object):
144 class AttrNamespace(object):
147 """
145 """
148 Helper class that is used for providing a namespace for evaluating
146 Helper class that is used for providing a namespace for evaluating
149 expressions containing attribute names of an object.
147 expressions containing attribute names of an object.
150 """
148 """
151 def __init__(self, wrapped):
149 def __init__(self, wrapped):
152 self.wrapped = wrapped
150 self.wrapped = wrapped
153
151
154 def __getitem__(self, name):
152 def __getitem__(self, name):
155 if name == "_":
153 if name == "_":
156 return self.wrapped
154 return self.wrapped
157 try:
155 try:
158 return getattr(self.wrapped, name)
156 return getattr(self.wrapped, name)
159 except AttributeError:
157 except AttributeError:
160 raise KeyError(name)
158 raise KeyError(name)
161
159
162 # Python 2.3 compatibility
160 # Python 2.3 compatibility
163 # use eval workaround to find out which names are used in the
161 # use eval workaround to find out which names are used in the
164 # eval string and put them into the locals. This works for most
162 # eval string and put them into the locals. This works for most
165 # normal uses case, bizarre ones like accessing the locals()
163 # normal uses case, bizarre ones like accessing the locals()
166 # will fail
164 # will fail
167 try:
165 try:
168 eval("_", None, AttrNamespace(None))
166 eval("_", None, AttrNamespace(None))
169 except TypeError:
167 except TypeError:
170 real_eval = eval
168 real_eval = eval
171 def eval(codestring, _globals, _locals):
169 def eval(codestring, _globals, _locals):
172 """
170 """
173 eval(source[, globals[, locals]]) -> value
171 eval(source[, globals[, locals]]) -> value
174
172
175 Evaluate the source in the context of globals and locals.
173 Evaluate the source in the context of globals and locals.
176 The source may be a string representing a Python expression
174 The source may be a string representing a Python expression
177 or a code object as returned by compile().
175 or a code object as returned by compile().
178 The globals must be a dictionary and locals can be any mappping.
176 The globals must be a dictionary and locals can be any mappping.
179
177
180 This function is a workaround for the shortcomings of
178 This function is a workaround for the shortcomings of
181 Python 2.3's eval.
179 Python 2.3's eval.
182 """
180 """
183
181
184 if isinstance(codestring, basestring):
182 if isinstance(codestring, basestring):
185 code = compile(codestring, "_eval", "eval")
183 code = compile(codestring, "_eval", "eval")
186 else:
184 else:
187 code = codestring
185 code = codestring
188 newlocals = {}
186 newlocals = {}
189 for name in code.co_names:
187 for name in code.co_names:
190 try:
188 try:
191 newlocals[name] = _locals[name]
189 newlocals[name] = _locals[name]
192 except KeyError:
190 except KeyError:
193 pass
191 pass
194 return real_eval(code, _globals, newlocals)
192 return real_eval(code, _globals, newlocals)
195
193
196
194
197 noitem = object()
195 noitem = object()
198
196
199
197
200 def item(iterator, index, default=noitem):
198 def item(iterator, index, default=noitem):
201 """
199 """
202 Return the ``index``th item from the iterator ``iterator``.
200 Return the ``index``th item from the iterator ``iterator``.
203 ``index`` must be an integer (negative integers are relative to the
201 ``index`` must be an integer (negative integers are relative to the
204 end (i.e. the last items produced by the iterator)).
202 end (i.e. the last items produced by the iterator)).
205
203
206 If ``default`` is given, this will be the default value when
204 If ``default`` is given, this will be the default value when
207 the iterator doesn't contain an item at this position. Otherwise an
205 the iterator doesn't contain an item at this position. Otherwise an
208 ``IndexError`` will be raised.
206 ``IndexError`` will be raised.
209
207
210 Note that using this function will partially or totally exhaust the
208 Note that using this function will partially or totally exhaust the
211 iterator.
209 iterator.
212 """
210 """
213 i = index
211 i = index
214 if i>=0:
212 if i>=0:
215 for item in iterator:
213 for item in iterator:
216 if not i:
214 if not i:
217 return item
215 return item
218 i -= 1
216 i -= 1
219 else:
217 else:
220 i = -index
218 i = -index
221 cache = deque()
219 cache = deque()
222 for item in iterator:
220 for item in iterator:
223 cache.append(item)
221 cache.append(item)
224 if len(cache)>i:
222 if len(cache)>i:
225 cache.popleft()
223 cache.popleft()
226 if len(cache)==i:
224 if len(cache)==i:
227 return cache.popleft()
225 return cache.popleft()
228 if default is noitem:
226 if default is noitem:
229 raise IndexError(index)
227 raise IndexError(index)
230 else:
228 else:
231 return default
229 return default
232
230
233
231
234 def getglobals(g):
232 def getglobals(g):
235 """
233 """
236 Return the global namespace that is used for expression strings in
234 Return the global namespace that is used for expression strings in
237 ``ifilter`` and others. This is ``g`` or (if ``g`` is ``None``) IPython's
235 ``ifilter`` and others. This is ``g`` or (if ``g`` is ``None``) IPython's
238 user namespace.
236 user namespace.
239 """
237 """
240 if g is None:
238 if g is None:
241 if ipapi is not None:
239 if ipapi is not None:
242 api = ipapi.get()
240 api = ipapi.get()
243 if api is not None:
241 if api is not None:
244 return api.user_ns
242 return api.user_ns
245 return globals()
243 return globals()
246 return g
244 return g
247
245
248
246
249 class Descriptor(object):
247 class Descriptor(object):
250 """
248 """
251 A ``Descriptor`` object is used for describing the attributes of objects.
249 A ``Descriptor`` object is used for describing the attributes of objects.
252 """
250 """
253 def __hash__(self):
251 def __hash__(self):
254 return hash(self.__class__) ^ hash(self.key())
252 return hash(self.__class__) ^ hash(self.key())
255
253
256 def __eq__(self, other):
254 def __eq__(self, other):
257 return self.__class__ is other.__class__ and self.key() == other.key()
255 return self.__class__ is other.__class__ and self.key() == other.key()
258
256
259 def __ne__(self, other):
257 def __ne__(self, other):
260 return self.__class__ is not other.__class__ or self.key() != other.key()
258 return self.__class__ is not other.__class__ or self.key() != other.key()
261
259
262 def key(self):
260 def key(self):
263 pass
261 pass
264
262
265 def name(self):
263 def name(self):
266 """
264 """
267 Return the name of this attribute for display by a ``Display`` object
265 Return the name of this attribute for display by a ``Display`` object
268 (e.g. as a column title).
266 (e.g. as a column title).
269 """
267 """
270 key = self.key()
268 key = self.key()
271 if key is None:
269 if key is None:
272 return "_"
270 return "_"
273 return str(key)
271 return str(key)
274
272
275 def attrtype(self, obj):
273 def attrtype(self, obj):
276 """
274 """
277 Return the type of this attribute (i.e. something like "attribute" or
275 Return the type of this attribute (i.e. something like "attribute" or
278 "method").
276 "method").
279 """
277 """
280
278
281 def valuetype(self, obj):
279 def valuetype(self, obj):
282 """
280 """
283 Return the type of this attribute value of the object ``obj``.
281 Return the type of this attribute value of the object ``obj``.
284 """
282 """
285
283
286 def value(self, obj):
284 def value(self, obj):
287 """
285 """
288 Return the value of this attribute of the object ``obj``.
286 Return the value of this attribute of the object ``obj``.
289 """
287 """
290
288
291 def doc(self, obj):
289 def doc(self, obj):
292 """
290 """
293 Return the documentation for this attribute.
291 Return the documentation for this attribute.
294 """
292 """
295
293
296 def shortdoc(self, obj):
294 def shortdoc(self, obj):
297 """
295 """
298 Return a short documentation for this attribute (defaulting to the
296 Return a short documentation for this attribute (defaulting to the
299 first line).
297 first line).
300 """
298 """
301 doc = self.doc(obj)
299 doc = self.doc(obj)
302 if doc is not None:
300 if doc is not None:
303 doc = doc.strip().splitlines()[0].strip()
301 doc = doc.strip().splitlines()[0].strip()
304 return doc
302 return doc
305
303
306 def iter(self, obj):
304 def iter(self, obj):
307 """
305 """
308 Return an iterator for this attribute of the object ``obj``.
306 Return an iterator for this attribute of the object ``obj``.
309 """
307 """
310 return xiter(self.value(obj))
308 return xiter(self.value(obj))
311
309
312
310
313 class SelfDescriptor(Descriptor):
311 class SelfDescriptor(Descriptor):
314 """
312 """
315 A ``SelfDescriptor`` describes the object itself.
313 A ``SelfDescriptor`` describes the object itself.
316 """
314 """
317 def key(self):
315 def key(self):
318 return None
316 return None
319
317
320 def attrtype(self, obj):
318 def attrtype(self, obj):
321 return "self"
319 return "self"
322
320
323 def valuetype(self, obj):
321 def valuetype(self, obj):
324 return type(obj)
322 return type(obj)
325
323
326 def value(self, obj):
324 def value(self, obj):
327 return obj
325 return obj
328
326
329 def __repr__(self):
327 def __repr__(self):
330 return "Self"
328 return "Self"
331
329
332 selfdescriptor = SelfDescriptor() # there's no need for more than one
330 selfdescriptor = SelfDescriptor() # there's no need for more than one
333
331
334
332
335 class AttributeDescriptor(Descriptor):
333 class AttributeDescriptor(Descriptor):
336 """
334 """
337 An ``AttributeDescriptor`` describes a simple attribute of an object.
335 An ``AttributeDescriptor`` describes a simple attribute of an object.
338 """
336 """
339 __slots__ = ("_name", "_doc")
337 __slots__ = ("_name", "_doc")
340
338
341 def __init__(self, name, doc=None):
339 def __init__(self, name, doc=None):
342 self._name = name
340 self._name = name
343 self._doc = doc
341 self._doc = doc
344
342
345 def key(self):
343 def key(self):
346 return self._name
344 return self._name
347
345
348 def doc(self, obj):
346 def doc(self, obj):
349 return self._doc
347 return self._doc
350
348
351 def attrtype(self, obj):
349 def attrtype(self, obj):
352 return "attr"
350 return "attr"
353
351
354 def valuetype(self, obj):
352 def valuetype(self, obj):
355 return type(getattr(obj, self._name))
353 return type(getattr(obj, self._name))
356
354
357 def value(self, obj):
355 def value(self, obj):
358 return getattr(obj, self._name)
356 return getattr(obj, self._name)
359
357
360 def __repr__(self):
358 def __repr__(self):
361 if self._doc is None:
359 if self._doc is None:
362 return "Attribute(%r)" % self._name
360 return "Attribute(%r)" % self._name
363 else:
361 else:
364 return "Attribute(%r, %r)" % (self._name, self._doc)
362 return "Attribute(%r, %r)" % (self._name, self._doc)
365
363
366
364
367 class IndexDescriptor(Descriptor):
365 class IndexDescriptor(Descriptor):
368 """
366 """
369 An ``IndexDescriptor`` describes an "attribute" of an object that is fetched
367 An ``IndexDescriptor`` describes an "attribute" of an object that is fetched
370 via ``__getitem__``.
368 via ``__getitem__``.
371 """
369 """
372 __slots__ = ("_index",)
370 __slots__ = ("_index",)
373
371
374 def __init__(self, index):
372 def __init__(self, index):
375 self._index = index
373 self._index = index
376
374
377 def key(self):
375 def key(self):
378 return self._index
376 return self._index
379
377
380 def attrtype(self, obj):
378 def attrtype(self, obj):
381 return "item"
379 return "item"
382
380
383 def valuetype(self, obj):
381 def valuetype(self, obj):
384 return type(obj[self._index])
382 return type(obj[self._index])
385
383
386 def value(self, obj):
384 def value(self, obj):
387 return obj[self._index]
385 return obj[self._index]
388
386
389 def __repr__(self):
387 def __repr__(self):
390 return "Index(%r)" % self._index
388 return "Index(%r)" % self._index
391
389
392
390
393 class MethodDescriptor(Descriptor):
391 class MethodDescriptor(Descriptor):
394 """
392 """
395 A ``MethodDescriptor`` describes a method of an object that can be called
393 A ``MethodDescriptor`` describes a method of an object that can be called
396 without argument. Note that this method shouldn't change the object.
394 without argument. Note that this method shouldn't change the object.
397 """
395 """
398 __slots__ = ("_name", "_doc")
396 __slots__ = ("_name", "_doc")
399
397
400 def __init__(self, name, doc=None):
398 def __init__(self, name, doc=None):
401 self._name = name
399 self._name = name
402 self._doc = doc
400 self._doc = doc
403
401
404 def key(self):
402 def key(self):
405 return self._name
403 return self._name
406
404
407 def doc(self, obj):
405 def doc(self, obj):
408 if self._doc is None:
406 if self._doc is None:
409 return getattr(obj, self._name).__doc__
407 return getattr(obj, self._name).__doc__
410 return self._doc
408 return self._doc
411
409
412 def attrtype(self, obj):
410 def attrtype(self, obj):
413 return "method"
411 return "method"
414
412
415 def valuetype(self, obj):
413 def valuetype(self, obj):
416 return type(self.value(obj))
414 return type(self.value(obj))
417
415
418 def value(self, obj):
416 def value(self, obj):
419 return getattr(obj, self._name)()
417 return getattr(obj, self._name)()
420
418
421 def __repr__(self):
419 def __repr__(self):
422 if self._doc is None:
420 if self._doc is None:
423 return "Method(%r)" % self._name
421 return "Method(%r)" % self._name
424 else:
422 else:
425 return "Method(%r, %r)" % (self._name, self._doc)
423 return "Method(%r, %r)" % (self._name, self._doc)
426
424
427
425
428 class IterAttributeDescriptor(Descriptor):
426 class IterAttributeDescriptor(Descriptor):
429 """
427 """
430 An ``IterAttributeDescriptor`` works like an ``AttributeDescriptor`` but
428 An ``IterAttributeDescriptor`` works like an ``AttributeDescriptor`` but
431 doesn't return an attribute values (because this value might be e.g. a large
429 doesn't return an attribute values (because this value might be e.g. a large
432 list).
430 list).
433 """
431 """
434 __slots__ = ("_name", "_doc")
432 __slots__ = ("_name", "_doc")
435
433
436 def __init__(self, name, doc=None):
434 def __init__(self, name, doc=None):
437 self._name = name
435 self._name = name
438 self._doc = doc
436 self._doc = doc
439
437
440 def key(self):
438 def key(self):
441 return self._name
439 return self._name
442
440
443 def doc(self, obj):
441 def doc(self, obj):
444 return self._doc
442 return self._doc
445
443
446 def attrtype(self, obj):
444 def attrtype(self, obj):
447 return "iter"
445 return "iter"
448
446
449 def valuetype(self, obj):
447 def valuetype(self, obj):
450 return noitem
448 return noitem
451
449
452 def value(self, obj):
450 def value(self, obj):
453 return noitem
451 return noitem
454
452
455 def iter(self, obj):
453 def iter(self, obj):
456 return xiter(getattr(obj, self._name))
454 return xiter(getattr(obj, self._name))
457
455
458 def __repr__(self):
456 def __repr__(self):
459 if self._doc is None:
457 if self._doc is None:
460 return "IterAttribute(%r)" % self._name
458 return "IterAttribute(%r)" % self._name
461 else:
459 else:
462 return "IterAttribute(%r, %r)" % (self._name, self._doc)
460 return "IterAttribute(%r, %r)" % (self._name, self._doc)
463
461
464
462
465 class IterMethodDescriptor(Descriptor):
463 class IterMethodDescriptor(Descriptor):
466 """
464 """
467 An ``IterMethodDescriptor`` works like an ``MethodDescriptor`` but doesn't
465 An ``IterMethodDescriptor`` works like an ``MethodDescriptor`` but doesn't
468 return an attribute values (because this value might be e.g. a large list).
466 return an attribute values (because this value might be e.g. a large list).
469 """
467 """
470 __slots__ = ("_name", "_doc")
468 __slots__ = ("_name", "_doc")
471
469
472 def __init__(self, name, doc=None):
470 def __init__(self, name, doc=None):
473 self._name = name
471 self._name = name
474 self._doc = doc
472 self._doc = doc
475
473
476 def key(self):
474 def key(self):
477 return self._name
475 return self._name
478
476
479 def doc(self, obj):
477 def doc(self, obj):
480 if self._doc is None:
478 if self._doc is None:
481 return getattr(obj, self._name).__doc__
479 return getattr(obj, self._name).__doc__
482 return self._doc
480 return self._doc
483
481
484 def attrtype(self, obj):
482 def attrtype(self, obj):
485 return "itermethod"
483 return "itermethod"
486
484
487 def valuetype(self, obj):
485 def valuetype(self, obj):
488 return noitem
486 return noitem
489
487
490 def value(self, obj):
488 def value(self, obj):
491 return noitem
489 return noitem
492
490
493 def iter(self, obj):
491 def iter(self, obj):
494 return xiter(getattr(obj, self._name)())
492 return xiter(getattr(obj, self._name)())
495
493
496 def __repr__(self):
494 def __repr__(self):
497 if self._doc is None:
495 if self._doc is None:
498 return "IterMethod(%r)" % self._name
496 return "IterMethod(%r)" % self._name
499 else:
497 else:
500 return "IterMethod(%r, %r)" % (self._name, self._doc)
498 return "IterMethod(%r, %r)" % (self._name, self._doc)
501
499
502
500
503 class FunctionDescriptor(Descriptor):
501 class FunctionDescriptor(Descriptor):
504 """
502 """
505 A ``FunctionDescriptor`` turns a function into a descriptor. The function
503 A ``FunctionDescriptor`` turns a function into a descriptor. The function
506 will be called with the object to get the type and value of the attribute.
504 will be called with the object to get the type and value of the attribute.
507 """
505 """
508 __slots__ = ("_function", "_name", "_doc")
506 __slots__ = ("_function", "_name", "_doc")
509
507
510 def __init__(self, function, name=None, doc=None):
508 def __init__(self, function, name=None, doc=None):
511 self._function = function
509 self._function = function
512 self._name = name
510 self._name = name
513 self._doc = doc
511 self._doc = doc
514
512
515 def key(self):
513 def key(self):
516 return self._function
514 return self._function
517
515
518 def name(self):
516 def name(self):
519 if self._name is not None:
517 if self._name is not None:
520 return self._name
518 return self._name
521 return getattr(self._function, "__xname__", self._function.__name__)
519 return getattr(self._function, "__xname__", self._function.__name__)
522
520
523 def doc(self, obj):
521 def doc(self, obj):
524 if self._doc is None:
522 if self._doc is None:
525 return self._function.__doc__
523 return self._function.__doc__
526 return self._doc
524 return self._doc
527
525
528 def attrtype(self, obj):
526 def attrtype(self, obj):
529 return "function"
527 return "function"
530
528
531 def valuetype(self, obj):
529 def valuetype(self, obj):
532 return type(self._function(obj))
530 return type(self._function(obj))
533
531
534 def value(self, obj):
532 def value(self, obj):
535 return self._function(obj)
533 return self._function(obj)
536
534
537 def __repr__(self):
535 def __repr__(self):
538 if self._doc is None:
536 if self._doc is None:
539 return "Function(%r)" % self._name
537 return "Function(%r)" % self._name
540 else:
538 else:
541 return "Function(%r, %r)" % (self._name, self._doc)
539 return "Function(%r, %r)" % (self._name, self._doc)
542
540
543
541
544 class Table(object):
542 class Table(object):
545 """
543 """
546 A ``Table`` is an object that produces items (just like a normal Python
544 A ``Table`` is an object that produces items (just like a normal Python
547 iterator/generator does) and can be used as the first object in a pipeline
545 iterator/generator does) and can be used as the first object in a pipeline
548 expression. The displayhook will open the default browser for such an object
546 expression. The displayhook will open the default browser for such an object
549 (instead of simply printing the ``repr()`` result).
547 (instead of simply printing the ``repr()`` result).
550 """
548 """
551
549
552 # We want to support ``foo`` and ``foo()`` in pipeline expression:
550 # We want to support ``foo`` and ``foo()`` in pipeline expression:
553 # So we implement the required operators (``|`` and ``+``) in the metaclass,
551 # So we implement the required operators (``|`` and ``+``) in the metaclass,
554 # instantiate the class and forward the operator to the instance
552 # instantiate the class and forward the operator to the instance
555 class __metaclass__(type):
553 class __metaclass__(type):
556 def __iter__(self):
554 def __iter__(self):
557 return iter(self())
555 return iter(self())
558
556
559 def __or__(self, other):
557 def __or__(self, other):
560 return self() | other
558 return self() | other
561
559
562 def __add__(self, other):
560 def __add__(self, other):
563 return self() + other
561 return self() + other
564
562
565 def __radd__(self, other):
563 def __radd__(self, other):
566 return other + self()
564 return other + self()
567
565
568 def __getitem__(self, index):
566 def __getitem__(self, index):
569 return self()[index]
567 return self()[index]
570
568
571 def __getitem__(self, index):
569 def __getitem__(self, index):
572 return item(self, index)
570 return item(self, index)
573
571
574 def __contains__(self, item):
572 def __contains__(self, item):
575 for haveitem in self:
573 for haveitem in self:
576 if item == haveitem:
574 if item == haveitem:
577 return True
575 return True
578 return False
576 return False
579
577
580 def __or__(self, other):
578 def __or__(self, other):
581 # autoinstantiate right hand side
579 # autoinstantiate right hand side
582 if isinstance(other, type) and issubclass(other, (Table, Display)):
580 if isinstance(other, type) and issubclass(other, (Table, Display)):
583 other = other()
581 other = other()
584 # treat simple strings and functions as ``ieval`` instances
582 # treat simple strings and functions as ``ieval`` instances
585 elif not isinstance(other, Display) and not isinstance(other, Table):
583 elif not isinstance(other, Display) and not isinstance(other, Table):
586 other = ieval(other)
584 other = ieval(other)
587 # forward operations to the right hand side
585 # forward operations to the right hand side
588 return other.__ror__(self)
586 return other.__ror__(self)
589
587
590 def __add__(self, other):
588 def __add__(self, other):
591 # autoinstantiate right hand side
589 # autoinstantiate right hand side
592 if isinstance(other, type) and issubclass(other, Table):
590 if isinstance(other, type) and issubclass(other, Table):
593 other = other()
591 other = other()
594 return ichain(self, other)
592 return ichain(self, other)
595
593
596 def __radd__(self, other):
594 def __radd__(self, other):
597 # autoinstantiate left hand side
595 # autoinstantiate left hand side
598 if isinstance(other, type) and issubclass(other, Table):
596 if isinstance(other, type) and issubclass(other, Table):
599 other = other()
597 other = other()
600 return ichain(other, self)
598 return ichain(other, self)
601
599
602
600
603 class Pipe(Table):
601 class Pipe(Table):
604 """
602 """
605 A ``Pipe`` is an object that can be used in a pipeline expression. It
603 A ``Pipe`` is an object that can be used in a pipeline expression. It
606 processes the objects it gets from its input ``Table``/``Pipe``. Note that
604 processes the objects it gets from its input ``Table``/``Pipe``. Note that
607 a ``Pipe`` object can't be used as the first object in a pipeline
605 a ``Pipe`` object can't be used as the first object in a pipeline
608 expression, as it doesn't produces items itself.
606 expression, as it doesn't produces items itself.
609 """
607 """
610 class __metaclass__(Table.__metaclass__):
608 class __metaclass__(Table.__metaclass__):
611 def __ror__(self, input):
609 def __ror__(self, input):
612 return input | self()
610 return input | self()
613
611
614 def __ror__(self, input):
612 def __ror__(self, input):
615 # autoinstantiate left hand side
613 # autoinstantiate left hand side
616 if isinstance(input, type) and issubclass(input, Table):
614 if isinstance(input, type) and issubclass(input, Table):
617 input = input()
615 input = input()
618 self.input = input
616 self.input = input
619 return self
617 return self
620
618
621
619
622 def xrepr(item, mode="default"):
620 def xrepr(item, mode="default"):
623 """
621 """
624 Generic function that adds color output and different display modes to ``repr``.
622 Generic function that adds color output and different display modes to ``repr``.
625
623
626 The result of an ``xrepr`` call is iterable and consists of ``(style, string)``
624 The result of an ``xrepr`` call is iterable and consists of ``(style, string)``
627 tuples. The ``style`` in this tuple must be a ``Style`` object from the
625 tuples. The ``style`` in this tuple must be a ``Style`` object from the
628 ``astring`` module. To reconfigure the output the first yielded tuple can be
626 ``astring`` module. To reconfigure the output the first yielded tuple can be
629 a ``(aligment, full)`` tuple instead of a ``(style, string)`` tuple.
627 a ``(aligment, full)`` tuple instead of a ``(style, string)`` tuple.
630 ``alignment`` can be -1 for left aligned, 0 for centered and 1 for right
628 ``alignment`` can be -1 for left aligned, 0 for centered and 1 for right
631 aligned (the default is left alignment). ``full`` is a boolean that specifies
629 aligned (the default is left alignment). ``full`` is a boolean that specifies
632 whether the complete output must be displayed or the ``Display`` object is
630 whether the complete output must be displayed or the ``Display`` object is
633 allowed to stop output after enough text has been produced (e.g. a syntax
631 allowed to stop output after enough text has been produced (e.g. a syntax
634 highlighted text line would use ``True``, but for a large data structure
632 highlighted text line would use ``True``, but for a large data structure
635 (i.e. a nested list, tuple or dictionary) ``False`` would be used).
633 (i.e. a nested list, tuple or dictionary) ``False`` would be used).
636 The default is full output.
634 The default is full output.
637
635
638 There are four different possible values for ``mode`` depending on where
636 There are four different possible values for ``mode`` depending on where
639 the ``Display`` object will display ``item``:
637 the ``Display`` object will display ``item``:
640
638
641 * ``"header"``: ``item`` will be displayed in a header line (this is used by
639 * ``"header"``: ``item`` will be displayed in a header line (this is used by
642 ``ibrowse``).
640 ``ibrowse``).
643 * ``"footer"``: ``item`` will be displayed in a footer line (this is used by
641 * ``"footer"``: ``item`` will be displayed in a footer line (this is used by
644 ``ibrowse``).
642 ``ibrowse``).
645 * ``"cell"``: ``item`` will be displayed in a table cell/list.
643 * ``"cell"``: ``item`` will be displayed in a table cell/list.
646 * ``"default"``: default mode. If an ``xrepr`` implementation recursively
644 * ``"default"``: default mode. If an ``xrepr`` implementation recursively
647 outputs objects, ``"default"`` must be passed in the recursive calls to
645 outputs objects, ``"default"`` must be passed in the recursive calls to
648 ``xrepr``.
646 ``xrepr``.
649
647
650 If no implementation is registered for ``item``, ``xrepr`` will try the
648 If no implementation is registered for ``item``, ``xrepr`` will try the
651 ``__xrepr__`` method on ``item``. If ``item`` doesn't have an ``__xrepr__``
649 ``__xrepr__`` method on ``item``. If ``item`` doesn't have an ``__xrepr__``
652 method it falls back to ``repr``/``__repr__`` for all modes.
650 method it falls back to ``repr``/``__repr__`` for all modes.
653 """
651 """
654 try:
652 try:
655 func = item.__xrepr__
653 func = item.__xrepr__
656 except AttributeError:
654 except AttributeError:
657 yield (astyle.style_default, repr(item))
655 yield (astyle.style_default, repr(item))
658 else:
656 else:
659 try:
657 try:
660 for x in func(mode):
658 for x in func(mode):
661 yield x
659 yield x
662 except (KeyboardInterrupt, SystemExit):
660 except (KeyboardInterrupt, SystemExit):
663 raise
661 raise
664 except Exception:
662 except Exception:
665 yield (astyle.style_default, repr(item))
663 yield (astyle.style_default, repr(item))
666 xrepr = simplegeneric.generic(xrepr)
664 xrepr = simplegeneric.generic(xrepr)
667
665
668
666
669 def xrepr_none(self, mode="default"):
667 def xrepr_none(self, mode="default"):
670 yield (astyle.style_type_none, repr(self))
668 yield (astyle.style_type_none, repr(self))
671 xrepr.when_object(None)(xrepr_none)
669 xrepr.when_object(None)(xrepr_none)
672
670
673
671
674 def xrepr_noitem(self, mode="default"):
672 def xrepr_noitem(self, mode="default"):
675 yield (2, True)
673 yield (2, True)
676 yield (astyle.style_nodata, "<?>")
674 yield (astyle.style_nodata, "<?>")
677 xrepr.when_object(noitem)(xrepr_noitem)
675 xrepr.when_object(noitem)(xrepr_noitem)
678
676
679
677
680 def xrepr_bool(self, mode="default"):
678 def xrepr_bool(self, mode="default"):
681 yield (astyle.style_type_bool, repr(self))
679 yield (astyle.style_type_bool, repr(self))
682 xrepr.when_type(bool)(xrepr_bool)
680 xrepr.when_type(bool)(xrepr_bool)
683
681
684
682
685 def xrepr_str(self, mode="default"):
683 def xrepr_str(self, mode="default"):
686 if mode == "cell":
684 if mode == "cell":
687 yield (astyle.style_default, repr(self.expandtabs(tab))[1:-1])
685 yield (astyle.style_default, repr(self.expandtabs(tab))[1:-1])
688 else:
686 else:
689 yield (astyle.style_default, repr(self))
687 yield (astyle.style_default, repr(self))
690 xrepr.when_type(str)(xrepr_str)
688 xrepr.when_type(str)(xrepr_str)
691
689
692
690
693 def xrepr_unicode(self, mode="default"):
691 def xrepr_unicode(self, mode="default"):
694 if mode == "cell":
692 if mode == "cell":
695 yield (astyle.style_default, repr(self.expandtabs(tab))[2:-1])
693 yield (astyle.style_default, repr(self.expandtabs(tab))[2:-1])
696 else:
694 else:
697 yield (astyle.style_default, repr(self))
695 yield (astyle.style_default, repr(self))
698 xrepr.when_type(unicode)(xrepr_unicode)
696 xrepr.when_type(unicode)(xrepr_unicode)
699
697
700
698
701 def xrepr_number(self, mode="default"):
699 def xrepr_number(self, mode="default"):
702 yield (1, True)
700 yield (1, True)
703 yield (astyle.style_type_number, repr(self))
701 yield (astyle.style_type_number, repr(self))
704 xrepr.when_type(int)(xrepr_number)
702 xrepr.when_type(int)(xrepr_number)
705 xrepr.when_type(long)(xrepr_number)
703 xrepr.when_type(long)(xrepr_number)
706 xrepr.when_type(float)(xrepr_number)
704 xrepr.when_type(float)(xrepr_number)
707
705
708
706
709 def xrepr_complex(self, mode="default"):
707 def xrepr_complex(self, mode="default"):
710 yield (astyle.style_type_number, repr(self))
708 yield (astyle.style_type_number, repr(self))
711 xrepr.when_type(complex)(xrepr_number)
709 xrepr.when_type(complex)(xrepr_number)
712
710
713
711
714 def xrepr_datetime(self, mode="default"):
712 def xrepr_datetime(self, mode="default"):
715 if mode == "cell":
713 if mode == "cell":
716 # Don't use strftime() here, as this requires year >= 1900
714 # Don't use strftime() here, as this requires year >= 1900
717 yield (astyle.style_type_datetime,
715 yield (astyle.style_type_datetime,
718 "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
716 "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
719 (self.year, self.month, self.day,
717 (self.year, self.month, self.day,
720 self.hour, self.minute, self.second,
718 self.hour, self.minute, self.second,
721 self.microsecond),
719 self.microsecond),
722 )
720 )
723 else:
721 else:
724 yield (astyle.style_type_datetime, repr(self))
722 yield (astyle.style_type_datetime, repr(self))
725 xrepr.when_type(datetime.datetime)(xrepr_datetime)
723 xrepr.when_type(datetime.datetime)(xrepr_datetime)
726
724
727
725
728 def xrepr_date(self, mode="default"):
726 def xrepr_date(self, mode="default"):
729 if mode == "cell":
727 if mode == "cell":
730 yield (astyle.style_type_datetime,
728 yield (astyle.style_type_datetime,
731 "%04d-%02d-%02d" % (self.year, self.month, self.day))
729 "%04d-%02d-%02d" % (self.year, self.month, self.day))
732 else:
730 else:
733 yield (astyle.style_type_datetime, repr(self))
731 yield (astyle.style_type_datetime, repr(self))
734 xrepr.when_type(datetime.date)(xrepr_date)
732 xrepr.when_type(datetime.date)(xrepr_date)
735
733
736
734
737 def xrepr_time(self, mode="default"):
735 def xrepr_time(self, mode="default"):
738 if mode == "cell":
736 if mode == "cell":
739 yield (astyle.style_type_datetime,
737 yield (astyle.style_type_datetime,
740 "%02d:%02d:%02d.%06d" % \
738 "%02d:%02d:%02d.%06d" % \
741 (self.hour, self.minute, self.second, self.microsecond))
739 (self.hour, self.minute, self.second, self.microsecond))
742 else:
740 else:
743 yield (astyle.style_type_datetime, repr(self))
741 yield (astyle.style_type_datetime, repr(self))
744 xrepr.when_type(datetime.time)(xrepr_time)
742 xrepr.when_type(datetime.time)(xrepr_time)
745
743
746
744
747 def xrepr_timedelta(self, mode="default"):
745 def xrepr_timedelta(self, mode="default"):
748 yield (astyle.style_type_datetime, repr(self))
746 yield (astyle.style_type_datetime, repr(self))
749 xrepr.when_type(datetime.timedelta)(xrepr_timedelta)
747 xrepr.when_type(datetime.timedelta)(xrepr_timedelta)
750
748
751
749
752 def xrepr_type(self, mode="default"):
750 def xrepr_type(self, mode="default"):
753 if self.__module__ == "__builtin__":
751 if self.__module__ == "__builtin__":
754 yield (astyle.style_type_type, self.__name__)
752 yield (astyle.style_type_type, self.__name__)
755 else:
753 else:
756 yield (astyle.style_type_type, "%s.%s" % (self.__module__, self.__name__))
754 yield (astyle.style_type_type, "%s.%s" % (self.__module__, self.__name__))
757 xrepr.when_type(type)(xrepr_type)
755 xrepr.when_type(type)(xrepr_type)
758
756
759
757
760 def xrepr_exception(self, mode="default"):
758 def xrepr_exception(self, mode="default"):
761 if self.__class__.__module__ == "exceptions":
759 if self.__class__.__module__ == "exceptions":
762 classname = self.__class__.__name__
760 classname = self.__class__.__name__
763 else:
761 else:
764 classname = "%s.%s" % \
762 classname = "%s.%s" % \
765 (self.__class__.__module__, self.__class__.__name__)
763 (self.__class__.__module__, self.__class__.__name__)
766 if mode == "header" or mode == "footer":
764 if mode == "header" or mode == "footer":
767 yield (astyle.style_error, "%s: %s" % (classname, self))
765 yield (astyle.style_error, "%s: %s" % (classname, self))
768 else:
766 else:
769 yield (astyle.style_error, classname)
767 yield (astyle.style_error, classname)
770 xrepr.when_type(Exception)(xrepr_exception)
768 xrepr.when_type(Exception)(xrepr_exception)
771
769
772
770
773 def xrepr_listtuple(self, mode="default"):
771 def xrepr_listtuple(self, mode="default"):
774 if mode == "header" or mode == "footer":
772 if mode == "header" or mode == "footer":
775 if self.__class__.__module__ == "__builtin__":
773 if self.__class__.__module__ == "__builtin__":
776 classname = self.__class__.__name__
774 classname = self.__class__.__name__
777 else:
775 else:
778 classname = "%s.%s" % \
776 classname = "%s.%s" % \
779 (self.__class__.__module__,self.__class__.__name__)
777 (self.__class__.__module__,self.__class__.__name__)
780 yield (astyle.style_default,
778 yield (astyle.style_default,
781 "<%s object with %d items at 0x%x>" % \
779 "<%s object with %d items at 0x%x>" % \
782 (classname, len(self), id(self)))
780 (classname, len(self), id(self)))
783 else:
781 else:
784 yield (-1, False)
782 yield (-1, False)
785 if isinstance(self, list):
783 if isinstance(self, list):
786 yield (astyle.style_default, "[")
784 yield (astyle.style_default, "[")
787 end = "]"
785 end = "]"
788 else:
786 else:
789 yield (astyle.style_default, "(")
787 yield (astyle.style_default, "(")
790 end = ")"
788 end = ")"
791 for (i, subself) in enumerate(self):
789 for (i, subself) in enumerate(self):
792 if i:
790 if i:
793 yield (astyle.style_default, ", ")
791 yield (astyle.style_default, ", ")
794 for part in xrepr(subself, "default"):
792 for part in xrepr(subself, "default"):
795 yield part
793 yield part
796 yield (astyle.style_default, end)
794 yield (astyle.style_default, end)
797 xrepr.when_type(list)(xrepr_listtuple)
795 xrepr.when_type(list)(xrepr_listtuple)
798 xrepr.when_type(tuple)(xrepr_listtuple)
796 xrepr.when_type(tuple)(xrepr_listtuple)
799
797
800
798
801 def xrepr_dict(self, mode="default"):
799 def xrepr_dict(self, mode="default"):
802 if mode == "header" or mode == "footer":
800 if mode == "header" or mode == "footer":
803 if self.__class__.__module__ == "__builtin__":
801 if self.__class__.__module__ == "__builtin__":
804 classname = self.__class__.__name__
802 classname = self.__class__.__name__
805 else:
803 else:
806 classname = "%s.%s" % \
804 classname = "%s.%s" % \
807 (self.__class__.__module__,self.__class__.__name__)
805 (self.__class__.__module__,self.__class__.__name__)
808 yield (astyle.style_default,
806 yield (astyle.style_default,
809 "<%s object with %d items at 0x%x>" % \
807 "<%s object with %d items at 0x%x>" % \
810 (classname, len(self), id(self)))
808 (classname, len(self), id(self)))
811 else:
809 else:
812 yield (-1, False)
810 yield (-1, False)
813 if isinstance(self, dict):
811 if isinstance(self, dict):
814 yield (astyle.style_default, "{")
812 yield (astyle.style_default, "{")
815 end = "}"
813 end = "}"
816 else:
814 else:
817 yield (astyle.style_default, "dictproxy((")
815 yield (astyle.style_default, "dictproxy((")
818 end = "})"
816 end = "})"
819 for (i, (key, value)) in enumerate(self.iteritems()):
817 for (i, (key, value)) in enumerate(self.iteritems()):
820 if i:
818 if i:
821 yield (astyle.style_default, ", ")
819 yield (astyle.style_default, ", ")
822 for part in xrepr(key, "default"):
820 for part in xrepr(key, "default"):
823 yield part
821 yield part
824 yield (astyle.style_default, ": ")
822 yield (astyle.style_default, ": ")
825 for part in xrepr(value, "default"):
823 for part in xrepr(value, "default"):
826 yield part
824 yield part
827 yield (astyle.style_default, end)
825 yield (astyle.style_default, end)
828 xrepr.when_type(dict)(xrepr_dict)
826 xrepr.when_type(dict)(xrepr_dict)
829 xrepr.when_type(types.DictProxyType)(xrepr_dict)
827 xrepr.when_type(types.DictProxyType)(xrepr_dict)
830
828
831
829
832 def upgradexattr(attr):
830 def upgradexattr(attr):
833 """
831 """
834 Convert an attribute descriptor string to a real descriptor object.
832 Convert an attribute descriptor string to a real descriptor object.
835
833
836 If attr already is a descriptor object return if unmodified. A
834 If attr already is a descriptor object return if unmodified. A
837 ``SelfDescriptor`` will be returned if ``attr`` is ``None``. ``"foo"``
835 ``SelfDescriptor`` will be returned if ``attr`` is ``None``. ``"foo"``
838 returns an ``AttributeDescriptor`` for the attribute named ``"foo"``.
836 returns an ``AttributeDescriptor`` for the attribute named ``"foo"``.
839 ``"foo()"`` returns a ``MethodDescriptor`` for the method named ``"foo"``.
837 ``"foo()"`` returns a ``MethodDescriptor`` for the method named ``"foo"``.
840 ``"-foo"`` will return an ``IterAttributeDescriptor`` for the attribute
838 ``"-foo"`` will return an ``IterAttributeDescriptor`` for the attribute
841 named ``"foo"`` and ``"-foo()"`` will return an ``IterMethodDescriptor``
839 named ``"foo"`` and ``"-foo()"`` will return an ``IterMethodDescriptor``
842 for the method named ``"foo"``. Furthermore integer will return the appropriate
840 for the method named ``"foo"``. Furthermore integer will return the appropriate
843 ``IndexDescriptor`` and callables will return a ``FunctionDescriptor``.
841 ``IndexDescriptor`` and callables will return a ``FunctionDescriptor``.
844 """
842 """
845 if attr is None:
843 if attr is None:
846 return selfdescriptor
844 return selfdescriptor
847 elif isinstance(attr, Descriptor):
845 elif isinstance(attr, Descriptor):
848 return attr
846 return attr
849 elif isinstance(attr, str):
847 elif isinstance(attr, str):
850 if attr.endswith("()"):
848 if attr.endswith("()"):
851 if attr.startswith("-"):
849 if attr.startswith("-"):
852 return IterMethodDescriptor(attr[1:-2])
850 return IterMethodDescriptor(attr[1:-2])
853 else:
851 else:
854 return MethodDescriptor(attr[:-2])
852 return MethodDescriptor(attr[:-2])
855 else:
853 else:
856 if attr.startswith("-"):
854 if attr.startswith("-"):
857 return IterAttributeDescriptor(attr[1:])
855 return IterAttributeDescriptor(attr[1:])
858 else:
856 else:
859 return AttributeDescriptor(attr)
857 return AttributeDescriptor(attr)
860 elif isinstance(attr, (int, long)):
858 elif isinstance(attr, (int, long)):
861 return IndexDescriptor(attr)
859 return IndexDescriptor(attr)
862 elif callable(attr):
860 elif callable(attr):
863 return FunctionDescriptor(attr)
861 return FunctionDescriptor(attr)
864 else:
862 else:
865 raise TypeError("can't handle descriptor %r" % attr)
863 raise TypeError("can't handle descriptor %r" % attr)
866
864
867
865
868 def xattrs(item, mode="default"):
866 def xattrs(item, mode="default"):
869 """
867 """
870 Generic function that returns an iterable of attribute descriptors
868 Generic function that returns an iterable of attribute descriptors
871 to be used for displaying the attributes ob the object ``item`` in display
869 to be used for displaying the attributes ob the object ``item`` in display
872 mode ``mode``.
870 mode ``mode``.
873
871
874 There are two possible modes:
872 There are two possible modes:
875
873
876 * ``"detail"``: The ``Display`` object wants to display a detailed list
874 * ``"detail"``: The ``Display`` object wants to display a detailed list
877 of the object attributes.
875 of the object attributes.
878 * ``"default"``: The ``Display`` object wants to display the object in a
876 * ``"default"``: The ``Display`` object wants to display the object in a
879 list view.
877 list view.
880
878
881 If no implementation is registered for the object ``item`` ``xattrs`` falls
879 If no implementation is registered for the object ``item`` ``xattrs`` falls
882 back to trying the ``__xattrs__`` method of the object. If this doesn't
880 back to trying the ``__xattrs__`` method of the object. If this doesn't
883 exist either, ``dir(item)`` is used for ``"detail"`` mode and ``(None,)``
881 exist either, ``dir(item)`` is used for ``"detail"`` mode and ``(None,)``
884 for ``"default"`` mode.
882 for ``"default"`` mode.
885
883
886 The implementation must yield attribute descriptor (see the class
884 The implementation must yield attribute descriptor (see the class
887 ``Descriptor`` for more info). The ``__xattrs__`` method may also return
885 ``Descriptor`` for more info). The ``__xattrs__`` method may also return
888 attribute descriptor string (and ``None``) which will be converted to real
886 attribute descriptor string (and ``None``) which will be converted to real
889 descriptors by ``upgradexattr()``.
887 descriptors by ``upgradexattr()``.
890 """
888 """
891 try:
889 try:
892 func = item.__xattrs__
890 func = item.__xattrs__
893 except AttributeError:
891 except AttributeError:
894 if mode == "detail":
892 if mode == "detail":
895 for attrname in dir(item):
893 for attrname in dir(item):
896 yield AttributeDescriptor(attrname)
894 yield AttributeDescriptor(attrname)
897 else:
895 else:
898 yield selfdescriptor
896 yield selfdescriptor
899 else:
897 else:
900 for attr in func(mode):
898 for attr in func(mode):
901 yield upgradexattr(attr)
899 yield upgradexattr(attr)
902 xattrs = simplegeneric.generic(xattrs)
900 xattrs = simplegeneric.generic(xattrs)
903
901
904
902
905 def xattrs_complex(self, mode="default"):
903 def xattrs_complex(self, mode="default"):
906 if mode == "detail":
904 if mode == "detail":
907 return (AttributeDescriptor("real"), AttributeDescriptor("imag"))
905 return (AttributeDescriptor("real"), AttributeDescriptor("imag"))
908 return (selfdescriptor,)
906 return (selfdescriptor,)
909 xattrs.when_type(complex)(xattrs_complex)
907 xattrs.when_type(complex)(xattrs_complex)
910
908
911
909
912 def _isdict(item):
910 def _isdict(item):
913 try:
911 try:
914 itermeth = item.__class__.__iter__
912 itermeth = item.__class__.__iter__
915 except (AttributeError, TypeError):
913 except (AttributeError, TypeError):
916 return False
914 return False
917 return itermeth is dict.__iter__ or itermeth is types.DictProxyType.__iter__
915 return itermeth is dict.__iter__ or itermeth is types.DictProxyType.__iter__
918
916
919
917
920 def _isstr(item):
918 def _isstr(item):
921 if not isinstance(item, basestring):
919 if not isinstance(item, basestring):
922 return False
920 return False
923 try:
921 try:
924 itermeth = item.__class__.__iter__
922 itermeth = item.__class__.__iter__
925 except AttributeError:
923 except AttributeError:
926 return True
924 return True
927 return False # ``__iter__`` has been redefined
925 return False # ``__iter__`` has been redefined
928
926
929
927
930 def xiter(item):
928 def xiter(item):
931 """
929 """
932 Generic function that implements iteration for pipeline expression. If no
930 Generic function that implements iteration for pipeline expression. If no
933 implementation is registered for ``item`` ``xiter`` falls back to ``iter``.
931 implementation is registered for ``item`` ``xiter`` falls back to ``iter``.
934 """
932 """
935 try:
933 try:
936 func = item.__xiter__
934 func = item.__xiter__
937 except AttributeError:
935 except AttributeError:
938 if _isdict(item):
936 if _isdict(item):
939 def items(item):
937 def items(item):
940 fields = ("key", "value")
938 fields = ("key", "value")
941 for (key, value) in item.iteritems():
939 for (key, value) in item.iteritems():
942 yield Fields(fields, key=key, value=value)
940 yield Fields(fields, key=key, value=value)
943 return items(item)
941 return items(item)
944 elif isinstance(item, new.module):
942 elif isinstance(item, new.module):
945 def items(item):
943 def items(item):
946 fields = ("key", "value")
944 fields = ("key", "value")
947 for key in sorted(item.__dict__):
945 for key in sorted(item.__dict__):
948 yield Fields(fields, key=key, value=getattr(item, key))
946 yield Fields(fields, key=key, value=getattr(item, key))
949 return items(item)
947 return items(item)
950 elif _isstr(item):
948 elif _isstr(item):
951 if not item:
949 if not item:
952 raise ValueError("can't enter empty string")
950 raise ValueError("can't enter empty string")
953 lines = item.splitlines()
951 lines = item.splitlines()
954 if len(lines) == 1:
952 if len(lines) == 1:
955 def iterone(item):
953 def iterone(item):
956 yield item
954 yield item
957 return iterone(item)
955 return iterone(item)
958 else:
956 else:
959 return iter(lines)
957 return iter(lines)
960 return iter(item)
958 return iter(item)
961 else:
959 else:
962 return iter(func()) # iter() just to be safe
960 return iter(func()) # iter() just to be safe
963 xiter = simplegeneric.generic(xiter)
961 xiter = simplegeneric.generic(xiter)
964
962
965
963
966 class ichain(Pipe):
964 class ichain(Pipe):
967 """
965 """
968 Chains multiple ``Table``s into one.
966 Chains multiple ``Table``s into one.
969 """
967 """
970
968
971 def __init__(self, *iters):
969 def __init__(self, *iters):
972 self.iters = iters
970 self.iters = iters
973
971
974 def __iter__(self):
972 def __iter__(self):
975 return itertools.chain(*self.iters)
973 return itertools.chain(*self.iters)
976
974
977 def __xrepr__(self, mode="default"):
975 def __xrepr__(self, mode="default"):
978 if mode == "header" or mode == "footer":
976 if mode == "header" or mode == "footer":
979 for (i, item) in enumerate(self.iters):
977 for (i, item) in enumerate(self.iters):
980 if i:
978 if i:
981 yield (astyle.style_default, "+")
979 yield (astyle.style_default, "+")
982 if isinstance(item, Pipe):
980 if isinstance(item, Pipe):
983 yield (astyle.style_default, "(")
981 yield (astyle.style_default, "(")
984 for part in xrepr(item, mode):
982 for part in xrepr(item, mode):
985 yield part
983 yield part
986 if isinstance(item, Pipe):
984 if isinstance(item, Pipe):
987 yield (astyle.style_default, ")")
985 yield (astyle.style_default, ")")
988 else:
986 else:
989 yield (astyle.style_default, repr(self))
987 yield (astyle.style_default, repr(self))
990
988
991 def __repr__(self):
989 def __repr__(self):
992 args = ", ".join([repr(it) for it in self.iters])
990 args = ", ".join([repr(it) for it in self.iters])
993 return "%s.%s(%s)" % \
991 return "%s.%s(%s)" % \
994 (self.__class__.__module__, self.__class__.__name__, args)
992 (self.__class__.__module__, self.__class__.__name__, args)
995
993
996
994
997 class ifile(path.path):
995 class ifile(path.path):
998 """
996 """
999 file (or directory) object.
997 file (or directory) object.
1000 """
998 """
1001
999
1002 def getmode(self):
1000 def getmode(self):
1003 return self.stat().st_mode
1001 return self.stat().st_mode
1004 mode = property(getmode, None, None, "Access mode")
1002 mode = property(getmode, None, None, "Access mode")
1005
1003
1006 def gettype(self):
1004 def gettype(self):
1007 data = [
1005 data = [
1008 (stat.S_ISREG, "file"),
1006 (stat.S_ISREG, "file"),
1009 (stat.S_ISDIR, "dir"),
1007 (stat.S_ISDIR, "dir"),
1010 (stat.S_ISCHR, "chardev"),
1008 (stat.S_ISCHR, "chardev"),
1011 (stat.S_ISBLK, "blockdev"),
1009 (stat.S_ISBLK, "blockdev"),
1012 (stat.S_ISFIFO, "fifo"),
1010 (stat.S_ISFIFO, "fifo"),
1013 (stat.S_ISLNK, "symlink"),
1011 (stat.S_ISLNK, "symlink"),
1014 (stat.S_ISSOCK,"socket"),
1012 (stat.S_ISSOCK,"socket"),
1015 ]
1013 ]
1016 lstat = self.lstat()
1014 lstat = self.lstat()
1017 if lstat is not None:
1015 if lstat is not None:
1018 types = set([text for (func, text) in data if func(lstat.st_mode)])
1016 types = set([text for (func, text) in data if func(lstat.st_mode)])
1019 else:
1017 else:
1020 types = set()
1018 types = set()
1021 m = self.mode
1019 m = self.mode
1022 types.update([text for (func, text) in data if func(m)])
1020 types.update([text for (func, text) in data if func(m)])
1023 return ", ".join(types)
1021 return ", ".join(types)
1024 type = property(gettype, None, None, "file type (file, directory, link, etc.)")
1022 type = property(gettype, None, None, "file type (file, directory, link, etc.)")
1025
1023
1026 def getmodestr(self):
1024 def getmodestr(self):
1027 m = self.mode
1025 m = self.mode
1028 data = [
1026 data = [
1029 (stat.S_IRUSR, "-r"),
1027 (stat.S_IRUSR, "-r"),
1030 (stat.S_IWUSR, "-w"),
1028 (stat.S_IWUSR, "-w"),
1031 (stat.S_IXUSR, "-x"),
1029 (stat.S_IXUSR, "-x"),
1032 (stat.S_IRGRP, "-r"),
1030 (stat.S_IRGRP, "-r"),
1033 (stat.S_IWGRP, "-w"),
1031 (stat.S_IWGRP, "-w"),
1034 (stat.S_IXGRP, "-x"),
1032 (stat.S_IXGRP, "-x"),
1035 (stat.S_IROTH, "-r"),
1033 (stat.S_IROTH, "-r"),
1036 (stat.S_IWOTH, "-w"),
1034 (stat.S_IWOTH, "-w"),
1037 (stat.S_IXOTH, "-x"),
1035 (stat.S_IXOTH, "-x"),
1038 ]
1036 ]
1039 return "".join([text[bool(m&bit)] for (bit, text) in data])
1037 return "".join([text[bool(m&bit)] for (bit, text) in data])
1040
1038
1041 modestr = property(getmodestr, None, None, "Access mode as string")
1039 modestr = property(getmodestr, None, None, "Access mode as string")
1042
1040
1043 def getblocks(self):
1041 def getblocks(self):
1044 return self.stat().st_blocks
1042 return self.stat().st_blocks
1045 blocks = property(getblocks, None, None, "File size in blocks")
1043 blocks = property(getblocks, None, None, "File size in blocks")
1046
1044
1047 def getblksize(self):
1045 def getblksize(self):
1048 return self.stat().st_blksize
1046 return self.stat().st_blksize
1049 blksize = property(getblksize, None, None, "Filesystem block size")
1047 blksize = property(getblksize, None, None, "Filesystem block size")
1050
1048
1051 def getdev(self):
1049 def getdev(self):
1052 return self.stat().st_dev
1050 return self.stat().st_dev
1053 dev = property(getdev)
1051 dev = property(getdev)
1054
1052
1055 def getnlink(self):
1053 def getnlink(self):
1056 return self.stat().st_nlink
1054 return self.stat().st_nlink
1057 nlink = property(getnlink, None, None, "Number of links")
1055 nlink = property(getnlink, None, None, "Number of links")
1058
1056
1059 def getuid(self):
1057 def getuid(self):
1060 return self.stat().st_uid
1058 return self.stat().st_uid
1061 uid = property(getuid, None, None, "User id of file owner")
1059 uid = property(getuid, None, None, "User id of file owner")
1062
1060
1063 def getgid(self):
1061 def getgid(self):
1064 return self.stat().st_gid
1062 return self.stat().st_gid
1065 gid = property(getgid, None, None, "Group id of file owner")
1063 gid = property(getgid, None, None, "Group id of file owner")
1066
1064
1067 def getowner(self):
1065 def getowner(self):
1068 stat = self.stat()
1066 stat = self.stat()
1069 try:
1067 try:
1070 return pwd.getpwuid(stat.st_uid).pw_name
1068 return pwd.getpwuid(stat.st_uid).pw_name
1071 except KeyError:
1069 except KeyError:
1072 return stat.st_uid
1070 return stat.st_uid
1073 owner = property(getowner, None, None, "Owner name (or id)")
1071 owner = property(getowner, None, None, "Owner name (or id)")
1074
1072
1075 def getgroup(self):
1073 def getgroup(self):
1076 stat = self.stat()
1074 stat = self.stat()
1077 try:
1075 try:
1078 return grp.getgrgid(stat.st_gid).gr_name
1076 return grp.getgrgid(stat.st_gid).gr_name
1079 except KeyError:
1077 except KeyError:
1080 return stat.st_gid
1078 return stat.st_gid
1081 group = property(getgroup, None, None, "Group name (or id)")
1079 group = property(getgroup, None, None, "Group name (or id)")
1082
1080
1083 def getadate(self):
1081 def getadate(self):
1084 return datetime.datetime.utcfromtimestamp(self.atime)
1082 return datetime.datetime.utcfromtimestamp(self.atime)
1085 adate = property(getadate, None, None, "Access date")
1083 adate = property(getadate, None, None, "Access date")
1086
1084
1087 def getcdate(self):
1085 def getcdate(self):
1088 return datetime.datetime.utcfromtimestamp(self.ctime)
1086 return datetime.datetime.utcfromtimestamp(self.ctime)
1089 cdate = property(getcdate, None, None, "Creation date")
1087 cdate = property(getcdate, None, None, "Creation date")
1090
1088
1091 def getmdate(self):
1089 def getmdate(self):
1092 return datetime.datetime.utcfromtimestamp(self.mtime)
1090 return datetime.datetime.utcfromtimestamp(self.mtime)
1093 mdate = property(getmdate, None, None, "Modification date")
1091 mdate = property(getmdate, None, None, "Modification date")
1094
1092
1095 def mimetype(self):
1093 def mimetype(self):
1096 """
1094 """
1097 Return MIME type guessed from the extension.
1095 Return MIME type guessed from the extension.
1098 """
1096 """
1099 return mimetypes.guess_type(self.basename())[0]
1097 return mimetypes.guess_type(self.basename())[0]
1100
1098
1101 def encoding(self):
1099 def encoding(self):
1102 """
1100 """
1103 Return guessed compression (like "compress" or "gzip").
1101 Return guessed compression (like "compress" or "gzip").
1104 """
1102 """
1105 return mimetypes.guess_type(self.basename())[1]
1103 return mimetypes.guess_type(self.basename())[1]
1106
1104
1107 def __repr__(self):
1105 def __repr__(self):
1108 return "ifile(%s)" % path._base.__repr__(self)
1106 return "ifile(%s)" % path._base.__repr__(self)
1109
1107
1110 if sys.platform == "win32":
1108 if sys.platform == "win32":
1111 defaultattrs = (None, "type", "size", "modestr", "mdate")
1109 defaultattrs = (None, "type", "size", "modestr", "mdate")
1112 else:
1110 else:
1113 defaultattrs = (None, "type", "size", "modestr", "owner", "group", "mdate")
1111 defaultattrs = (None, "type", "size", "modestr", "owner", "group", "mdate")
1114
1112
1115 def __xattrs__(self, mode="default"):
1113 def __xattrs__(self, mode="default"):
1116 if mode == "detail":
1114 if mode == "detail":
1117 return (
1115 return (
1118 "name",
1116 "name",
1119 "basename()",
1117 "basename()",
1120 "abspath()",
1118 "abspath()",
1121 "realpath()",
1119 "realpath()",
1122 "type",
1120 "type",
1123 "mode",
1121 "mode",
1124 "modestr",
1122 "modestr",
1125 "stat()",
1123 "stat()",
1126 "lstat()",
1124 "lstat()",
1127 "uid",
1125 "uid",
1128 "gid",
1126 "gid",
1129 "owner",
1127 "owner",
1130 "group",
1128 "group",
1131 "dev",
1129 "dev",
1132 "nlink",
1130 "nlink",
1133 "ctime",
1131 "ctime",
1134 "mtime",
1132 "mtime",
1135 "atime",
1133 "atime",
1136 "cdate",
1134 "cdate",
1137 "mdate",
1135 "mdate",
1138 "adate",
1136 "adate",
1139 "size",
1137 "size",
1140 "blocks",
1138 "blocks",
1141 "blksize",
1139 "blksize",
1142 "isdir()",
1140 "isdir()",
1143 "islink()",
1141 "islink()",
1144 "mimetype()",
1142 "mimetype()",
1145 "encoding()",
1143 "encoding()",
1146 "-listdir()",
1144 "-listdir()",
1147 "-dirs()",
1145 "-dirs()",
1148 "-files()",
1146 "-files()",
1149 "-walk()",
1147 "-walk()",
1150 "-walkdirs()",
1148 "-walkdirs()",
1151 "-walkfiles()",
1149 "-walkfiles()",
1152 )
1150 )
1153 else:
1151 else:
1154 return self.defaultattrs
1152 return self.defaultattrs
1155
1153
1156
1154
1157 def xiter_ifile(self):
1155 def xiter_ifile(self):
1158 if self.isdir():
1156 if self.isdir():
1159 yield (self / os.pardir).abspath()
1157 yield (self / os.pardir).abspath()
1160 for child in sorted(self.listdir()):
1158 for child in sorted(self.listdir()):
1161 yield child
1159 yield child
1162 else:
1160 else:
1163 f = self.open("rb")
1161 f = self.open("rb")
1164 for line in f:
1162 for line in f:
1165 yield line
1163 yield line
1166 f.close()
1164 f.close()
1167 xiter.when_type(ifile)(xiter_ifile)
1165 xiter.when_type(ifile)(xiter_ifile)
1168
1166
1169
1167
1170 # We need to implement ``xrepr`` for ``ifile`` as a generic function, because
1168 # We need to implement ``xrepr`` for ``ifile`` as a generic function, because
1171 # otherwise ``xrepr_str`` would kick in.
1169 # otherwise ``xrepr_str`` would kick in.
1172 def xrepr_ifile(self, mode="default"):
1170 def xrepr_ifile(self, mode="default"):
1173 try:
1171 try:
1174 if self.isdir():
1172 if self.isdir():
1175 name = "idir"
1173 name = "idir"
1176 style = astyle.style_dir
1174 style = astyle.style_dir
1177 else:
1175 else:
1178 name = "ifile"
1176 name = "ifile"
1179 style = astyle.style_file
1177 style = astyle.style_file
1180 except IOError:
1178 except IOError:
1181 name = "ifile"
1179 name = "ifile"
1182 style = astyle.style_default
1180 style = astyle.style_default
1183 if mode in ("cell", "header", "footer"):
1181 if mode in ("cell", "header", "footer"):
1184 abspath = repr(path._base(self.normpath()))
1182 abspath = repr(path._base(self.normpath()))
1185 if abspath.startswith("u"):
1183 if abspath.startswith("u"):
1186 abspath = abspath[2:-1]
1184 abspath = abspath[2:-1]
1187 else:
1185 else:
1188 abspath = abspath[1:-1]
1186 abspath = abspath[1:-1]
1189 if mode == "cell":
1187 if mode == "cell":
1190 yield (style, abspath)
1188 yield (style, abspath)
1191 else:
1189 else:
1192 yield (style, "%s(%s)" % (name, abspath))
1190 yield (style, "%s(%s)" % (name, abspath))
1193 else:
1191 else:
1194 yield (style, repr(self))
1192 yield (style, repr(self))
1195 xrepr.when_type(ifile)(xrepr_ifile)
1193 xrepr.when_type(ifile)(xrepr_ifile)
1196
1194
1197
1195
1198 class ils(Table):
1196 class ils(Table):
1199 """
1197 """
1200 List the current (or a specified) directory.
1198 List the current (or a specified) directory.
1201
1199
1202 Examples:
1200 Examples:
1203
1201
1204 >>> ils
1202 >>> ils
1205 >>> ils("/usr/local/lib/python2.4")
1203 >>> ils("/usr/local/lib/python2.4")
1206 >>> ils("~")
1204 >>> ils("~")
1207 """
1205 """
1208 def __init__(self, base=os.curdir, dirs=True, files=True):
1206 def __init__(self, base=os.curdir, dirs=True, files=True):
1209 self.base = os.path.expanduser(base)
1207 self.base = os.path.expanduser(base)
1210 self.dirs = dirs
1208 self.dirs = dirs
1211 self.files = files
1209 self.files = files
1212
1210
1213 def __iter__(self):
1211 def __iter__(self):
1214 base = ifile(self.base)
1212 base = ifile(self.base)
1215 yield (base / os.pardir).abspath()
1213 yield (base / os.pardir).abspath()
1216 for child in sorted(base.listdir()):
1214 for child in sorted(base.listdir()):
1217 if self.dirs:
1215 if self.dirs:
1218 if self.files:
1216 if self.files:
1219 yield child
1217 yield child
1220 else:
1218 else:
1221 if child.isdir():
1219 if child.isdir():
1222 yield child
1220 yield child
1223 elif self.files:
1221 elif self.files:
1224 if not child.isdir():
1222 if not child.isdir():
1225 yield child
1223 yield child
1226
1224
1227 def __xrepr__(self, mode="default"):
1225 def __xrepr__(self, mode="default"):
1228 return xrepr(ifile(self.base), mode)
1226 return xrepr(ifile(self.base), mode)
1229
1227
1230 def __repr__(self):
1228 def __repr__(self):
1231 return "%s.%s(%r)" % \
1229 return "%s.%s(%r)" % \
1232 (self.__class__.__module__, self.__class__.__name__, self.base)
1230 (self.__class__.__module__, self.__class__.__name__, self.base)
1233
1231
1234
1232
1235 class iglob(Table):
1233 class iglob(Table):
1236 """
1234 """
1237 List all files and directories matching a specified pattern.
1235 List all files and directories matching a specified pattern.
1238 (See ``glob.glob()`` for more info.).
1236 (See ``glob.glob()`` for more info.).
1239
1237
1240 Examples:
1238 Examples:
1241
1239
1242 >>> iglob("*.py")
1240 >>> iglob("*.py")
1243 """
1241 """
1244 def __init__(self, glob):
1242 def __init__(self, glob):
1245 self.glob = glob
1243 self.glob = glob
1246
1244
1247 def __iter__(self):
1245 def __iter__(self):
1248 for name in glob.glob(self.glob):
1246 for name in glob.glob(self.glob):
1249 yield ifile(name)
1247 yield ifile(name)
1250
1248
1251 def __xrepr__(self, mode="default"):
1249 def __xrepr__(self, mode="default"):
1252 if mode == "header" or mode == "footer" or mode == "cell":
1250 if mode == "header" or mode == "footer" or mode == "cell":
1253 yield (astyle.style_default,
1251 yield (astyle.style_default,
1254 "%s(%r)" % (self.__class__.__name__, self.glob))
1252 "%s(%r)" % (self.__class__.__name__, self.glob))
1255 else:
1253 else:
1256 yield (astyle.style_default, repr(self))
1254 yield (astyle.style_default, repr(self))
1257
1255
1258 def __repr__(self):
1256 def __repr__(self):
1259 return "%s.%s(%r)" % \
1257 return "%s.%s(%r)" % \
1260 (self.__class__.__module__, self.__class__.__name__, self.glob)
1258 (self.__class__.__module__, self.__class__.__name__, self.glob)
1261
1259
1262
1260
1263 class iwalk(Table):
1261 class iwalk(Table):
1264 """
1262 """
1265 List all files and directories in a directory and it's subdirectory.
1263 List all files and directories in a directory and it's subdirectory.
1266
1264
1267 >>> iwalk
1265 >>> iwalk
1268 >>> iwalk("/usr/local/lib/python2.4")
1266 >>> iwalk("/usr/local/lib/python2.4")
1269 >>> iwalk("~")
1267 >>> iwalk("~")
1270 """
1268 """
1271 def __init__(self, base=os.curdir, dirs=True, files=True):
1269 def __init__(self, base=os.curdir, dirs=True, files=True):
1272 self.base = os.path.expanduser(base)
1270 self.base = os.path.expanduser(base)
1273 self.dirs = dirs
1271 self.dirs = dirs
1274 self.files = files
1272 self.files = files
1275
1273
1276 def __iter__(self):
1274 def __iter__(self):
1277 for (dirpath, dirnames, filenames) in os.walk(self.base):
1275 for (dirpath, dirnames, filenames) in os.walk(self.base):
1278 if self.dirs:
1276 if self.dirs:
1279 for name in sorted(dirnames):
1277 for name in sorted(dirnames):
1280 yield ifile(os.path.join(dirpath, name))
1278 yield ifile(os.path.join(dirpath, name))
1281 if self.files:
1279 if self.files:
1282 for name in sorted(filenames):
1280 for name in sorted(filenames):
1283 yield ifile(os.path.join(dirpath, name))
1281 yield ifile(os.path.join(dirpath, name))
1284
1282
1285 def __xrepr__(self, mode="default"):
1283 def __xrepr__(self, mode="default"):
1286 if mode == "header" or mode == "footer" or mode == "cell":
1284 if mode == "header" or mode == "footer" or mode == "cell":
1287 yield (astyle.style_default,
1285 yield (astyle.style_default,
1288 "%s(%r)" % (self.__class__.__name__, self.base))
1286 "%s(%r)" % (self.__class__.__name__, self.base))
1289 else:
1287 else:
1290 yield (astyle.style_default, repr(self))
1288 yield (astyle.style_default, repr(self))
1291
1289
1292 def __repr__(self):
1290 def __repr__(self):
1293 return "%s.%s(%r)" % \
1291 return "%s.%s(%r)" % \
1294 (self.__class__.__module__, self.__class__.__name__, self.base)
1292 (self.__class__.__module__, self.__class__.__name__, self.base)
1295
1293
1296
1294
1297 class ipwdentry(object):
1295 class ipwdentry(object):
1298 """
1296 """
1299 ``ipwdentry`` objects encapsulate entries in the Unix user account and
1297 ``ipwdentry`` objects encapsulate entries in the Unix user account and
1300 password database.
1298 password database.
1301 """
1299 """
1302 def __init__(self, id):
1300 def __init__(self, id):
1303 self._id = id
1301 self._id = id
1304 self._entry = None
1302 self._entry = None
1305
1303
1306 def __eq__(self, other):
1304 def __eq__(self, other):
1307 return self.__class__ is other.__class__ and self._id == other._id
1305 return self.__class__ is other.__class__ and self._id == other._id
1308
1306
1309 def __ne__(self, other):
1307 def __ne__(self, other):
1310 return self.__class__ is not other.__class__ or self._id != other._id
1308 return self.__class__ is not other.__class__ or self._id != other._id
1311
1309
1312 def _getentry(self):
1310 def _getentry(self):
1313 if self._entry is None:
1311 if self._entry is None:
1314 if isinstance(self._id, basestring):
1312 if isinstance(self._id, basestring):
1315 self._entry = pwd.getpwnam(self._id)
1313 self._entry = pwd.getpwnam(self._id)
1316 else:
1314 else:
1317 self._entry = pwd.getpwuid(self._id)
1315 self._entry = pwd.getpwuid(self._id)
1318 return self._entry
1316 return self._entry
1319
1317
1320 def getname(self):
1318 def getname(self):
1321 if isinstance(self._id, basestring):
1319 if isinstance(self._id, basestring):
1322 return self._id
1320 return self._id
1323 else:
1321 else:
1324 return self._getentry().pw_name
1322 return self._getentry().pw_name
1325 name = property(getname, None, None, "User name")
1323 name = property(getname, None, None, "User name")
1326
1324
1327 def getpasswd(self):
1325 def getpasswd(self):
1328 return self._getentry().pw_passwd
1326 return self._getentry().pw_passwd
1329 passwd = property(getpasswd, None, None, "Password")
1327 passwd = property(getpasswd, None, None, "Password")
1330
1328
1331 def getuid(self):
1329 def getuid(self):
1332 if isinstance(self._id, basestring):
1330 if isinstance(self._id, basestring):
1333 return self._getentry().pw_uid
1331 return self._getentry().pw_uid
1334 else:
1332 else:
1335 return self._id
1333 return self._id
1336 uid = property(getuid, None, None, "User id")
1334 uid = property(getuid, None, None, "User id")
1337
1335
1338 def getgid(self):
1336 def getgid(self):
1339 return self._getentry().pw_gid
1337 return self._getentry().pw_gid
1340 gid = property(getgid, None, None, "Primary group id")
1338 gid = property(getgid, None, None, "Primary group id")
1341
1339
1342 def getgroup(self):
1340 def getgroup(self):
1343 return igrpentry(self.gid)
1341 return igrpentry(self.gid)
1344 group = property(getgroup, None, None, "Group")
1342 group = property(getgroup, None, None, "Group")
1345
1343
1346 def getgecos(self):
1344 def getgecos(self):
1347 return self._getentry().pw_gecos
1345 return self._getentry().pw_gecos
1348 gecos = property(getgecos, None, None, "Information (e.g. full user name)")
1346 gecos = property(getgecos, None, None, "Information (e.g. full user name)")
1349
1347
1350 def getdir(self):
1348 def getdir(self):
1351 return self._getentry().pw_dir
1349 return self._getentry().pw_dir
1352 dir = property(getdir, None, None, "$HOME directory")
1350 dir = property(getdir, None, None, "$HOME directory")
1353
1351
1354 def getshell(self):
1352 def getshell(self):
1355 return self._getentry().pw_shell
1353 return self._getentry().pw_shell
1356 shell = property(getshell, None, None, "Login shell")
1354 shell = property(getshell, None, None, "Login shell")
1357
1355
1358 def __xattrs__(self, mode="default"):
1356 def __xattrs__(self, mode="default"):
1359 return ("name", "passwd", "uid", "gid", "gecos", "dir", "shell")
1357 return ("name", "passwd", "uid", "gid", "gecos", "dir", "shell")
1360
1358
1361 def __repr__(self):
1359 def __repr__(self):
1362 return "%s.%s(%r)" % \
1360 return "%s.%s(%r)" % \
1363 (self.__class__.__module__, self.__class__.__name__, self._id)
1361 (self.__class__.__module__, self.__class__.__name__, self._id)
1364
1362
1365
1363
1366 class ipwd(Table):
1364 class ipwd(Table):
1367 """
1365 """
1368 List all entries in the Unix user account and password database.
1366 List all entries in the Unix user account and password database.
1369
1367
1370 Example:
1368 Example:
1371
1369
1372 >>> ipwd | isort("uid")
1370 >>> ipwd | isort("uid")
1373 """
1371 """
1374 def __iter__(self):
1372 def __iter__(self):
1375 for entry in pwd.getpwall():
1373 for entry in pwd.getpwall():
1376 yield ipwdentry(entry.pw_name)
1374 yield ipwdentry(entry.pw_name)
1377
1375
1378 def __xrepr__(self, mode="default"):
1376 def __xrepr__(self, mode="default"):
1379 if mode == "header" or mode == "footer" or mode == "cell":
1377 if mode == "header" or mode == "footer" or mode == "cell":
1380 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1378 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1381 else:
1379 else:
1382 yield (astyle.style_default, repr(self))
1380 yield (astyle.style_default, repr(self))
1383
1381
1384
1382
1385 class igrpentry(object):
1383 class igrpentry(object):
1386 """
1384 """
1387 ``igrpentry`` objects encapsulate entries in the Unix group database.
1385 ``igrpentry`` objects encapsulate entries in the Unix group database.
1388 """
1386 """
1389 def __init__(self, id):
1387 def __init__(self, id):
1390 self._id = id
1388 self._id = id
1391 self._entry = None
1389 self._entry = None
1392
1390
1393 def __eq__(self, other):
1391 def __eq__(self, other):
1394 return self.__class__ is other.__class__ and self._id == other._id
1392 return self.__class__ is other.__class__ and self._id == other._id
1395
1393
1396 def __ne__(self, other):
1394 def __ne__(self, other):
1397 return self.__class__ is not other.__class__ or self._id != other._id
1395 return self.__class__ is not other.__class__ or self._id != other._id
1398
1396
1399 def _getentry(self):
1397 def _getentry(self):
1400 if self._entry is None:
1398 if self._entry is None:
1401 if isinstance(self._id, basestring):
1399 if isinstance(self._id, basestring):
1402 self._entry = grp.getgrnam(self._id)
1400 self._entry = grp.getgrnam(self._id)
1403 else:
1401 else:
1404 self._entry = grp.getgrgid(self._id)
1402 self._entry = grp.getgrgid(self._id)
1405 return self._entry
1403 return self._entry
1406
1404
1407 def getname(self):
1405 def getname(self):
1408 if isinstance(self._id, basestring):
1406 if isinstance(self._id, basestring):
1409 return self._id
1407 return self._id
1410 else:
1408 else:
1411 return self._getentry().gr_name
1409 return self._getentry().gr_name
1412 name = property(getname, None, None, "Group name")
1410 name = property(getname, None, None, "Group name")
1413
1411
1414 def getpasswd(self):
1412 def getpasswd(self):
1415 return self._getentry().gr_passwd
1413 return self._getentry().gr_passwd
1416 passwd = property(getpasswd, None, None, "Password")
1414 passwd = property(getpasswd, None, None, "Password")
1417
1415
1418 def getgid(self):
1416 def getgid(self):
1419 if isinstance(self._id, basestring):
1417 if isinstance(self._id, basestring):
1420 return self._getentry().gr_gid
1418 return self._getentry().gr_gid
1421 else:
1419 else:
1422 return self._id
1420 return self._id
1423 gid = property(getgid, None, None, "Group id")
1421 gid = property(getgid, None, None, "Group id")
1424
1422
1425 def getmem(self):
1423 def getmem(self):
1426 return self._getentry().gr_mem
1424 return self._getentry().gr_mem
1427 mem = property(getmem, None, None, "Members")
1425 mem = property(getmem, None, None, "Members")
1428
1426
1429 def __xattrs__(self, mode="default"):
1427 def __xattrs__(self, mode="default"):
1430 return ("name", "passwd", "gid", "mem")
1428 return ("name", "passwd", "gid", "mem")
1431
1429
1432 def __xrepr__(self, mode="default"):
1430 def __xrepr__(self, mode="default"):
1433 if mode == "header" or mode == "footer" or mode == "cell":
1431 if mode == "header" or mode == "footer" or mode == "cell":
1434 yield (astyle.style_default, "group ")
1432 yield (astyle.style_default, "group ")
1435 try:
1433 try:
1436 yield (astyle.style_default, self.name)
1434 yield (astyle.style_default, self.name)
1437 except KeyError:
1435 except KeyError:
1438 if isinstance(self._id, basestring):
1436 if isinstance(self._id, basestring):
1439 yield (astyle.style_default, self.name_id)
1437 yield (astyle.style_default, self.name_id)
1440 else:
1438 else:
1441 yield (astyle.style_type_number, str(self._id))
1439 yield (astyle.style_type_number, str(self._id))
1442 else:
1440 else:
1443 yield (astyle.style_default, repr(self))
1441 yield (astyle.style_default, repr(self))
1444
1442
1445 def __iter__(self):
1443 def __iter__(self):
1446 for member in self.mem:
1444 for member in self.mem:
1447 yield ipwdentry(member)
1445 yield ipwdentry(member)
1448
1446
1449 def __repr__(self):
1447 def __repr__(self):
1450 return "%s.%s(%r)" % \
1448 return "%s.%s(%r)" % \
1451 (self.__class__.__module__, self.__class__.__name__, self._id)
1449 (self.__class__.__module__, self.__class__.__name__, self._id)
1452
1450
1453
1451
1454 class igrp(Table):
1452 class igrp(Table):
1455 """
1453 """
1456 This ``Table`` lists all entries in the Unix group database.
1454 This ``Table`` lists all entries in the Unix group database.
1457 """
1455 """
1458 def __iter__(self):
1456 def __iter__(self):
1459 for entry in grp.getgrall():
1457 for entry in grp.getgrall():
1460 yield igrpentry(entry.gr_name)
1458 yield igrpentry(entry.gr_name)
1461
1459
1462 def __xrepr__(self, mode="default"):
1460 def __xrepr__(self, mode="default"):
1463 if mode == "header" or mode == "footer":
1461 if mode == "header" or mode == "footer":
1464 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1462 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1465 else:
1463 else:
1466 yield (astyle.style_default, repr(self))
1464 yield (astyle.style_default, repr(self))
1467
1465
1468
1466
1469 class Fields(object):
1467 class Fields(object):
1470 def __init__(self, fieldnames, **fields):
1468 def __init__(self, fieldnames, **fields):
1471 self.__fieldnames = [upgradexattr(fieldname) for fieldname in fieldnames]
1469 self.__fieldnames = [upgradexattr(fieldname) for fieldname in fieldnames]
1472 for (key, value) in fields.iteritems():
1470 for (key, value) in fields.iteritems():
1473 setattr(self, key, value)
1471 setattr(self, key, value)
1474
1472
1475 def __xattrs__(self, mode="default"):
1473 def __xattrs__(self, mode="default"):
1476 return self.__fieldnames
1474 return self.__fieldnames
1477
1475
1478 def __xrepr__(self, mode="default"):
1476 def __xrepr__(self, mode="default"):
1479 yield (-1, False)
1477 yield (-1, False)
1480 if mode == "header" or mode == "cell":
1478 if mode == "header" or mode == "cell":
1481 yield (astyle.style_default, self.__class__.__name__)
1479 yield (astyle.style_default, self.__class__.__name__)
1482 yield (astyle.style_default, "(")
1480 yield (astyle.style_default, "(")
1483 for (i, f) in enumerate(self.__fieldnames):
1481 for (i, f) in enumerate(self.__fieldnames):
1484 if i:
1482 if i:
1485 yield (astyle.style_default, ", ")
1483 yield (astyle.style_default, ", ")
1486 yield (astyle.style_default, f.name())
1484 yield (astyle.style_default, f.name())
1487 yield (astyle.style_default, "=")
1485 yield (astyle.style_default, "=")
1488 for part in xrepr(getattr(self, f), "default"):
1486 for part in xrepr(getattr(self, f), "default"):
1489 yield part
1487 yield part
1490 yield (astyle.style_default, ")")
1488 yield (astyle.style_default, ")")
1491 elif mode == "footer":
1489 elif mode == "footer":
1492 yield (astyle.style_default, self.__class__.__name__)
1490 yield (astyle.style_default, self.__class__.__name__)
1493 yield (astyle.style_default, "(")
1491 yield (astyle.style_default, "(")
1494 for (i, f) in enumerate(self.__fieldnames):
1492 for (i, f) in enumerate(self.__fieldnames):
1495 if i:
1493 if i:
1496 yield (astyle.style_default, ", ")
1494 yield (astyle.style_default, ", ")
1497 yield (astyle.style_default, f.name())
1495 yield (astyle.style_default, f.name())
1498 yield (astyle.style_default, ")")
1496 yield (astyle.style_default, ")")
1499 else:
1497 else:
1500 yield (astyle.style_default, repr(self))
1498 yield (astyle.style_default, repr(self))
1501
1499
1502
1500
1503 class FieldTable(Table, list):
1501 class FieldTable(Table, list):
1504 def __init__(self, *fields):
1502 def __init__(self, *fields):
1505 Table.__init__(self)
1503 Table.__init__(self)
1506 list.__init__(self)
1504 list.__init__(self)
1507 self.fields = fields
1505 self.fields = fields
1508
1506
1509 def add(self, **fields):
1507 def add(self, **fields):
1510 self.append(Fields(self.fields, **fields))
1508 self.append(Fields(self.fields, **fields))
1511
1509
1512 def __xrepr__(self, mode="default"):
1510 def __xrepr__(self, mode="default"):
1513 yield (-1, False)
1511 yield (-1, False)
1514 if mode == "header" or mode == "footer":
1512 if mode == "header" or mode == "footer":
1515 yield (astyle.style_default, self.__class__.__name__)
1513 yield (astyle.style_default, self.__class__.__name__)
1516 yield (astyle.style_default, "(")
1514 yield (astyle.style_default, "(")
1517 for (i, f) in enumerate(self.__fieldnames):
1515 for (i, f) in enumerate(self.__fieldnames):
1518 if i:
1516 if i:
1519 yield (astyle.style_default, ", ")
1517 yield (astyle.style_default, ", ")
1520 yield (astyle.style_default, f)
1518 yield (astyle.style_default, f)
1521 yield (astyle.style_default, ")")
1519 yield (astyle.style_default, ")")
1522 else:
1520 else:
1523 yield (astyle.style_default, repr(self))
1521 yield (astyle.style_default, repr(self))
1524
1522
1525 def __repr__(self):
1523 def __repr__(self):
1526 return "<%s.%s object with fields=%r at 0x%x>" % \
1524 return "<%s.%s object with fields=%r at 0x%x>" % \
1527 (self.__class__.__module__, self.__class__.__name__,
1525 (self.__class__.__module__, self.__class__.__name__,
1528 ", ".join(map(repr, self.fields)), id(self))
1526 ", ".join(map(repr, self.fields)), id(self))
1529
1527
1530
1528
1531 class List(list):
1529 class List(list):
1532 def __xattrs__(self, mode="default"):
1530 def __xattrs__(self, mode="default"):
1533 return xrange(len(self))
1531 return xrange(len(self))
1534
1532
1535 def __xrepr__(self, mode="default"):
1533 def __xrepr__(self, mode="default"):
1536 yield (-1, False)
1534 yield (-1, False)
1537 if mode == "header" or mode == "cell" or mode == "footer" or mode == "default":
1535 if mode == "header" or mode == "cell" or mode == "footer" or mode == "default":
1538 yield (astyle.style_default, self.__class__.__name__)
1536 yield (astyle.style_default, self.__class__.__name__)
1539 yield (astyle.style_default, "(")
1537 yield (astyle.style_default, "(")
1540 for (i, item) in enumerate(self):
1538 for (i, item) in enumerate(self):
1541 if i:
1539 if i:
1542 yield (astyle.style_default, ", ")
1540 yield (astyle.style_default, ", ")
1543 for part in xrepr(item, "default"):
1541 for part in xrepr(item, "default"):
1544 yield part
1542 yield part
1545 yield (astyle.style_default, ")")
1543 yield (astyle.style_default, ")")
1546 else:
1544 else:
1547 yield (astyle.style_default, repr(self))
1545 yield (astyle.style_default, repr(self))
1548
1546
1549
1547
1550 class ienv(Table):
1548 class ienv(Table):
1551 """
1549 """
1552 List environment variables.
1550 List environment variables.
1553
1551
1554 Example:
1552 Example:
1555
1553
1556 >>> ienv
1554 >>> ienv
1557 """
1555 """
1558
1556
1559 def __iter__(self):
1557 def __iter__(self):
1560 fields = ("key", "value")
1558 fields = ("key", "value")
1561 for (key, value) in os.environ.iteritems():
1559 for (key, value) in os.environ.iteritems():
1562 yield Fields(fields, key=key, value=value)
1560 yield Fields(fields, key=key, value=value)
1563
1561
1564 def __xrepr__(self, mode="default"):
1562 def __xrepr__(self, mode="default"):
1565 if mode == "header" or mode == "cell":
1563 if mode == "header" or mode == "cell":
1566 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1564 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1567 else:
1565 else:
1568 yield (astyle.style_default, repr(self))
1566 yield (astyle.style_default, repr(self))
1569
1567
1570
1568
1571 class ihist(Table):
1569 class ihist(Table):
1572 """
1570 """
1573 IPython input history
1571 IPython input history
1574
1572
1575 Example:
1573 Example:
1576
1574
1577 >>> ihist
1575 >>> ihist
1578 >>> ihist(True) (raw mode)
1576 >>> ihist(True) (raw mode)
1579 """
1577 """
1580 def __init__(self, raw=True):
1578 def __init__(self, raw=True):
1581 self.raw = raw
1579 self.raw = raw
1582
1580
1583 def __iter__(self):
1581 def __iter__(self):
1584 api = ipapi.get()
1582 api = ipapi.get()
1585 if self.raw:
1583 if self.raw:
1586 for line in api.IP.input_hist_raw:
1584 for line in api.IP.input_hist_raw:
1587 yield line.rstrip("\n")
1585 yield line.rstrip("\n")
1588 else:
1586 else:
1589 for line in api.IP.input_hist:
1587 for line in api.IP.input_hist:
1590 yield line.rstrip("\n")
1588 yield line.rstrip("\n")
1591
1589
1592
1590
1593 class icsv(Pipe):
1591 class icsv(Pipe):
1594 """
1592 """
1595 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
1593 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
1596 or an ``ifile``) into lines of CVS columns.
1594 or an ``ifile``) into lines of CVS columns.
1597 """
1595 """
1598 def __init__(self, **csvargs):
1596 def __init__(self, **csvargs):
1599 """
1597 """
1600 Create an ``icsv`` object. ``cvsargs`` will be passed through as
1598 Create an ``icsv`` object. ``cvsargs`` will be passed through as
1601 keyword arguments to ``cvs.reader()``.
1599 keyword arguments to ``cvs.reader()``.
1602 """
1600 """
1603 self.csvargs = csvargs
1601 self.csvargs = csvargs
1604
1602
1605 def __iter__(self):
1603 def __iter__(self):
1606 input = self.input
1604 input = self.input
1607 if isinstance(input, ifile):
1605 if isinstance(input, ifile):
1608 input = input.open("rb")
1606 input = input.open("rb")
1609 reader = csv.reader(input, **self.csvargs)
1607 reader = csv.reader(input, **self.csvargs)
1610 for line in reader:
1608 for line in reader:
1611 yield List(line)
1609 yield List(line)
1612
1610
1613 def __xrepr__(self, mode="default"):
1611 def __xrepr__(self, mode="default"):
1614 yield (-1, False)
1612 yield (-1, False)
1615 if mode == "header" or mode == "footer":
1613 if mode == "header" or mode == "footer":
1616 input = getattr(self, "input", None)
1614 input = getattr(self, "input", None)
1617 if input is not None:
1615 if input is not None:
1618 for part in xrepr(input, mode):
1616 for part in xrepr(input, mode):
1619 yield part
1617 yield part
1620 yield (astyle.style_default, " | ")
1618 yield (astyle.style_default, " | ")
1621 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1619 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1622 for (i, (name, value)) in enumerate(self.csvargs.iteritems()):
1620 for (i, (name, value)) in enumerate(self.csvargs.iteritems()):
1623 if i:
1621 if i:
1624 yield (astyle.style_default, ", ")
1622 yield (astyle.style_default, ", ")
1625 yield (astyle.style_default, name)
1623 yield (astyle.style_default, name)
1626 yield (astyle.style_default, "=")
1624 yield (astyle.style_default, "=")
1627 for part in xrepr(value, "default"):
1625 for part in xrepr(value, "default"):
1628 yield part
1626 yield part
1629 yield (astyle.style_default, ")")
1627 yield (astyle.style_default, ")")
1630 else:
1628 else:
1631 yield (astyle.style_default, repr(self))
1629 yield (astyle.style_default, repr(self))
1632
1630
1633 def __repr__(self):
1631 def __repr__(self):
1634 args = ", ".join(["%s=%r" % item for item in self.csvargs.iteritems()])
1632 args = ", ".join(["%s=%r" % item for item in self.csvargs.iteritems()])
1635 return "<%s.%s %s at 0x%x>" % \
1633 return "<%s.%s %s at 0x%x>" % \
1636 (self.__class__.__module__, self.__class__.__name__, args, id(self))
1634 (self.__class__.__module__, self.__class__.__name__, args, id(self))
1637
1635
1638
1636
1639 class ix(Table):
1637 class ix(Table):
1640 """
1638 """
1641 Execute a system command and list its output as lines
1639 Execute a system command and list its output as lines
1642 (similar to ``os.popen()``).
1640 (similar to ``os.popen()``).
1643
1641
1644 Examples:
1642 Examples:
1645
1643
1646 >>> ix("ps x")
1644 >>> ix("ps x")
1647 >>> ix("find .") | ifile
1645 >>> ix("find .") | ifile
1648 """
1646 """
1649 def __init__(self, cmd):
1647 def __init__(self, cmd):
1650 self.cmd = cmd
1648 self.cmd = cmd
1651 self._pipeout = None
1649 self._pipeout = None
1652
1650
1653 def __iter__(self):
1651 def __iter__(self):
1654 (_pipein, self._pipeout) = os.popen4(self.cmd)
1652 (_pipein, self._pipeout) = os.popen4(self.cmd)
1655 _pipein.close()
1653 _pipein.close()
1656 for l in self._pipeout:
1654 for l in self._pipeout:
1657 yield l.rstrip("\r\n")
1655 yield l.rstrip("\r\n")
1658 self._pipeout.close()
1656 self._pipeout.close()
1659 self._pipeout = None
1657 self._pipeout = None
1660
1658
1661 def __del__(self):
1659 def __del__(self):
1662 if self._pipeout is not None and not self._pipeout.closed:
1660 if self._pipeout is not None and not self._pipeout.closed:
1663 self._pipeout.close()
1661 self._pipeout.close()
1664 self._pipeout = None
1662 self._pipeout = None
1665
1663
1666 def __xrepr__(self, mode="default"):
1664 def __xrepr__(self, mode="default"):
1667 if mode == "header" or mode == "footer":
1665 if mode == "header" or mode == "footer":
1668 yield (astyle.style_default,
1666 yield (astyle.style_default,
1669 "%s(%r)" % (self.__class__.__name__, self.cmd))
1667 "%s(%r)" % (self.__class__.__name__, self.cmd))
1670 else:
1668 else:
1671 yield (astyle.style_default, repr(self))
1669 yield (astyle.style_default, repr(self))
1672
1670
1673 def __repr__(self):
1671 def __repr__(self):
1674 return "%s.%s(%r)" % \
1672 return "%s.%s(%r)" % \
1675 (self.__class__.__module__, self.__class__.__name__, self.cmd)
1673 (self.__class__.__module__, self.__class__.__name__, self.cmd)
1676
1674
1677
1675
1678 class ifilter(Pipe):
1676 class ifilter(Pipe):
1679 """
1677 """
1680 Filter an input pipe. Only objects where an expression evaluates to true
1678 Filter an input pipe. Only objects where an expression evaluates to true
1681 (and doesn't raise an exception) are listed.
1679 (and doesn't raise an exception) are listed.
1682
1680
1683 Examples:
1681 Examples:
1684
1682
1685 >>> ils | ifilter("_.isfile() and size>1000")
1683 >>> ils | ifilter("_.isfile() and size>1000")
1686 >>> igrp | ifilter("len(mem)")
1684 >>> igrp | ifilter("len(mem)")
1687 >>> sys.modules | ifilter(lambda _:_.value is not None)
1685 >>> sys.modules | ifilter(lambda _:_.value is not None)
1688 """
1686 """
1689
1687
1690 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1688 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1691 """
1689 """
1692 Create an ``ifilter`` object. ``expr`` can be a callable or a string
1690 Create an ``ifilter`` object. ``expr`` can be a callable or a string
1693 containing an expression. ``globals`` will be used as the global
1691 containing an expression. ``globals`` will be used as the global
1694 namespace for calling string expressions (defaulting to IPython's
1692 namespace for calling string expressions (defaulting to IPython's
1695 user namespace). ``errors`` specifies how exception during evaluation
1693 user namespace). ``errors`` specifies how exception during evaluation
1696 of ``expr`` are handled:
1694 of ``expr`` are handled:
1697
1695
1698 * ``drop``: drop all items that have errors;
1696 * ``drop``: drop all items that have errors;
1699
1697
1700 * ``keep``: keep all items that have errors;
1698 * ``keep``: keep all items that have errors;
1701
1699
1702 * ``keeperror``: keep the exception of all items that have errors;
1700 * ``keeperror``: keep the exception of all items that have errors;
1703
1701
1704 * ``raise``: raise the exception;
1702 * ``raise``: raise the exception;
1705
1703
1706 * ``raiseifallfail``: raise the first exception if all items have errors;
1704 * ``raiseifallfail``: raise the first exception if all items have errors;
1707 otherwise drop those with errors (this is the default).
1705 otherwise drop those with errors (this is the default).
1708 """
1706 """
1709 self.expr = expr
1707 self.expr = expr
1710 self.globals = globals
1708 self.globals = globals
1711 self.errors = errors
1709 self.errors = errors
1712
1710
1713 def __iter__(self):
1711 def __iter__(self):
1714 if callable(self.expr):
1712 if callable(self.expr):
1715 test = self.expr
1713 test = self.expr
1716 else:
1714 else:
1717 g = getglobals(self.globals)
1715 g = getglobals(self.globals)
1718 expr = compile(self.expr, "ipipe-expression", "eval")
1716 expr = compile(self.expr, "ipipe-expression", "eval")
1719 def test(item):
1717 def test(item):
1720 return eval(expr, g, AttrNamespace(item))
1718 return eval(expr, g, AttrNamespace(item))
1721
1719
1722 ok = 0
1720 ok = 0
1723 exc_info = None
1721 exc_info = None
1724 for item in xiter(self.input):
1722 for item in xiter(self.input):
1725 try:
1723 try:
1726 if test(item):
1724 if test(item):
1727 yield item
1725 yield item
1728 ok += 1
1726 ok += 1
1729 except (KeyboardInterrupt, SystemExit):
1727 except (KeyboardInterrupt, SystemExit):
1730 raise
1728 raise
1731 except Exception, exc:
1729 except Exception, exc:
1732 if self.errors == "drop":
1730 if self.errors == "drop":
1733 pass # Ignore errors
1731 pass # Ignore errors
1734 elif self.errors == "keep":
1732 elif self.errors == "keep":
1735 yield item
1733 yield item
1736 elif self.errors == "keeperror":
1734 elif self.errors == "keeperror":
1737 yield exc
1735 yield exc
1738 elif self.errors == "raise":
1736 elif self.errors == "raise":
1739 raise
1737 raise
1740 elif self.errors == "raiseifallfail":
1738 elif self.errors == "raiseifallfail":
1741 if exc_info is None:
1739 if exc_info is None:
1742 exc_info = sys.exc_info()
1740 exc_info = sys.exc_info()
1743 if not ok and exc_info is not None:
1741 if not ok and exc_info is not None:
1744 raise exc_info[0], exc_info[1], exc_info[2]
1742 raise exc_info[0], exc_info[1], exc_info[2]
1745
1743
1746 def __xrepr__(self, mode="default"):
1744 def __xrepr__(self, mode="default"):
1747 if mode == "header" or mode == "footer":
1745 if mode == "header" or mode == "footer":
1748 input = getattr(self, "input", None)
1746 input = getattr(self, "input", None)
1749 if input is not None:
1747 if input is not None:
1750 for part in xrepr(input, mode):
1748 for part in xrepr(input, mode):
1751 yield part
1749 yield part
1752 yield (astyle.style_default, " | ")
1750 yield (astyle.style_default, " | ")
1753 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1751 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1754 for part in xrepr(self.expr, "default"):
1752 for part in xrepr(self.expr, "default"):
1755 yield part
1753 yield part
1756 yield (astyle.style_default, ")")
1754 yield (astyle.style_default, ")")
1757 else:
1755 else:
1758 yield (astyle.style_default, repr(self))
1756 yield (astyle.style_default, repr(self))
1759
1757
1760 def __repr__(self):
1758 def __repr__(self):
1761 return "<%s.%s expr=%r at 0x%x>" % \
1759 return "<%s.%s expr=%r at 0x%x>" % \
1762 (self.__class__.__module__, self.__class__.__name__,
1760 (self.__class__.__module__, self.__class__.__name__,
1763 self.expr, id(self))
1761 self.expr, id(self))
1764
1762
1765
1763
1766 class ieval(Pipe):
1764 class ieval(Pipe):
1767 """
1765 """
1768 Evaluate an expression for each object in the input pipe.
1766 Evaluate an expression for each object in the input pipe.
1769
1767
1770 Examples:
1768 Examples:
1771
1769
1772 >>> ils | ieval("_.abspath()")
1770 >>> ils | ieval("_.abspath()")
1773 >>> sys.path | ieval(ifile)
1771 >>> sys.path | ieval(ifile)
1774 """
1772 """
1775
1773
1776 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1774 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1777 """
1775 """
1778 Create an ``ieval`` object. ``expr`` can be a callable or a string
1776 Create an ``ieval`` object. ``expr`` can be a callable or a string
1779 containing an expression. For the meaning of ``globals`` and
1777 containing an expression. For the meaning of ``globals`` and
1780 ``errors`` see ``ifilter``.
1778 ``errors`` see ``ifilter``.
1781 """
1779 """
1782 self.expr = expr
1780 self.expr = expr
1783 self.globals = globals
1781 self.globals = globals
1784 self.errors = errors
1782 self.errors = errors
1785
1783
1786 def __iter__(self):
1784 def __iter__(self):
1787 if callable(self.expr):
1785 if callable(self.expr):
1788 do = self.expr
1786 do = self.expr
1789 else:
1787 else:
1790 g = getglobals(self.globals)
1788 g = getglobals(self.globals)
1791 expr = compile(self.expr, "ipipe-expression", "eval")
1789 expr = compile(self.expr, "ipipe-expression", "eval")
1792 def do(item):
1790 def do(item):
1793 return eval(expr, g, AttrNamespace(item))
1791 return eval(expr, g, AttrNamespace(item))
1794
1792
1795 ok = 0
1793 ok = 0
1796 exc_info = None
1794 exc_info = None
1797 for item in xiter(self.input):
1795 for item in xiter(self.input):
1798 try:
1796 try:
1799 yield do(item)
1797 yield do(item)
1800 except (KeyboardInterrupt, SystemExit):
1798 except (KeyboardInterrupt, SystemExit):
1801 raise
1799 raise
1802 except Exception, exc:
1800 except Exception, exc:
1803 if self.errors == "drop":
1801 if self.errors == "drop":
1804 pass # Ignore errors
1802 pass # Ignore errors
1805 elif self.errors == "keep":
1803 elif self.errors == "keep":
1806 yield item
1804 yield item
1807 elif self.errors == "keeperror":
1805 elif self.errors == "keeperror":
1808 yield exc
1806 yield exc
1809 elif self.errors == "raise":
1807 elif self.errors == "raise":
1810 raise
1808 raise
1811 elif self.errors == "raiseifallfail":
1809 elif self.errors == "raiseifallfail":
1812 if exc_info is None:
1810 if exc_info is None:
1813 exc_info = sys.exc_info()
1811 exc_info = sys.exc_info()
1814 if not ok and exc_info is not None:
1812 if not ok and exc_info is not None:
1815 raise exc_info[0], exc_info[1], exc_info[2]
1813 raise exc_info[0], exc_info[1], exc_info[2]
1816
1814
1817 def __xrepr__(self, mode="default"):
1815 def __xrepr__(self, mode="default"):
1818 if mode == "header" or mode == "footer":
1816 if mode == "header" or mode == "footer":
1819 input = getattr(self, "input", None)
1817 input = getattr(self, "input", None)
1820 if input is not None:
1818 if input is not None:
1821 for part in xrepr(input, mode):
1819 for part in xrepr(input, mode):
1822 yield part
1820 yield part
1823 yield (astyle.style_default, " | ")
1821 yield (astyle.style_default, " | ")
1824 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1822 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1825 for part in xrepr(self.expr, "default"):
1823 for part in xrepr(self.expr, "default"):
1826 yield part
1824 yield part
1827 yield (astyle.style_default, ")")
1825 yield (astyle.style_default, ")")
1828 else:
1826 else:
1829 yield (astyle.style_default, repr(self))
1827 yield (astyle.style_default, repr(self))
1830
1828
1831 def __repr__(self):
1829 def __repr__(self):
1832 return "<%s.%s expr=%r at 0x%x>" % \
1830 return "<%s.%s expr=%r at 0x%x>" % \
1833 (self.__class__.__module__, self.__class__.__name__,
1831 (self.__class__.__module__, self.__class__.__name__,
1834 self.expr, id(self))
1832 self.expr, id(self))
1835
1833
1836
1834
1837 class ienum(Pipe):
1835 class ienum(Pipe):
1838 """
1836 """
1839 Enumerate the input pipe (i.e. wrap each input object in an object
1837 Enumerate the input pipe (i.e. wrap each input object in an object
1840 with ``index`` and ``object`` attributes).
1838 with ``index`` and ``object`` attributes).
1841
1839
1842 Examples:
1840 Examples:
1843
1841
1844 >>> xrange(20) | ieval("_,_*_") | ienum | ifilter("index % 2 == 0") | ieval("object")
1842 >>> xrange(20) | ieval("_,_*_") | ienum | ifilter("index % 2 == 0") | ieval("object")
1845 """
1843 """
1846 def __iter__(self):
1844 def __iter__(self):
1847 fields = ("index", "object")
1845 fields = ("index", "object")
1848 for (index, object) in enumerate(xiter(self.input)):
1846 for (index, object) in enumerate(xiter(self.input)):
1849 yield Fields(fields, index=index, object=object)
1847 yield Fields(fields, index=index, object=object)
1850
1848
1851
1849
1852 class isort(Pipe):
1850 class isort(Pipe):
1853 """
1851 """
1854 Sorts the input pipe.
1852 Sorts the input pipe.
1855
1853
1856 Examples:
1854 Examples:
1857
1855
1858 >>> ils | isort("size")
1856 >>> ils | isort("size")
1859 >>> ils | isort("_.isdir(), _.lower()", reverse=True)
1857 >>> ils | isort("_.isdir(), _.lower()", reverse=True)
1860 """
1858 """
1861
1859
1862 def __init__(self, key=None, globals=None, reverse=False):
1860 def __init__(self, key=None, globals=None, reverse=False):
1863 """
1861 """
1864 Create an ``isort`` object. ``key`` can be a callable or a string
1862 Create an ``isort`` object. ``key`` can be a callable or a string
1865 containing an expression (or ``None`` in which case the items
1863 containing an expression (or ``None`` in which case the items
1866 themselves will be sorted). If ``reverse`` is true the sort order
1864 themselves will be sorted). If ``reverse`` is true the sort order
1867 will be reversed. For the meaning of ``globals`` see ``ifilter``.
1865 will be reversed. For the meaning of ``globals`` see ``ifilter``.
1868 """
1866 """
1869 self.key = key
1867 self.key = key
1870 self.globals = globals
1868 self.globals = globals
1871 self.reverse = reverse
1869 self.reverse = reverse
1872
1870
1873 def __iter__(self):
1871 def __iter__(self):
1874 if self.key is None:
1872 if self.key is None:
1875 items = sorted(xiter(self.input), reverse=self.reverse)
1873 items = sorted(xiter(self.input), reverse=self.reverse)
1876 elif callable(self.key):
1874 elif callable(self.key):
1877 items = sorted(xiter(self.input), key=self.key, reverse=self.reverse)
1875 items = sorted(xiter(self.input), key=self.key, reverse=self.reverse)
1878 else:
1876 else:
1879 g = getglobals(self.globals)
1877 g = getglobals(self.globals)
1880 key = compile(self.key, "ipipe-expression", "eval")
1878 key = compile(self.key, "ipipe-expression", "eval")
1881 def realkey(item):
1879 def realkey(item):
1882 return eval(key, g, AttrNamespace(item))
1880 return eval(key, g, AttrNamespace(item))
1883 items = sorted(xiter(self.input), key=realkey, reverse=self.reverse)
1881 items = sorted(xiter(self.input), key=realkey, reverse=self.reverse)
1884 for item in items:
1882 for item in items:
1885 yield item
1883 yield item
1886
1884
1887 def __xrepr__(self, mode="default"):
1885 def __xrepr__(self, mode="default"):
1888 if mode == "header" or mode == "footer":
1886 if mode == "header" or mode == "footer":
1889 input = getattr(self, "input", None)
1887 input = getattr(self, "input", None)
1890 if input is not None:
1888 if input is not None:
1891 for part in xrepr(input, mode):
1889 for part in xrepr(input, mode):
1892 yield part
1890 yield part
1893 yield (astyle.style_default, " | ")
1891 yield (astyle.style_default, " | ")
1894 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1892 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1895 for part in xrepr(self.key, "default"):
1893 for part in xrepr(self.key, "default"):
1896 yield part
1894 yield part
1897 if self.reverse:
1895 if self.reverse:
1898 yield (astyle.style_default, ", ")
1896 yield (astyle.style_default, ", ")
1899 for part in xrepr(True, "default"):
1897 for part in xrepr(True, "default"):
1900 yield part
1898 yield part
1901 yield (astyle.style_default, ")")
1899 yield (astyle.style_default, ")")
1902 else:
1900 else:
1903 yield (astyle.style_default, repr(self))
1901 yield (astyle.style_default, repr(self))
1904
1902
1905 def __repr__(self):
1903 def __repr__(self):
1906 return "<%s.%s key=%r reverse=%r at 0x%x>" % \
1904 return "<%s.%s key=%r reverse=%r at 0x%x>" % \
1907 (self.__class__.__module__, self.__class__.__name__,
1905 (self.__class__.__module__, self.__class__.__name__,
1908 self.key, self.reverse, id(self))
1906 self.key, self.reverse, id(self))
1909
1907
1910
1908
1911 tab = 3 # for expandtabs()
1909 tab = 3 # for expandtabs()
1912
1910
1913 def _format(field):
1911 def _format(field):
1914 if isinstance(field, str):
1912 if isinstance(field, str):
1915 text = repr(field.expandtabs(tab))[1:-1]
1913 text = repr(field.expandtabs(tab))[1:-1]
1916 elif isinstance(field, unicode):
1914 elif isinstance(field, unicode):
1917 text = repr(field.expandtabs(tab))[2:-1]
1915 text = repr(field.expandtabs(tab))[2:-1]
1918 elif isinstance(field, datetime.datetime):
1916 elif isinstance(field, datetime.datetime):
1919 # Don't use strftime() here, as this requires year >= 1900
1917 # Don't use strftime() here, as this requires year >= 1900
1920 text = "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
1918 text = "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
1921 (field.year, field.month, field.day,
1919 (field.year, field.month, field.day,
1922 field.hour, field.minute, field.second, field.microsecond)
1920 field.hour, field.minute, field.second, field.microsecond)
1923 elif isinstance(field, datetime.date):
1921 elif isinstance(field, datetime.date):
1924 text = "%04d-%02d-%02d" % (field.year, field.month, field.day)
1922 text = "%04d-%02d-%02d" % (field.year, field.month, field.day)
1925 else:
1923 else:
1926 text = repr(field)
1924 text = repr(field)
1927 return text
1925 return text
1928
1926
1929
1927
1930 class Display(object):
1928 class Display(object):
1931 class __metaclass__(type):
1929 class __metaclass__(type):
1932 def __ror__(self, input):
1930 def __ror__(self, input):
1933 return input | self()
1931 return input | self()
1934
1932
1933 def __init__(self, input=None):
1934 self.input = input
1935
1935 def __ror__(self, input):
1936 def __ror__(self, input):
1936 self.input = input
1937 self.input = input
1937 return self
1938 return self
1938
1939
1939 def display(self):
1940 def display(self):
1940 pass
1941 pass
1941
1942
1942
1943
1943 class iless(Display):
1944 class iless(Display):
1944 cmd = "less --quit-if-one-screen --LONG-PROMPT --LINE-NUMBERS --chop-long-lines --shift=8 --RAW-CONTROL-CHARS"
1945 cmd = "less --quit-if-one-screen --LONG-PROMPT --LINE-NUMBERS --chop-long-lines --shift=8 --RAW-CONTROL-CHARS"
1945
1946
1946 def display(self):
1947 def display(self):
1947 try:
1948 try:
1948 pager = os.popen(self.cmd, "w")
1949 pager = os.popen(self.cmd, "w")
1949 try:
1950 try:
1950 for item in xiter(self.input):
1951 for item in xiter(self.input):
1951 first = False
1952 first = False
1952 for attr in xattrs(item, "default"):
1953 for attr in xattrs(item, "default"):
1953 if first:
1954 if first:
1954 first = False
1955 first = False
1955 else:
1956 else:
1956 pager.write(" ")
1957 pager.write(" ")
1957 attr = upgradexattr(attr)
1958 attr = upgradexattr(attr)
1958 if not isinstance(attr, SelfDescriptor):
1959 if not isinstance(attr, SelfDescriptor):
1959 pager.write(attr.name())
1960 pager.write(attr.name())
1960 pager.write("=")
1961 pager.write("=")
1961 pager.write(str(attr.value(item)))
1962 pager.write(str(attr.value(item)))
1962 pager.write("\n")
1963 pager.write("\n")
1963 finally:
1964 finally:
1964 pager.close()
1965 pager.close()
1965 except Exception, exc:
1966 except Exception, exc:
1966 print "%s: %s" % (exc.__class__.__name__, str(exc))
1967 print "%s: %s" % (exc.__class__.__name__, str(exc))
1967
1968
1968
1969
1969 class _RedirectIO(object):
1970 class _RedirectIO(object):
1970 def __init__(self,*args,**kwargs):
1971 def __init__(self,*args,**kwargs):
1971 """
1972 """
1972 Map the system output streams to self.
1973 Map the system output streams to self.
1973 """
1974 """
1974 self.stream = StringIO.StringIO()
1975 self.stream = StringIO.StringIO()
1975 self.stdout = sys.stdout
1976 self.stdout = sys.stdout
1976 sys.stdout = self
1977 sys.stdout = self
1977 self.stderr = sys.stderr
1978 self.stderr = sys.stderr
1978 sys.stderr = self
1979 sys.stderr = self
1979
1980
1980 def write(self, text):
1981 def write(self, text):
1981 """
1982 """
1982 Write both to screen and to self.
1983 Write both to screen and to self.
1983 """
1984 """
1984 self.stream.write(text)
1985 self.stream.write(text)
1985 self.stdout.write(text)
1986 self.stdout.write(text)
1986 if "\n" in text:
1987 if "\n" in text:
1987 self.stdout.flush()
1988 self.stdout.flush()
1988
1989
1989 def writelines(self, lines):
1990 def writelines(self, lines):
1990 """
1991 """
1991 Write lines both to screen and to self.
1992 Write lines both to screen and to self.
1992 """
1993 """
1993 self.stream.writelines(lines)
1994 self.stream.writelines(lines)
1994 self.stdout.writelines(lines)
1995 self.stdout.writelines(lines)
1995 self.stdout.flush()
1996 self.stdout.flush()
1996
1997
1997 def restore(self):
1998 def restore(self):
1998 """
1999 """
1999 Restore the default system streams.
2000 Restore the default system streams.
2000 """
2001 """
2001 self.stdout.flush()
2002 self.stdout.flush()
2002 self.stderr.flush()
2003 self.stderr.flush()
2003 sys.stdout = self.stdout
2004 sys.stdout = self.stdout
2004 sys.stderr = self.stderr
2005 sys.stderr = self.stderr
2005
2006
2006
2007
2007 class icap(Table):
2008 class icap(Table):
2008 """
2009 """
2009 Execute a python string and capture any output to stderr/stdout.
2010 Execute a python string and capture any output to stderr/stdout.
2010
2011
2011 Examples:
2012 Examples:
2012
2013
2013 >>> import time
2014 >>> import time
2014 >>> icap("for i in range(10): print i, time.sleep(0.1)")
2015 >>> icap("for i in range(10): print i, time.sleep(0.1)")
2015
2016
2016 """
2017 """
2017 def __init__(self, expr, globals=None):
2018 def __init__(self, expr, globals=None):
2018 self.expr = expr
2019 self.expr = expr
2019 self.globals = globals
2020 self.globals = globals
2020 log = _RedirectIO()
2021 log = _RedirectIO()
2021 try:
2022 try:
2022 exec(expr, getglobals(globals))
2023 exec(expr, getglobals(globals))
2023 finally:
2024 finally:
2024 log.restore()
2025 log.restore()
2025 self.stream = log.stream
2026 self.stream = log.stream
2026
2027
2027 def __iter__(self):
2028 def __iter__(self):
2028 self.stream.seek(0)
2029 self.stream.seek(0)
2029 for line in self.stream:
2030 for line in self.stream:
2030 yield line.rstrip("\r\n")
2031 yield line.rstrip("\r\n")
2031
2032
2032 def __xrepr__(self, mode="default"):
2033 def __xrepr__(self, mode="default"):
2033 if mode == "header" or mode == "footer":
2034 if mode == "header" or mode == "footer":
2034 yield (astyle.style_default,
2035 yield (astyle.style_default,
2035 "%s(%r)" % (self.__class__.__name__, self.expr))
2036 "%s(%r)" % (self.__class__.__name__, self.expr))
2036 else:
2037 else:
2037 yield (astyle.style_default, repr(self))
2038 yield (astyle.style_default, repr(self))
2038
2039
2039 def __repr__(self):
2040 def __repr__(self):
2040 return "%s.%s(%r)" % \
2041 return "%s.%s(%r)" % \
2041 (self.__class__.__module__, self.__class__.__name__, self.expr)
2042 (self.__class__.__module__, self.__class__.__name__, self.expr)
2042
2043
2043
2044
2044 def xformat(value, mode, maxlength):
2045 def xformat(value, mode, maxlength):
2045 align = None
2046 align = None
2046 full = True
2047 full = True
2047 width = 0
2048 width = 0
2048 text = astyle.Text()
2049 text = astyle.Text()
2049 for (style, part) in xrepr(value, mode):
2050 for (style, part) in xrepr(value, mode):
2050 # only consider the first result
2051 # only consider the first result
2051 if align is None:
2052 if align is None:
2052 if isinstance(style, int):
2053 if isinstance(style, int):
2053 # (style, text) really is (alignment, stop)
2054 # (style, text) really is (alignment, stop)
2054 align = style
2055 align = style
2055 full = part
2056 full = part
2056 continue
2057 continue
2057 else:
2058 else:
2058 align = -1
2059 align = -1
2059 full = True
2060 full = True
2060 if not isinstance(style, int):
2061 if not isinstance(style, int):
2061 text.append((style, part))
2062 text.append((style, part))
2062 width += len(part)
2063 width += len(part)
2063 if width >= maxlength and not full:
2064 if width >= maxlength and not full:
2064 text.append((astyle.style_ellisis, "..."))
2065 text.append((astyle.style_ellisis, "..."))
2065 width += 3
2066 width += 3
2066 break
2067 break
2067 if align is None: # default to left alignment
2068 if align is None: # default to left alignment
2068 align = -1
2069 align = -1
2069 return (align, width, text)
2070 return (align, width, text)
2070
2071
2071
2072
2073
2074 import astyle
2075
2072 class idump(Display):
2076 class idump(Display):
2073 # The approximate maximum length of a column entry
2077 # The approximate maximum length of a column entry
2074 maxattrlength = 200
2078 maxattrlength = 200
2075
2079
2076 # Style for column names
2080 # Style for column names
2077 style_header = astyle.Style.fromstr("white:black:bold")
2081 style_header = astyle.Style.fromstr("white:black:bold")
2078
2082
2079 def __init__(self, *attrs):
2083 def __init__(self, input=None, *attrs):
2084 Display.__init__(self, input)
2080 self.attrs = [upgradexattr(attr) for attr in attrs]
2085 self.attrs = [upgradexattr(attr) for attr in attrs]
2081 self.headerpadchar = " "
2086 self.headerpadchar = " "
2082 self.headersepchar = "|"
2087 self.headersepchar = "|"
2083 self.datapadchar = " "
2088 self.datapadchar = " "
2084 self.datasepchar = "|"
2089 self.datasepchar = "|"
2085
2090
2086 def display(self):
2091 def display(self):
2087 stream = genutils.Term.cout
2092 stream = genutils.Term.cout
2088 allattrs = []
2093 allattrs = []
2089 attrset = set()
2094 attrset = set()
2090 colwidths = {}
2095 colwidths = {}
2091 rows = []
2096 rows = []
2092 for item in xiter(self.input):
2097 for item in xiter(self.input):
2093 row = {}
2098 row = {}
2094 attrs = self.attrs
2099 attrs = self.attrs
2095 if not attrs:
2100 if not attrs:
2096 attrs = xattrs(item, "default")
2101 attrs = xattrs(item, "default")
2097 for attr in attrs:
2102 for attr in attrs:
2098 if attr not in attrset:
2103 if attr not in attrset:
2099 allattrs.append(attr)
2104 allattrs.append(attr)
2100 attrset.add(attr)
2105 attrset.add(attr)
2101 colwidths[attr] = len(attr.name())
2106 colwidths[attr] = len(attr.name())
2102 try:
2107 try:
2103 value = attr.value(item)
2108 value = attr.value(item)
2104 except (KeyboardInterrupt, SystemExit):
2109 except (KeyboardInterrupt, SystemExit):
2105 raise
2110 raise
2106 except Exception, exc:
2111 except Exception, exc:
2107 value = exc
2112 value = exc
2108 (align, width, text) = xformat(value, "cell", self.maxattrlength)
2113 (align, width, text) = xformat(value, "cell", self.maxattrlength)
2109 colwidths[attr] = max(colwidths[attr], width)
2114 colwidths[attr] = max(colwidths[attr], width)
2110 # remember alignment, length and colored parts
2115 # remember alignment, length and colored parts
2111 row[attr] = (align, width, text)
2116 row[attr] = (align, width, text)
2112 rows.append(row)
2117 rows.append(row)
2113
2118
2114 stream.write("\n")
2119 stream.write("\n")
2115 for (i, attr) in enumerate(allattrs):
2120 for (i, attr) in enumerate(allattrs):
2116 attrname = attr.name()
2121 attrname = attr.name()
2117 self.style_header(attrname).write(stream)
2122 self.style_header(attrname).write(stream)
2118 spc = colwidths[attr] - len(attrname)
2123 spc = colwidths[attr] - len(attrname)
2119 if i < len(colwidths)-1:
2124 if i < len(colwidths)-1:
2120 stream.write(self.headerpadchar*spc)
2125 stream.write(self.headerpadchar*spc)
2121 stream.write(self.headersepchar)
2126 stream.write(self.headersepchar)
2122 stream.write("\n")
2127 stream.write("\n")
2123
2128
2124 for row in rows:
2129 for row in rows:
2125 for (i, attr) in enumerate(allattrs):
2130 for (i, attr) in enumerate(allattrs):
2126 (align, width, text) = row[attr]
2131 (align, width, text) = row[attr]
2127 spc = colwidths[attr] - width
2132 spc = colwidths[attr] - width
2128 if align == -1:
2133 if align == -1:
2129 text.write(stream)
2134 text.write(stream)
2130 if i < len(colwidths)-1:
2135 if i < len(colwidths)-1:
2131 stream.write(self.datapadchar*spc)
2136 stream.write(self.datapadchar*spc)
2132 elif align == 0:
2137 elif align == 0:
2133 spc = colwidths[attr] - width
2138 spc = colwidths[attr] - width
2134 spc1 = spc//2
2139 spc1 = spc//2
2135 spc2 = spc-spc1
2140 spc2 = spc-spc1
2136 stream.write(self.datapadchar*spc1)
2141 stream.write(self.datapadchar*spc1)
2137 text.write(stream)
2142 text.write(stream)
2138 if i < len(colwidths)-1:
2143 if i < len(colwidths)-1:
2139 stream.write(self.datapadchar*spc2)
2144 stream.write(self.datapadchar*spc2)
2140 else:
2145 else:
2141 stream.write(self.datapadchar*spc)
2146 stream.write(self.datapadchar*spc)
2142 text.write(stream)
2147 text.write(stream)
2143 if i < len(colwidths)-1:
2148 if i < len(colwidths)-1:
2144 stream.write(self.datasepchar)
2149 stream.write(self.datasepchar)
2145 stream.write("\n")
2150 stream.write("\n")
2146
2151
2147
2152
2148 class AttributeDetail(Table):
2153 class AttributeDetail(Table):
2149 """
2154 """
2150 ``AttributeDetail`` objects are use for displaying a detailed list of object
2155 ``AttributeDetail`` objects are use for displaying a detailed list of object
2151 attributes.
2156 attributes.
2152 """
2157 """
2153 def __init__(self, object, descriptor):
2158 def __init__(self, object, descriptor):
2154 self.object = object
2159 self.object = object
2155 self.descriptor = descriptor
2160 self.descriptor = descriptor
2156
2161
2157 def __iter__(self):
2162 def __iter__(self):
2158 return self.descriptor.iter(self.object)
2163 return self.descriptor.iter(self.object)
2159
2164
2160 def name(self):
2165 def name(self):
2161 return self.descriptor.name()
2166 return self.descriptor.name()
2162
2167
2163 def attrtype(self):
2168 def attrtype(self):
2164 return self.descriptor.attrtype(self.object)
2169 return self.descriptor.attrtype(self.object)
2165
2170
2166 def valuetype(self):
2171 def valuetype(self):
2167 return self.descriptor.valuetype(self.object)
2172 return self.descriptor.valuetype(self.object)
2168
2173
2169 def doc(self):
2174 def doc(self):
2170 return self.descriptor.doc(self.object)
2175 return self.descriptor.doc(self.object)
2171
2176
2172 def shortdoc(self):
2177 def shortdoc(self):
2173 return self.descriptor.shortdoc(self.object)
2178 return self.descriptor.shortdoc(self.object)
2174
2179
2175 def value(self):
2180 def value(self):
2176 return self.descriptor.value(self.object)
2181 return self.descriptor.value(self.object)
2177
2182
2178 def __xattrs__(self, mode="default"):
2183 def __xattrs__(self, mode="default"):
2179 attrs = ("name()", "attrtype()", "valuetype()", "value()", "shortdoc()")
2184 attrs = ("name()", "attrtype()", "valuetype()", "value()", "shortdoc()")
2180 if mode == "detail":
2185 if mode == "detail":
2181 attrs += ("doc()",)
2186 attrs += ("doc()",)
2182 return attrs
2187 return attrs
2183
2188
2184 def __xrepr__(self, mode="default"):
2189 def __xrepr__(self, mode="default"):
2185 yield (-1, True)
2190 yield (-1, True)
2186 valuetype = self.valuetype()
2191 valuetype = self.valuetype()
2187 if valuetype is not noitem:
2192 if valuetype is not noitem:
2188 for part in xrepr(valuetype):
2193 for part in xrepr(valuetype):
2189 yield part
2194 yield part
2190 yield (astyle.style_default, " ")
2195 yield (astyle.style_default, " ")
2191 yield (astyle.style_default, self.attrtype())
2196 yield (astyle.style_default, self.attrtype())
2192 yield (astyle.style_default, " ")
2197 yield (astyle.style_default, " ")
2193 yield (astyle.style_default, self.name())
2198 yield (astyle.style_default, self.name())
2194 yield (astyle.style_default, " of ")
2199 yield (astyle.style_default, " of ")
2195 for part in xrepr(self.object):
2200 for part in xrepr(self.object):
2196 yield part
2201 yield part
2197
2202
2198
2203
2199 try:
2204 try:
2200 from ibrowse import ibrowse
2205 from ibrowse import ibrowse
2201 except ImportError:
2206 except ImportError:
2202 # No curses (probably Windows)
2207 # No curses (probably Windows)
2203 try:
2208 try:
2204 from igrid import igrid
2209 from igrid import igrid
2205 except ImportError:
2210 except ImportError:
2206 # no wx eithevn do => use ``idump`` as the default display.
2211 # no wx eithevn do => use ``idump`` as the default display.
2207 defaultdisplay = idump
2212 defaultdisplay = idump
2208 else:
2213 else:
2209 defaultdisplay = igrid
2214 defaultdisplay = igrid
2210 __all__.append("igrid")
2215 __all__.append("igrid")
2211 else:
2216 else:
2212 defaultdisplay = ibrowse
2217 defaultdisplay = ibrowse
2213 __all__.append("ibrowse")
2218 __all__.append("ibrowse")
2214
2219
2215
2220
2216 # If we're running under IPython, install an IPython displayhook that
2221 # If we're running under IPython, install an IPython displayhook that
2217 # returns the object from Display.display(), else install a displayhook
2222 # returns the object from Display.display(), else install a displayhook
2218 # directly as sys.displayhook
2223 # directly as sys.displayhook
2219 api = None
2224 api = None
2220 if ipapi is not None:
2225 if ipapi is not None:
2221 try:
2226 try:
2222 api = ipapi.get()
2227 api = ipapi.get()
2223 except AttributeError:
2228 except AttributeError:
2224 pass
2229 pass
2225
2230
2226 if api is not None:
2231 if api is not None:
2227 def displayhook(self, obj):
2232 def displayhook(self, obj):
2228 if isinstance(obj, type) and issubclass(obj, Table):
2233 if isinstance(obj, type) and issubclass(obj, Table):
2229 obj = obj()
2234 obj = obj()
2230 if isinstance(obj, Table):
2235 if isinstance(obj, Table):
2231 obj = obj | defaultdisplay
2236 obj = obj | defaultdisplay
2232 if isinstance(obj, Display):
2237 if isinstance(obj, Display):
2233 return obj.display()
2238 return obj.display()
2234 else:
2239 else:
2235 raise ipapi.TryNext
2240 raise ipapi.TryNext
2236 api.set_hook("result_display", displayhook)
2241 api.set_hook("result_display", displayhook)
2237 else:
2242 else:
2238 def installdisplayhook():
2243 def installdisplayhook():
2239 _originalhook = sys.displayhook
2244 _originalhook = sys.displayhook
2240 def displayhook(obj):
2245 def displayhook(obj):
2241 if isinstance(obj, type) and issubclass(obj, Table):
2246 if isinstance(obj, type) and issubclass(obj, Table):
2242 obj = obj()
2247 obj = obj()
2243 if isinstance(obj, Table):
2248 if isinstance(obj, Table):
2244 obj = obj | defaultdisplay
2249 obj = obj | defaultdisplay
2245 if isinstance(obj, Display):
2250 if isinstance(obj, Display):
2246 return obj.display()
2251 return obj.display()
2247 else:
2252 else:
2248 _originalhook(obj)
2253 _originalhook(obj)
2249 sys.displayhook = displayhook
2254 sys.displayhook = displayhook
2250 installdisplayhook()
2255 installdisplayhook()
@@ -1,7390 +1,7392 b''
1 2008-01-19 Walter Doerwald <walter@livinglogic.de>
1 2008-01-19 Walter Doerwald <walter@livinglogic.de>
2
2
3 * IPython/Extensions/ibrowse.py, IPython/Extensions/igrid.py:
3 * ibrowse.py, igrid.py, ipipe.py:
4 The input object can now be passed to the constructor of ibrowse/igrid.
4 The input object can now be passed to the constructor of the display classes.
5 This makes it possible to use them with objects that implement __or__.
5 This makes it possible to use them with objects that implement __or__.
6
6 * ipipe.py: Importing astyle.py is done as late as possible to
7 avoid problems with circular imports.
8
7 2008-01-19 Ville Vainio <vivainio@gmail.com>
9 2008-01-19 Ville Vainio <vivainio@gmail.com>
8
10
9 * hooks.py, iplib.py: Added 'shell_hook' to customize how
11 * hooks.py, iplib.py: Added 'shell_hook' to customize how
10 IPython calls shell.
12 IPython calls shell.
11
13
12 * hooks.py, iplib.py: Added 'show_in_pager' hook to specify
14 * hooks.py, iplib.py: Added 'show_in_pager' hook to specify
13 how IPython pages text (%page, %pycat, %pdoc etc.)
15 how IPython pages text (%page, %pycat, %pdoc etc.)
14
16
15 * Extensions/jobctrl.py: Use shell_hook. New magics: '%tasks'
17 * Extensions/jobctrl.py: Use shell_hook. New magics: '%tasks'
16 and '%kill' to kill hanging processes that won't obey ctrl+C.
18 and '%kill' to kill hanging processes that won't obey ctrl+C.
17
19
18 2008-01-16 Ville Vainio <vivainio@gmail.com>
20 2008-01-16 Ville Vainio <vivainio@gmail.com>
19
21
20 * ipy_completers.py: pyw extension support for %run completer.
22 * ipy_completers.py: pyw extension support for %run completer.
21
23
22 2008-01-11 Ville Vainio <vivainio@gmail.com>
24 2008-01-11 Ville Vainio <vivainio@gmail.com>
23
25
24 * iplib.py, ipmaker.py: new rc option - autoexec. It's a list
26 * iplib.py, ipmaker.py: new rc option - autoexec. It's a list
25 of ipython commands to be run when IPython has started up
27 of ipython commands to be run when IPython has started up
26 (just before running the scripts and -c arg on command line).
28 (just before running the scripts and -c arg on command line).
27
29
28 * ipy_user_conf.py: Added an example on how to change term
30 * ipy_user_conf.py: Added an example on how to change term
29 colors in config file (through using autoexec).
31 colors in config file (through using autoexec).
30
32
31 * completer.py, test_completer.py: Ability to specify custom
33 * completer.py, test_completer.py: Ability to specify custom
32 get_endidx to replace readline.get_endidx. For emacs users.
34 get_endidx to replace readline.get_endidx. For emacs users.
33
35
34 2008-01-10 Ville Vainio <vivainio@gmail.com>
36 2008-01-10 Ville Vainio <vivainio@gmail.com>
35
37
36 * Prompts.py (set_p_str): do not crash on illegal prompt strings
38 * Prompts.py (set_p_str): do not crash on illegal prompt strings
37
39
38 2008-01-08 Ville Vainio <vivainio@gmail.com>
40 2008-01-08 Ville Vainio <vivainio@gmail.com>
39
41
40 * '%macro -r' (raw mode) is now default in sh profile.
42 * '%macro -r' (raw mode) is now default in sh profile.
41
43
42 2007-12-31 Ville Vainio <vivainio@gmail.com>
44 2007-12-31 Ville Vainio <vivainio@gmail.com>
43
45
44 * completer.py: custom completer matching is now case sensitive
46 * completer.py: custom completer matching is now case sensitive
45 (#207).
47 (#207).
46
48
47 * ultraTB.py, iplib.py: Add some KeyboardInterrupt catching in
49 * ultraTB.py, iplib.py: Add some KeyboardInterrupt catching in
48 an attempt to prevent occasional crashes.
50 an attempt to prevent occasional crashes.
49
51
50 * CrashHandler.py: Crash log dump now asks user to press enter
52 * CrashHandler.py: Crash log dump now asks user to press enter
51 before exiting.
53 before exiting.
52
54
53 * Store _ip in user_ns instead of __builtin__, enabling safer
55 * Store _ip in user_ns instead of __builtin__, enabling safer
54 coexistence of multiple IPython instances in the same python
56 coexistence of multiple IPython instances in the same python
55 interpreter (#197).
57 interpreter (#197).
56
58
57 * Debugger.py, ipmaker.py: Need to add '-pydb' command line
59 * Debugger.py, ipmaker.py: Need to add '-pydb' command line
58 switch to enable pydb in post-mortem debugging and %run -d.
60 switch to enable pydb in post-mortem debugging and %run -d.
59
61
60 2007-12-28 Ville Vainio <vivainio@gmail.com>
62 2007-12-28 Ville Vainio <vivainio@gmail.com>
61
63
62 * ipy_server.py: TCP socket server for "remote control" of an IPython
64 * ipy_server.py: TCP socket server for "remote control" of an IPython
63 instance.
65 instance.
64
66
65 * Debugger.py: Change to PSF license
67 * Debugger.py: Change to PSF license
66
68
67 * simplegeneric.py: Add license & author notes.
69 * simplegeneric.py: Add license & author notes.
68
70
69 * ipy_fsops.py: Added PathObj and FileObj, an object-oriented way
71 * ipy_fsops.py: Added PathObj and FileObj, an object-oriented way
70 to navigate file system with a custom completer. Run
72 to navigate file system with a custom completer. Run
71 ipy_fsops.test_pathobj() to play with it.
73 ipy_fsops.test_pathobj() to play with it.
72
74
73 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
75 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
74
76
75 * IPython/dtutils.py: Add utilities for interactively running
77 * IPython/dtutils.py: Add utilities for interactively running
76 doctests. Still needs work to more easily handle the namespace of
78 doctests. Still needs work to more easily handle the namespace of
77 the package one may be working on, but the basics are in place.
79 the package one may be working on, but the basics are in place.
78
80
79 2007-12-27 Ville Vainio <vivainio@gmail.com>
81 2007-12-27 Ville Vainio <vivainio@gmail.com>
80
82
81 * ipy_completers.py: Applied arno's patch to get proper list of
83 * ipy_completers.py: Applied arno's patch to get proper list of
82 packages in import completer. Closes #196.
84 packages in import completer. Closes #196.
83
85
84 2007-12-20 Ville Vainio <vivainio@gmail.com>
86 2007-12-20 Ville Vainio <vivainio@gmail.com>
85
87
86 * completer.py, generics.py(complete_object): Allow
88 * completer.py, generics.py(complete_object): Allow
87 custom complers based on python objects via simplegeneric.
89 custom complers based on python objects via simplegeneric.
88 See generics.py / my_demo_complete_object
90 See generics.py / my_demo_complete_object
89
91
90 2007-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
92 2007-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
91
93
92 * IPython/Prompts.py (BasePrompt.__nonzero__): add proper boolean
94 * IPython/Prompts.py (BasePrompt.__nonzero__): add proper boolean
93 behavior to prompt objects, useful for display hooks to adjust
95 behavior to prompt objects, useful for display hooks to adjust
94 themselves depending on whether prompts will be there or not.
96 themselves depending on whether prompts will be there or not.
95
97
96 2007-12-13 Ville Vainio <vivainio@gmail.com>
98 2007-12-13 Ville Vainio <vivainio@gmail.com>
97
99
98 * iplib.py(raw_input): unix readline does not allow unicode in
100 * iplib.py(raw_input): unix readline does not allow unicode in
99 history, encode to normal string. After patch by Tiago.
101 history, encode to normal string. After patch by Tiago.
100 Close #201
102 Close #201
101
103
102 2007-12-12 Ville Vainio <vivainio@gmail.com>
104 2007-12-12 Ville Vainio <vivainio@gmail.com>
103
105
104 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of
106 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of
105 current directory.
107 current directory.
106
108
107 2007-12-12 Fernando Perez <Fernando.Perez@colorado.edu>
109 2007-12-12 Fernando Perez <Fernando.Perez@colorado.edu>
108
110
109 * IPython/Shell.py (_select_shell): add support for controlling
111 * IPython/Shell.py (_select_shell): add support for controlling
110 the pylab threading mode directly at the command line, without
112 the pylab threading mode directly at the command line, without
111 having to modify MPL config files. Added unit tests for this
113 having to modify MPL config files. Added unit tests for this
112 feature, though manual/docs update is still pending, will do later.
114 feature, though manual/docs update is still pending, will do later.
113
115
114 2007-12-11 Ville Vainio <vivainio@gmail.com>
116 2007-12-11 Ville Vainio <vivainio@gmail.com>
115
117
116 * ext_rescapture.py: var = !cmd is no longer verbose (to facilitate
118 * ext_rescapture.py: var = !cmd is no longer verbose (to facilitate
117 use in scripts)
119 use in scripts)
118
120
119 2007-12-07 Ville Vainio <vivainio@gmail.com>
121 2007-12-07 Ville Vainio <vivainio@gmail.com>
120
122
121 * iplib.py, ipy_profile_sh.py: Do not escape # on command lines
123 * iplib.py, ipy_profile_sh.py: Do not escape # on command lines
122 anymore (to \#) - even if it is a comment char that is implicitly
124 anymore (to \#) - even if it is a comment char that is implicitly
123 escaped in some unix shells in interactive mode, it is ok to leave
125 escaped in some unix shells in interactive mode, it is ok to leave
124 it in IPython as such.
126 it in IPython as such.
125
127
126
128
127 2007-12-01 Robert Kern <robert.kern@gmail.com>
129 2007-12-01 Robert Kern <robert.kern@gmail.com>
128
130
129 * IPython/ultraTB.py (findsource): Improve the monkeypatch to
131 * IPython/ultraTB.py (findsource): Improve the monkeypatch to
130 inspect.findsource(). It can now find source lines inside zipped
132 inspect.findsource(). It can now find source lines inside zipped
131 packages.
133 packages.
132
134
133 * IPython/ultraTB.py: When constructing tracebacks, try to use __file__
135 * IPython/ultraTB.py: When constructing tracebacks, try to use __file__
134 in the frame's namespace before trusting the filename in the code object
136 in the frame's namespace before trusting the filename in the code object
135 which created the frame.
137 which created the frame.
136
138
137 2007-11-29 *** Released version 0.8.2
139 2007-11-29 *** Released version 0.8.2
138
140
139 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
141 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
140
142
141 * IPython/Logger.py (Logger.logstop): add a proper logstop()
143 * IPython/Logger.py (Logger.logstop): add a proper logstop()
142 method to fully stop the logger, along with a corresponding
144 method to fully stop the logger, along with a corresponding
143 %logstop magic for interactive use.
145 %logstop magic for interactive use.
144
146
145 * IPython/Extensions/ipy_host_completers.py: added new host
147 * IPython/Extensions/ipy_host_completers.py: added new host
146 completers functionality, contributed by Gael Pasgrimaud
148 completers functionality, contributed by Gael Pasgrimaud
147 <gawel-AT-afpy.org>.
149 <gawel-AT-afpy.org>.
148
150
149 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
151 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
150
152
151 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
153 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
152 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
154 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
153 options handling. Unicode fix in %whos (committed a while ago)
155 options handling. Unicode fix in %whos (committed a while ago)
154 was also contributed by Paul.
156 was also contributed by Paul.
155
157
156 2007-11-23 Darren Dale <darren.dale@cornell.edu>
158 2007-11-23 Darren Dale <darren.dale@cornell.edu>
157 * ipy_traits_completer.py: let traits_completer respect the user's
159 * ipy_traits_completer.py: let traits_completer respect the user's
158 readline_omit__names setting.
160 readline_omit__names setting.
159
161
160 2007-11-08 Ville Vainio <vivainio@gmail.com>
162 2007-11-08 Ville Vainio <vivainio@gmail.com>
161
163
162 * ipy_completers.py (import completer): assume 'xml' module exists.
164 * ipy_completers.py (import completer): assume 'xml' module exists.
163 Do not add every module twice anymore. Closes #196.
165 Do not add every module twice anymore. Closes #196.
164
166
165 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
167 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
166 completer that uses apt-cache to search for existing packages.
168 completer that uses apt-cache to search for existing packages.
167
169
168 2007-11-06 Ville Vainio <vivainio@gmail.com>
170 2007-11-06 Ville Vainio <vivainio@gmail.com>
169
171
170 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
172 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
171 true. Closes #194.
173 true. Closes #194.
172
174
173 2007-11-01 Brian Granger <ellisonbg@gmail.com>
175 2007-11-01 Brian Granger <ellisonbg@gmail.com>
174
176
175 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
177 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
176 working with OS X 10.5 libedit implementation of readline.
178 working with OS X 10.5 libedit implementation of readline.
177
179
178 2007-10-24 Ville Vainio <vivainio@gmail.com>
180 2007-10-24 Ville Vainio <vivainio@gmail.com>
179
181
180 * iplib.py(user_setup): To route around buggy installations where
182 * iplib.py(user_setup): To route around buggy installations where
181 UserConfig is not available, create a minimal _ipython.
183 UserConfig is not available, create a minimal _ipython.
182
184
183 * iplib.py: Unicode fixes from Jorgen.
185 * iplib.py: Unicode fixes from Jorgen.
184
186
185 * genutils.py: Slist now has new method 'fields()' for extraction of
187 * genutils.py: Slist now has new method 'fields()' for extraction of
186 whitespace-separated fields from line-oriented data.
188 whitespace-separated fields from line-oriented data.
187
189
188 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
190 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
189
191
190 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
192 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
191 when querying objects with no __class__ attribute (such as
193 when querying objects with no __class__ attribute (such as
192 f2py-generated modules).
194 f2py-generated modules).
193
195
194 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
196 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
195
197
196 * IPython/Magic.py (magic_time): track compilation time and report
198 * IPython/Magic.py (magic_time): track compilation time and report
197 it if longer than 0.1s (fix done to %time and %timeit). After a
199 it if longer than 0.1s (fix done to %time and %timeit). After a
198 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
200 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
199
201
200 2007-09-18 Ville Vainio <vivainio@gmail.com>
202 2007-09-18 Ville Vainio <vivainio@gmail.com>
201
203
202 * genutils.py(make_quoted_expr): Do not use Itpl, it does
204 * genutils.py(make_quoted_expr): Do not use Itpl, it does
203 not support unicode at the moment. Fixes (many) magic calls with
205 not support unicode at the moment. Fixes (many) magic calls with
204 special characters.
206 special characters.
205
207
206 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
208 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
207
209
208 * IPython/genutils.py (doctest_reload): expose the doctest
210 * IPython/genutils.py (doctest_reload): expose the doctest
209 reloader to the user so that people can easily reset doctest while
211 reloader to the user so that people can easily reset doctest while
210 using it interactively. Fixes a problem reported by Jorgen.
212 using it interactively. Fixes a problem reported by Jorgen.
211
213
212 * IPython/iplib.py (InteractiveShell.__init__): protect the
214 * IPython/iplib.py (InteractiveShell.__init__): protect the
213 FakeModule instances used for __main__ in %run calls from
215 FakeModule instances used for __main__ in %run calls from
214 deletion, so that user code defined in them isn't left with
216 deletion, so that user code defined in them isn't left with
215 dangling references due to the Python module deletion machinery.
217 dangling references due to the Python module deletion machinery.
216 This should fix the problems reported by Darren.
218 This should fix the problems reported by Darren.
217
219
218 2007-09-10 Darren Dale <dd55@cornell.edu>
220 2007-09-10 Darren Dale <dd55@cornell.edu>
219
221
220 * Cleanup of IPShellQt and IPShellQt4
222 * Cleanup of IPShellQt and IPShellQt4
221
223
222 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
224 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
223
225
224 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
226 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
225 doctest support.
227 doctest support.
226
228
227 * IPython/iplib.py (safe_execfile): minor docstring improvements.
229 * IPython/iplib.py (safe_execfile): minor docstring improvements.
228
230
229 2007-09-08 Ville Vainio <vivainio@gmail.com>
231 2007-09-08 Ville Vainio <vivainio@gmail.com>
230
232
231 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
233 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
232 directory, not the target directory.
234 directory, not the target directory.
233
235
234 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
236 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
235 exception that won't print the tracebacks. Switched many magics to
237 exception that won't print the tracebacks. Switched many magics to
236 raise them on error situations, also GetoptError is not printed
238 raise them on error situations, also GetoptError is not printed
237 anymore.
239 anymore.
238
240
239 2007-09-07 Ville Vainio <vivainio@gmail.com>
241 2007-09-07 Ville Vainio <vivainio@gmail.com>
240
242
241 * iplib.py: do not auto-alias "dir", it screws up other dir auto
243 * iplib.py: do not auto-alias "dir", it screws up other dir auto
242 aliases.
244 aliases.
243
245
244 * genutils.py: SList.grep() implemented.
246 * genutils.py: SList.grep() implemented.
245
247
246 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
248 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
247 for easy "out of the box" setup of several common editors, so that
249 for easy "out of the box" setup of several common editors, so that
248 e.g. '%edit os.path.isfile' will jump to the correct line
250 e.g. '%edit os.path.isfile' will jump to the correct line
249 automatically. Contributions for command lines of your favourite
251 automatically. Contributions for command lines of your favourite
250 editors welcome.
252 editors welcome.
251
253
252 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
254 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
253
255
254 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
256 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
255 preventing source display in certain cases. In reality I think
257 preventing source display in certain cases. In reality I think
256 the problem is with Ubuntu's Python build, but this change works
258 the problem is with Ubuntu's Python build, but this change works
257 around the issue in some cases (not in all, unfortunately). I'd
259 around the issue in some cases (not in all, unfortunately). I'd
258 filed a Python bug on this with more details, but in the change of
260 filed a Python bug on this with more details, but in the change of
259 bug trackers it seems to have been lost.
261 bug trackers it seems to have been lost.
260
262
261 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
263 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
262 not the same, it's not self-documenting, doesn't allow range
264 not the same, it's not self-documenting, doesn't allow range
263 selection, and sorts alphabetically instead of numerically.
265 selection, and sorts alphabetically instead of numerically.
264 (magic_r): restore %r. No, "up + enter. One char magic" is not
266 (magic_r): restore %r. No, "up + enter. One char magic" is not
265 the same thing, since %r takes parameters to allow fast retrieval
267 the same thing, since %r takes parameters to allow fast retrieval
266 of old commands. I've received emails from users who use this a
268 of old commands. I've received emails from users who use this a
267 LOT, so it stays.
269 LOT, so it stays.
268 (magic_automagic): restore %automagic. "use _ip.option.automagic"
270 (magic_automagic): restore %automagic. "use _ip.option.automagic"
269 is not a valid replacement b/c it doesn't provide an complete
271 is not a valid replacement b/c it doesn't provide an complete
270 explanation (which the automagic docstring does).
272 explanation (which the automagic docstring does).
271 (magic_autocall): restore %autocall, with improved docstring.
273 (magic_autocall): restore %autocall, with improved docstring.
272 Same argument as for others, "use _ip.options.autocall" is not a
274 Same argument as for others, "use _ip.options.autocall" is not a
273 valid replacement.
275 valid replacement.
274 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
276 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
275 tutorials and online docs.
277 tutorials and online docs.
276
278
277 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
279 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
278
280
279 * IPython/usage.py (quick_reference): mention magics in quickref,
281 * IPython/usage.py (quick_reference): mention magics in quickref,
280 modified main banner to mention %quickref.
282 modified main banner to mention %quickref.
281
283
282 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
284 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
283
285
284 2007-09-06 Ville Vainio <vivainio@gmail.com>
286 2007-09-06 Ville Vainio <vivainio@gmail.com>
285
287
286 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
288 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
287 Callable aliases now pass the _ip as first arg. This breaks
289 Callable aliases now pass the _ip as first arg. This breaks
288 compatibility with earlier 0.8.2.svn series! (though they should
290 compatibility with earlier 0.8.2.svn series! (though they should
289 not have been in use yet outside these few extensions)
291 not have been in use yet outside these few extensions)
290
292
291 2007-09-05 Ville Vainio <vivainio@gmail.com>
293 2007-09-05 Ville Vainio <vivainio@gmail.com>
292
294
293 * external/mglob.py: expand('dirname') => ['dirname'], instead
295 * external/mglob.py: expand('dirname') => ['dirname'], instead
294 of ['dirname/foo','dirname/bar', ...].
296 of ['dirname/foo','dirname/bar', ...].
295
297
296 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
298 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
297 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
299 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
298 is useful for others as well).
300 is useful for others as well).
299
301
300 * iplib.py: on callable aliases (as opposed to old style aliases),
302 * iplib.py: on callable aliases (as opposed to old style aliases),
301 do var_expand() immediately, and use make_quoted_expr instead
303 do var_expand() immediately, and use make_quoted_expr instead
302 of hardcoded r"""
304 of hardcoded r"""
303
305
304 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
306 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
305 if not available load ipy_fsops.py for cp, mv, etc. replacements
307 if not available load ipy_fsops.py for cp, mv, etc. replacements
306
308
307 * OInspect.py, ipy_which.py: improve %which and obj? for callable
309 * OInspect.py, ipy_which.py: improve %which and obj? for callable
308 aliases
310 aliases
309
311
310 2007-09-04 Ville Vainio <vivainio@gmail.com>
312 2007-09-04 Ville Vainio <vivainio@gmail.com>
311
313
312 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
314 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
313 Relicensed under BSD with the authors approval.
315 Relicensed under BSD with the authors approval.
314
316
315 * ipmaker.py, usage.py: Remove %magic from default banner, improve
317 * ipmaker.py, usage.py: Remove %magic from default banner, improve
316 %quickref
318 %quickref
317
319
318 2007-09-03 Ville Vainio <vivainio@gmail.com>
320 2007-09-03 Ville Vainio <vivainio@gmail.com>
319
321
320 * Magic.py: %time now passes expression through prefilter,
322 * Magic.py: %time now passes expression through prefilter,
321 allowing IPython syntax.
323 allowing IPython syntax.
322
324
323 2007-09-01 Ville Vainio <vivainio@gmail.com>
325 2007-09-01 Ville Vainio <vivainio@gmail.com>
324
326
325 * ipmaker.py: Always show full traceback when newstyle config fails
327 * ipmaker.py: Always show full traceback when newstyle config fails
326
328
327 2007-08-27 Ville Vainio <vivainio@gmail.com>
329 2007-08-27 Ville Vainio <vivainio@gmail.com>
328
330
329 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
331 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
330
332
331 2007-08-26 Ville Vainio <vivainio@gmail.com>
333 2007-08-26 Ville Vainio <vivainio@gmail.com>
332
334
333 * ipmaker.py: Command line args have the highest priority again
335 * ipmaker.py: Command line args have the highest priority again
334
336
335 * iplib.py, ipmaker.py: -i command line argument now behaves as in
337 * iplib.py, ipmaker.py: -i command line argument now behaves as in
336 normal python, i.e. leaves the IPython session running after -c
338 normal python, i.e. leaves the IPython session running after -c
337 command or running a batch file from command line.
339 command or running a batch file from command line.
338
340
339 2007-08-22 Ville Vainio <vivainio@gmail.com>
341 2007-08-22 Ville Vainio <vivainio@gmail.com>
340
342
341 * iplib.py: no extra empty (last) line in raw hist w/ multiline
343 * iplib.py: no extra empty (last) line in raw hist w/ multiline
342 statements
344 statements
343
345
344 * logger.py: Fix bug where blank lines in history were not
346 * logger.py: Fix bug where blank lines in history were not
345 added until AFTER adding the current line; translated and raw
347 added until AFTER adding the current line; translated and raw
346 history should finally be in sync with prompt now.
348 history should finally be in sync with prompt now.
347
349
348 * ipy_completers.py: quick_completer now makes it easy to create
350 * ipy_completers.py: quick_completer now makes it easy to create
349 trivial custom completers
351 trivial custom completers
350
352
351 * clearcmd.py: shadow history compression & erasing, fixed input hist
353 * clearcmd.py: shadow history compression & erasing, fixed input hist
352 clearing.
354 clearing.
353
355
354 * envpersist.py, history.py: %env (sh profile only), %hist completers
356 * envpersist.py, history.py: %env (sh profile only), %hist completers
355
357
356 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
358 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
357 term title now include the drive letter, and always use / instead of
359 term title now include the drive letter, and always use / instead of
358 os.sep (as per recommended approach for win32 ipython in general).
360 os.sep (as per recommended approach for win32 ipython in general).
359
361
360 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
362 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
361 plain python scripts from ipykit command line by running
363 plain python scripts from ipykit command line by running
362 "py myscript.py", even w/o installed python.
364 "py myscript.py", even w/o installed python.
363
365
364 2007-08-21 Ville Vainio <vivainio@gmail.com>
366 2007-08-21 Ville Vainio <vivainio@gmail.com>
365
367
366 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
368 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
367 (for backwards compatibility)
369 (for backwards compatibility)
368
370
369 * history.py: switch back to %hist -t from %hist -r as default.
371 * history.py: switch back to %hist -t from %hist -r as default.
370 At least until raw history is fixed for good.
372 At least until raw history is fixed for good.
371
373
372 2007-08-20 Ville Vainio <vivainio@gmail.com>
374 2007-08-20 Ville Vainio <vivainio@gmail.com>
373
375
374 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
376 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
375 locate alias redeclarations etc. Also, avoid handling
377 locate alias redeclarations etc. Also, avoid handling
376 _ip.IP.alias_table directly, prefer using _ip.defalias.
378 _ip.IP.alias_table directly, prefer using _ip.defalias.
377
379
378
380
379 2007-08-15 Ville Vainio <vivainio@gmail.com>
381 2007-08-15 Ville Vainio <vivainio@gmail.com>
380
382
381 * prefilter.py: ! is now always served first
383 * prefilter.py: ! is now always served first
382
384
383 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
385 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
384
386
385 * IPython/iplib.py (safe_execfile): fix the SystemExit
387 * IPython/iplib.py (safe_execfile): fix the SystemExit
386 auto-suppression code to work in Python2.4 (the internal structure
388 auto-suppression code to work in Python2.4 (the internal structure
387 of that exception changed and I'd only tested the code with 2.5).
389 of that exception changed and I'd only tested the code with 2.5).
388 Bug reported by a SciPy attendee.
390 Bug reported by a SciPy attendee.
389
391
390 2007-08-13 Ville Vainio <vivainio@gmail.com>
392 2007-08-13 Ville Vainio <vivainio@gmail.com>
391
393
392 * prefilter.py: reverted !c:/bin/foo fix, made % in
394 * prefilter.py: reverted !c:/bin/foo fix, made % in
393 multiline specials work again
395 multiline specials work again
394
396
395 2007-08-13 Ville Vainio <vivainio@gmail.com>
397 2007-08-13 Ville Vainio <vivainio@gmail.com>
396
398
397 * prefilter.py: Take more care to special-case !, so that
399 * prefilter.py: Take more care to special-case !, so that
398 !c:/bin/foo.exe works.
400 !c:/bin/foo.exe works.
399
401
400 * setup.py: if we are building eggs, strip all docs and
402 * setup.py: if we are building eggs, strip all docs and
401 examples (it doesn't make sense to bytecompile examples,
403 examples (it doesn't make sense to bytecompile examples,
402 and docs would be in an awkward place anyway).
404 and docs would be in an awkward place anyway).
403
405
404 * Ryan Krauss' patch fixes start menu shortcuts when IPython
406 * Ryan Krauss' patch fixes start menu shortcuts when IPython
405 is installed into a directory that has spaces in the name.
407 is installed into a directory that has spaces in the name.
406
408
407 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
409 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
408
410
409 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
411 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
410 doctest profile and %doctest_mode, so they actually generate the
412 doctest profile and %doctest_mode, so they actually generate the
411 blank lines needed by doctest to separate individual tests.
413 blank lines needed by doctest to separate individual tests.
412
414
413 * IPython/iplib.py (safe_execfile): modify so that running code
415 * IPython/iplib.py (safe_execfile): modify so that running code
414 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
416 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
415 doesn't get a printed traceback. Any other value in sys.exit(),
417 doesn't get a printed traceback. Any other value in sys.exit(),
416 including the empty call, still generates a traceback. This
418 including the empty call, still generates a traceback. This
417 enables use of %run without having to pass '-e' for codes that
419 enables use of %run without having to pass '-e' for codes that
418 correctly set the exit status flag.
420 correctly set the exit status flag.
419
421
420 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
422 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
421
423
422 * IPython/iplib.py (InteractiveShell.post_config_initialization):
424 * IPython/iplib.py (InteractiveShell.post_config_initialization):
423 fix problems with doctests failing when run inside IPython due to
425 fix problems with doctests failing when run inside IPython due to
424 IPython's modifications of sys.displayhook.
426 IPython's modifications of sys.displayhook.
425
427
426 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
428 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
427
429
428 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
430 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
429 a string with names.
431 a string with names.
430
432
431 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
433 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
432
434
433 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
435 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
434 magic to toggle on/off the doctest pasting support without having
436 magic to toggle on/off the doctest pasting support without having
435 to leave a session to switch to a separate profile.
437 to leave a session to switch to a separate profile.
436
438
437 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
439 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
438
440
439 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
441 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
440 introduce a blank line between inputs, to conform to doctest
442 introduce a blank line between inputs, to conform to doctest
441 requirements.
443 requirements.
442
444
443 * IPython/OInspect.py (Inspector.pinfo): fix another part where
445 * IPython/OInspect.py (Inspector.pinfo): fix another part where
444 auto-generated docstrings for new-style classes were showing up.
446 auto-generated docstrings for new-style classes were showing up.
445
447
446 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
448 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
447
449
448 * api_changes: Add new file to track backward-incompatible
450 * api_changes: Add new file to track backward-incompatible
449 user-visible changes.
451 user-visible changes.
450
452
451 2007-08-06 Ville Vainio <vivainio@gmail.com>
453 2007-08-06 Ville Vainio <vivainio@gmail.com>
452
454
453 * ipmaker.py: fix bug where user_config_ns didn't exist at all
455 * ipmaker.py: fix bug where user_config_ns didn't exist at all
454 before all the config files were handled.
456 before all the config files were handled.
455
457
456 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
458 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
457
459
458 * IPython/irunner.py (RunnerFactory): Add new factory class for
460 * IPython/irunner.py (RunnerFactory): Add new factory class for
459 creating reusable runners based on filenames.
461 creating reusable runners based on filenames.
460
462
461 * IPython/Extensions/ipy_profile_doctest.py: New profile for
463 * IPython/Extensions/ipy_profile_doctest.py: New profile for
462 doctest support. It sets prompts/exceptions as similar to
464 doctest support. It sets prompts/exceptions as similar to
463 standard Python as possible, so that ipython sessions in this
465 standard Python as possible, so that ipython sessions in this
464 profile can be easily pasted as doctests with minimal
466 profile can be easily pasted as doctests with minimal
465 modifications. It also enables pasting of doctests from external
467 modifications. It also enables pasting of doctests from external
466 sources (even if they have leading whitespace), so that you can
468 sources (even if they have leading whitespace), so that you can
467 rerun doctests from existing sources.
469 rerun doctests from existing sources.
468
470
469 * IPython/iplib.py (_prefilter): fix a buglet where after entering
471 * IPython/iplib.py (_prefilter): fix a buglet where after entering
470 some whitespace, the prompt would become a continuation prompt
472 some whitespace, the prompt would become a continuation prompt
471 with no way of exiting it other than Ctrl-C. This fix brings us
473 with no way of exiting it other than Ctrl-C. This fix brings us
472 into conformity with how the default python prompt works.
474 into conformity with how the default python prompt works.
473
475
474 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
476 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
475 Add support for pasting not only lines that start with '>>>', but
477 Add support for pasting not only lines that start with '>>>', but
476 also with ' >>>'. That is, arbitrary whitespace can now precede
478 also with ' >>>'. That is, arbitrary whitespace can now precede
477 the prompts. This makes the system useful for pasting doctests
479 the prompts. This makes the system useful for pasting doctests
478 from docstrings back into a normal session.
480 from docstrings back into a normal session.
479
481
480 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
482 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
481
483
482 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
484 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
483 r1357, which had killed multiple invocations of an embedded
485 r1357, which had killed multiple invocations of an embedded
484 ipython (this means that example-embed has been broken for over 1
486 ipython (this means that example-embed has been broken for over 1
485 year!!!). Rather than possibly breaking the batch stuff for which
487 year!!!). Rather than possibly breaking the batch stuff for which
486 the code in iplib.py/interact was introduced, I worked around the
488 the code in iplib.py/interact was introduced, I worked around the
487 problem in the embedding class in Shell.py. We really need a
489 problem in the embedding class in Shell.py. We really need a
488 bloody test suite for this code, I'm sick of finding stuff that
490 bloody test suite for this code, I'm sick of finding stuff that
489 used to work breaking left and right every time I use an old
491 used to work breaking left and right every time I use an old
490 feature I hadn't touched in a few months.
492 feature I hadn't touched in a few months.
491 (kill_embedded): Add a new magic that only shows up in embedded
493 (kill_embedded): Add a new magic that only shows up in embedded
492 mode, to allow users to permanently deactivate an embedded instance.
494 mode, to allow users to permanently deactivate an embedded instance.
493
495
494 2007-08-01 Ville Vainio <vivainio@gmail.com>
496 2007-08-01 Ville Vainio <vivainio@gmail.com>
495
497
496 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
498 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
497 history gets out of sync on runlines (e.g. when running macros).
499 history gets out of sync on runlines (e.g. when running macros).
498
500
499 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
501 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
500
502
501 * IPython/Magic.py (magic_colors): fix win32-related error message
503 * IPython/Magic.py (magic_colors): fix win32-related error message
502 that could appear under *nix when readline was missing. Patch by
504 that could appear under *nix when readline was missing. Patch by
503 Scott Jackson, closes #175.
505 Scott Jackson, closes #175.
504
506
505 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
507 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
506
508
507 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
509 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
508 completer that it traits-aware, so that traits objects don't show
510 completer that it traits-aware, so that traits objects don't show
509 all of their internal attributes all the time.
511 all of their internal attributes all the time.
510
512
511 * IPython/genutils.py (dir2): moved this code from inside
513 * IPython/genutils.py (dir2): moved this code from inside
512 completer.py to expose it publicly, so I could use it in the
514 completer.py to expose it publicly, so I could use it in the
513 wildcards bugfix.
515 wildcards bugfix.
514
516
515 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
517 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
516 Stefan with Traits.
518 Stefan with Traits.
517
519
518 * IPython/completer.py (Completer.attr_matches): change internal
520 * IPython/completer.py (Completer.attr_matches): change internal
519 var name from 'object' to 'obj', since 'object' is now a builtin
521 var name from 'object' to 'obj', since 'object' is now a builtin
520 and this can lead to weird bugs if reusing this code elsewhere.
522 and this can lead to weird bugs if reusing this code elsewhere.
521
523
522 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
524 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
523
525
524 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
526 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
525 'foo?' and update the code to prevent printing of default
527 'foo?' and update the code to prevent printing of default
526 docstrings that started appearing after I added support for
528 docstrings that started appearing after I added support for
527 new-style classes. The approach I'm using isn't ideal (I just
529 new-style classes. The approach I'm using isn't ideal (I just
528 special-case those strings) but I'm not sure how to more robustly
530 special-case those strings) but I'm not sure how to more robustly
529 differentiate between truly user-written strings and Python's
531 differentiate between truly user-written strings and Python's
530 automatic ones.
532 automatic ones.
531
533
532 2007-07-09 Ville Vainio <vivainio@gmail.com>
534 2007-07-09 Ville Vainio <vivainio@gmail.com>
533
535
534 * completer.py: Applied Matthew Neeley's patch:
536 * completer.py: Applied Matthew Neeley's patch:
535 Dynamic attributes from trait_names and _getAttributeNames are added
537 Dynamic attributes from trait_names and _getAttributeNames are added
536 to the list of tab completions, but when this happens, the attribute
538 to the list of tab completions, but when this happens, the attribute
537 list is turned into a set, so the attributes are unordered when
539 list is turned into a set, so the attributes are unordered when
538 printed, which makes it hard to find the right completion. This patch
540 printed, which makes it hard to find the right completion. This patch
539 turns this set back into a list and sort it.
541 turns this set back into a list and sort it.
540
542
541 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
543 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
542
544
543 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
545 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
544 classes in various inspector functions.
546 classes in various inspector functions.
545
547
546 2007-06-28 Ville Vainio <vivainio@gmail.com>
548 2007-06-28 Ville Vainio <vivainio@gmail.com>
547
549
548 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
550 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
549 Implement "shadow" namespace, and callable aliases that reside there.
551 Implement "shadow" namespace, and callable aliases that reside there.
550 Use them by:
552 Use them by:
551
553
552 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
554 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
553
555
554 foo hello world
556 foo hello world
555 (gets translated to:)
557 (gets translated to:)
556 _sh.foo(r"""hello world""")
558 _sh.foo(r"""hello world""")
557
559
558 In practice, this kind of alias can take the role of a magic function
560 In practice, this kind of alias can take the role of a magic function
559
561
560 * New generic inspect_object, called on obj? and obj??
562 * New generic inspect_object, called on obj? and obj??
561
563
562 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
564 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
563
565
564 * IPython/ultraTB.py (findsource): fix a problem with
566 * IPython/ultraTB.py (findsource): fix a problem with
565 inspect.getfile that can cause crashes during traceback construction.
567 inspect.getfile that can cause crashes during traceback construction.
566
568
567 2007-06-14 Ville Vainio <vivainio@gmail.com>
569 2007-06-14 Ville Vainio <vivainio@gmail.com>
568
570
569 * iplib.py (handle_auto): Try to use ascii for printing "--->"
571 * iplib.py (handle_auto): Try to use ascii for printing "--->"
570 autocall rewrite indication, becausesometimes unicode fails to print
572 autocall rewrite indication, becausesometimes unicode fails to print
571 properly (and you get ' - - - '). Use plain uncoloured ---> for
573 properly (and you get ' - - - '). Use plain uncoloured ---> for
572 unicode.
574 unicode.
573
575
574 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
576 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
575
577
576 . pickleshare 'hash' commands (hget, hset, hcompress,
578 . pickleshare 'hash' commands (hget, hset, hcompress,
577 hdict) for efficient shadow history storage.
579 hdict) for efficient shadow history storage.
578
580
579 2007-06-13 Ville Vainio <vivainio@gmail.com>
581 2007-06-13 Ville Vainio <vivainio@gmail.com>
580
582
581 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
583 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
582 Added kw arg 'interactive', tell whether vars should be visible
584 Added kw arg 'interactive', tell whether vars should be visible
583 with %whos.
585 with %whos.
584
586
585 2007-06-11 Ville Vainio <vivainio@gmail.com>
587 2007-06-11 Ville Vainio <vivainio@gmail.com>
586
588
587 * pspersistence.py, Magic.py, iplib.py: directory history now saved
589 * pspersistence.py, Magic.py, iplib.py: directory history now saved
588 to db
590 to db
589
591
590 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
592 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
591 Also, it exits IPython immediately after evaluating the command (just like
593 Also, it exits IPython immediately after evaluating the command (just like
592 std python)
594 std python)
593
595
594 2007-06-05 Walter Doerwald <walter@livinglogic.de>
596 2007-06-05 Walter Doerwald <walter@livinglogic.de>
595
597
596 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
598 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
597 Python string and captures the output. (Idea and original patch by
599 Python string and captures the output. (Idea and original patch by
598 Stefan van der Walt)
600 Stefan van der Walt)
599
601
600 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
602 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
601
603
602 * IPython/ultraTB.py (VerboseTB.text): update printing of
604 * IPython/ultraTB.py (VerboseTB.text): update printing of
603 exception types for Python 2.5 (now all exceptions in the stdlib
605 exception types for Python 2.5 (now all exceptions in the stdlib
604 are new-style classes).
606 are new-style classes).
605
607
606 2007-05-31 Walter Doerwald <walter@livinglogic.de>
608 2007-05-31 Walter Doerwald <walter@livinglogic.de>
607
609
608 * IPython/Extensions/igrid.py: Add new commands refresh and
610 * IPython/Extensions/igrid.py: Add new commands refresh and
609 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
611 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
610 the iterator once (refresh) or after every x seconds (refresh_timer).
612 the iterator once (refresh) or after every x seconds (refresh_timer).
611 Add a working implementation of "searchexpression", where the text
613 Add a working implementation of "searchexpression", where the text
612 entered is not the text to search for, but an expression that must
614 entered is not the text to search for, but an expression that must
613 be true. Added display of shortcuts to the menu. Added commands "pickinput"
615 be true. Added display of shortcuts to the menu. Added commands "pickinput"
614 and "pickinputattr" that put the object or attribute under the cursor
616 and "pickinputattr" that put the object or attribute under the cursor
615 in the input line. Split the statusbar to be able to display the currently
617 in the input line. Split the statusbar to be able to display the currently
616 active refresh interval. (Patch by Nik Tautenhahn)
618 active refresh interval. (Patch by Nik Tautenhahn)
617
619
618 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
620 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
619
621
620 * fixing set_term_title to use ctypes as default
622 * fixing set_term_title to use ctypes as default
621
623
622 * fixing set_term_title fallback to work when curent dir
624 * fixing set_term_title fallback to work when curent dir
623 is on a windows network share
625 is on a windows network share
624
626
625 2007-05-28 Ville Vainio <vivainio@gmail.com>
627 2007-05-28 Ville Vainio <vivainio@gmail.com>
626
628
627 * %cpaste: strip + with > from left (diffs).
629 * %cpaste: strip + with > from left (diffs).
628
630
629 * iplib.py: Fix crash when readline not installed
631 * iplib.py: Fix crash when readline not installed
630
632
631 2007-05-26 Ville Vainio <vivainio@gmail.com>
633 2007-05-26 Ville Vainio <vivainio@gmail.com>
632
634
633 * generics.py: intruduce easy to extend result_display generic
635 * generics.py: intruduce easy to extend result_display generic
634 function (using simplegeneric.py).
636 function (using simplegeneric.py).
635
637
636 * Fixed the append functionality of %set.
638 * Fixed the append functionality of %set.
637
639
638 2007-05-25 Ville Vainio <vivainio@gmail.com>
640 2007-05-25 Ville Vainio <vivainio@gmail.com>
639
641
640 * New magic: %rep (fetch / run old commands from history)
642 * New magic: %rep (fetch / run old commands from history)
641
643
642 * New extension: mglob (%mglob magic), for powerful glob / find /filter
644 * New extension: mglob (%mglob magic), for powerful glob / find /filter
643 like functionality
645 like functionality
644
646
645 % maghistory.py: %hist -g PATTERM greps the history for pattern
647 % maghistory.py: %hist -g PATTERM greps the history for pattern
646
648
647 2007-05-24 Walter Doerwald <walter@livinglogic.de>
649 2007-05-24 Walter Doerwald <walter@livinglogic.de>
648
650
649 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
651 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
650 browse the IPython input history
652 browse the IPython input history
651
653
652 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
654 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
653 (mapped to "i") can be used to put the object under the curser in the input
655 (mapped to "i") can be used to put the object under the curser in the input
654 line. pickinputattr (mapped to "I") does the same for the attribute under
656 line. pickinputattr (mapped to "I") does the same for the attribute under
655 the cursor.
657 the cursor.
656
658
657 2007-05-24 Ville Vainio <vivainio@gmail.com>
659 2007-05-24 Ville Vainio <vivainio@gmail.com>
658
660
659 * Grand magic cleansing (changeset [2380]):
661 * Grand magic cleansing (changeset [2380]):
660
662
661 * Introduce ipy_legacy.py where the following magics were
663 * Introduce ipy_legacy.py where the following magics were
662 moved:
664 moved:
663
665
664 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
666 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
665
667
666 If you need them, either use default profile or "import ipy_legacy"
668 If you need them, either use default profile or "import ipy_legacy"
667 in your ipy_user_conf.py
669 in your ipy_user_conf.py
668
670
669 * Move sh and scipy profile to Extensions from UserConfig. this implies
671 * Move sh and scipy profile to Extensions from UserConfig. this implies
670 you should not edit them, but you don't need to run %upgrade when
672 you should not edit them, but you don't need to run %upgrade when
671 upgrading IPython anymore.
673 upgrading IPython anymore.
672
674
673 * %hist/%history now operates in "raw" mode by default. To get the old
675 * %hist/%history now operates in "raw" mode by default. To get the old
674 behaviour, run '%hist -n' (native mode).
676 behaviour, run '%hist -n' (native mode).
675
677
676 * split ipy_stock_completers.py to ipy_stock_completers.py and
678 * split ipy_stock_completers.py to ipy_stock_completers.py and
677 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
679 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
678 installed as default.
680 installed as default.
679
681
680 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
682 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
681 handling.
683 handling.
682
684
683 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
685 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
684 input if readline is available.
686 input if readline is available.
685
687
686 2007-05-23 Ville Vainio <vivainio@gmail.com>
688 2007-05-23 Ville Vainio <vivainio@gmail.com>
687
689
688 * macro.py: %store uses __getstate__ properly
690 * macro.py: %store uses __getstate__ properly
689
691
690 * exesetup.py: added new setup script for creating
692 * exesetup.py: added new setup script for creating
691 standalone IPython executables with py2exe (i.e.
693 standalone IPython executables with py2exe (i.e.
692 no python installation required).
694 no python installation required).
693
695
694 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
696 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
695 its place.
697 its place.
696
698
697 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
699 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
698
700
699 2007-05-21 Ville Vainio <vivainio@gmail.com>
701 2007-05-21 Ville Vainio <vivainio@gmail.com>
700
702
701 * platutil_win32.py (set_term_title): handle
703 * platutil_win32.py (set_term_title): handle
702 failure of 'title' system call properly.
704 failure of 'title' system call properly.
703
705
704 2007-05-17 Walter Doerwald <walter@livinglogic.de>
706 2007-05-17 Walter Doerwald <walter@livinglogic.de>
705
707
706 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
708 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
707 (Bug detected by Paul Mueller).
709 (Bug detected by Paul Mueller).
708
710
709 2007-05-16 Ville Vainio <vivainio@gmail.com>
711 2007-05-16 Ville Vainio <vivainio@gmail.com>
710
712
711 * ipy_profile_sci.py, ipython_win_post_install.py: Create
713 * ipy_profile_sci.py, ipython_win_post_install.py: Create
712 new "sci" profile, effectively a modern version of the old
714 new "sci" profile, effectively a modern version of the old
713 "scipy" profile (which is now slated for deprecation).
715 "scipy" profile (which is now slated for deprecation).
714
716
715 2007-05-15 Ville Vainio <vivainio@gmail.com>
717 2007-05-15 Ville Vainio <vivainio@gmail.com>
716
718
717 * pycolorize.py, pycolor.1: Paul Mueller's patches that
719 * pycolorize.py, pycolor.1: Paul Mueller's patches that
718 make pycolorize read input from stdin when run without arguments.
720 make pycolorize read input from stdin when run without arguments.
719
721
720 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
722 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
721
723
722 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
724 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
723 it in sh profile (instead of ipy_system_conf.py).
725 it in sh profile (instead of ipy_system_conf.py).
724
726
725 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
727 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
726 aliases are now lower case on windows (MyCommand.exe => mycommand).
728 aliases are now lower case on windows (MyCommand.exe => mycommand).
727
729
728 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
730 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
729 Macros are now callable objects that inherit from ipapi.IPyAutocall,
731 Macros are now callable objects that inherit from ipapi.IPyAutocall,
730 i.e. get autocalled regardless of system autocall setting.
732 i.e. get autocalled regardless of system autocall setting.
731
733
732 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
734 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
733
735
734 * IPython/rlineimpl.py: check for clear_history in readline and
736 * IPython/rlineimpl.py: check for clear_history in readline and
735 make it a dummy no-op if not available. This function isn't
737 make it a dummy no-op if not available. This function isn't
736 guaranteed to be in the API and appeared in Python 2.4, so we need
738 guaranteed to be in the API and appeared in Python 2.4, so we need
737 to check it ourselves. Also, clean up this file quite a bit.
739 to check it ourselves. Also, clean up this file quite a bit.
738
740
739 * ipython.1: update man page and full manual with information
741 * ipython.1: update man page and full manual with information
740 about threads (remove outdated warning). Closes #151.
742 about threads (remove outdated warning). Closes #151.
741
743
742 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
744 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
743
745
744 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
746 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
745 in trunk (note that this made it into the 0.8.1 release already,
747 in trunk (note that this made it into the 0.8.1 release already,
746 but the changelogs didn't get coordinated). Many thanks to Gael
748 but the changelogs didn't get coordinated). Many thanks to Gael
747 Varoquaux <gael.varoquaux-AT-normalesup.org>
749 Varoquaux <gael.varoquaux-AT-normalesup.org>
748
750
749 2007-05-09 *** Released version 0.8.1
751 2007-05-09 *** Released version 0.8.1
750
752
751 2007-05-10 Walter Doerwald <walter@livinglogic.de>
753 2007-05-10 Walter Doerwald <walter@livinglogic.de>
752
754
753 * IPython/Extensions/igrid.py: Incorporate html help into
755 * IPython/Extensions/igrid.py: Incorporate html help into
754 the module, so we don't have to search for the file.
756 the module, so we don't have to search for the file.
755
757
756 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
758 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
757
759
758 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
760 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
759
761
760 2007-04-30 Ville Vainio <vivainio@gmail.com>
762 2007-04-30 Ville Vainio <vivainio@gmail.com>
761
763
762 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
764 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
763 user has illegal (non-ascii) home directory name
765 user has illegal (non-ascii) home directory name
764
766
765 2007-04-27 Ville Vainio <vivainio@gmail.com>
767 2007-04-27 Ville Vainio <vivainio@gmail.com>
766
768
767 * platutils_win32.py: implement set_term_title for windows
769 * platutils_win32.py: implement set_term_title for windows
768
770
769 * Update version number
771 * Update version number
770
772
771 * ipy_profile_sh.py: more informative prompt (2 dir levels)
773 * ipy_profile_sh.py: more informative prompt (2 dir levels)
772
774
773 2007-04-26 Walter Doerwald <walter@livinglogic.de>
775 2007-04-26 Walter Doerwald <walter@livinglogic.de>
774
776
775 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
777 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
776 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
778 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
777 bug discovered by Ville).
779 bug discovered by Ville).
778
780
779 2007-04-26 Ville Vainio <vivainio@gmail.com>
781 2007-04-26 Ville Vainio <vivainio@gmail.com>
780
782
781 * Extensions/ipy_completers.py: Olivier's module completer now
783 * Extensions/ipy_completers.py: Olivier's module completer now
782 saves the list of root modules if it takes > 4 secs on the first run.
784 saves the list of root modules if it takes > 4 secs on the first run.
783
785
784 * Magic.py (%rehashx): %rehashx now clears the completer cache
786 * Magic.py (%rehashx): %rehashx now clears the completer cache
785
787
786
788
787 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
789 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
788
790
789 * ipython.el: fix incorrect color scheme, reported by Stefan.
791 * ipython.el: fix incorrect color scheme, reported by Stefan.
790 Closes #149.
792 Closes #149.
791
793
792 * IPython/PyColorize.py (Parser.format2): fix state-handling
794 * IPython/PyColorize.py (Parser.format2): fix state-handling
793 logic. I still don't like how that code handles state, but at
795 logic. I still don't like how that code handles state, but at
794 least now it should be correct, if inelegant. Closes #146.
796 least now it should be correct, if inelegant. Closes #146.
795
797
796 2007-04-25 Ville Vainio <vivainio@gmail.com>
798 2007-04-25 Ville Vainio <vivainio@gmail.com>
797
799
798 * Extensions/ipy_which.py: added extension for %which magic, works
800 * Extensions/ipy_which.py: added extension for %which magic, works
799 a lot like unix 'which' but also finds and expands aliases, and
801 a lot like unix 'which' but also finds and expands aliases, and
800 allows wildcards.
802 allows wildcards.
801
803
802 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
804 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
803 as opposed to returning nothing.
805 as opposed to returning nothing.
804
806
805 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
807 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
806 ipy_stock_completers on default profile, do import on sh profile.
808 ipy_stock_completers on default profile, do import on sh profile.
807
809
808 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
810 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
809
811
810 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
812 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
811 like ipython.py foo.py which raised a IndexError.
813 like ipython.py foo.py which raised a IndexError.
812
814
813 2007-04-21 Ville Vainio <vivainio@gmail.com>
815 2007-04-21 Ville Vainio <vivainio@gmail.com>
814
816
815 * Extensions/ipy_extutil.py: added extension to manage other ipython
817 * Extensions/ipy_extutil.py: added extension to manage other ipython
816 extensions. Now only supports 'ls' == list extensions.
818 extensions. Now only supports 'ls' == list extensions.
817
819
818 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
820 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
819
821
820 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
822 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
821 would prevent use of the exception system outside of a running
823 would prevent use of the exception system outside of a running
822 IPython instance.
824 IPython instance.
823
825
824 2007-04-20 Ville Vainio <vivainio@gmail.com>
826 2007-04-20 Ville Vainio <vivainio@gmail.com>
825
827
826 * Extensions/ipy_render.py: added extension for easy
828 * Extensions/ipy_render.py: added extension for easy
827 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
829 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
828 'Iptl' template notation,
830 'Iptl' template notation,
829
831
830 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
832 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
831 safer & faster 'import' completer.
833 safer & faster 'import' completer.
832
834
833 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
835 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
834 and _ip.defalias(name, command).
836 and _ip.defalias(name, command).
835
837
836 * Extensions/ipy_exportdb.py: New extension for exporting all the
838 * Extensions/ipy_exportdb.py: New extension for exporting all the
837 %store'd data in a portable format (normal ipapi calls like
839 %store'd data in a portable format (normal ipapi calls like
838 defmacro() etc.)
840 defmacro() etc.)
839
841
840 2007-04-19 Ville Vainio <vivainio@gmail.com>
842 2007-04-19 Ville Vainio <vivainio@gmail.com>
841
843
842 * upgrade_dir.py: skip junk files like *.pyc
844 * upgrade_dir.py: skip junk files like *.pyc
843
845
844 * Release.py: version number to 0.8.1
846 * Release.py: version number to 0.8.1
845
847
846 2007-04-18 Ville Vainio <vivainio@gmail.com>
848 2007-04-18 Ville Vainio <vivainio@gmail.com>
847
849
848 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
850 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
849 and later on win32.
851 and later on win32.
850
852
851 2007-04-16 Ville Vainio <vivainio@gmail.com>
853 2007-04-16 Ville Vainio <vivainio@gmail.com>
852
854
853 * iplib.py (showtraceback): Do not crash when running w/o readline.
855 * iplib.py (showtraceback): Do not crash when running w/o readline.
854
856
855 2007-04-12 Walter Doerwald <walter@livinglogic.de>
857 2007-04-12 Walter Doerwald <walter@livinglogic.de>
856
858
857 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
859 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
858 sorted (case sensitive with files and dirs mixed).
860 sorted (case sensitive with files and dirs mixed).
859
861
860 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
862 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
861
863
862 * IPython/Release.py (version): Open trunk for 0.8.1 development.
864 * IPython/Release.py (version): Open trunk for 0.8.1 development.
863
865
864 2007-04-10 *** Released version 0.8.0
866 2007-04-10 *** Released version 0.8.0
865
867
866 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
868 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
867
869
868 * Tag 0.8.0 for release.
870 * Tag 0.8.0 for release.
869
871
870 * IPython/iplib.py (reloadhist): add API function to cleanly
872 * IPython/iplib.py (reloadhist): add API function to cleanly
871 reload the readline history, which was growing inappropriately on
873 reload the readline history, which was growing inappropriately on
872 every %run call.
874 every %run call.
873
875
874 * win32_manual_post_install.py (run): apply last part of Nicolas
876 * win32_manual_post_install.py (run): apply last part of Nicolas
875 Pernetty's patch (I'd accidentally applied it in a different
877 Pernetty's patch (I'd accidentally applied it in a different
876 directory and this particular file didn't get patched).
878 directory and this particular file didn't get patched).
877
879
878 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
880 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
879
881
880 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
882 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
881 find the main thread id and use the proper API call. Thanks to
883 find the main thread id and use the proper API call. Thanks to
882 Stefan for the fix.
884 Stefan for the fix.
883
885
884 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
886 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
885 unit tests to reflect fixed ticket #52, and add more tests sent by
887 unit tests to reflect fixed ticket #52, and add more tests sent by
886 him.
888 him.
887
889
888 * IPython/iplib.py (raw_input): restore the readline completer
890 * IPython/iplib.py (raw_input): restore the readline completer
889 state on every input, in case third-party code messed it up.
891 state on every input, in case third-party code messed it up.
890 (_prefilter): revert recent addition of early-escape checks which
892 (_prefilter): revert recent addition of early-escape checks which
891 prevent many valid alias calls from working.
893 prevent many valid alias calls from working.
892
894
893 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
895 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
894 flag for sigint handler so we don't run a full signal() call on
896 flag for sigint handler so we don't run a full signal() call on
895 each runcode access.
897 each runcode access.
896
898
897 * IPython/Magic.py (magic_whos): small improvement to diagnostic
899 * IPython/Magic.py (magic_whos): small improvement to diagnostic
898 message.
900 message.
899
901
900 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
902 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
901
903
902 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
904 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
903 asynchronous exceptions working, i.e., Ctrl-C can actually
905 asynchronous exceptions working, i.e., Ctrl-C can actually
904 interrupt long-running code in the multithreaded shells.
906 interrupt long-running code in the multithreaded shells.
905
907
906 This is using Tomer Filiba's great ctypes-based trick:
908 This is using Tomer Filiba's great ctypes-based trick:
907 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
909 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
908 this in the past, but hadn't been able to make it work before. So
910 this in the past, but hadn't been able to make it work before. So
909 far it looks like it's actually running, but this needs more
911 far it looks like it's actually running, but this needs more
910 testing. If it really works, I'll be *very* happy, and we'll owe
912 testing. If it really works, I'll be *very* happy, and we'll owe
911 a huge thank you to Tomer. My current implementation is ugly,
913 a huge thank you to Tomer. My current implementation is ugly,
912 hackish and uses nasty globals, but I don't want to try and clean
914 hackish and uses nasty globals, but I don't want to try and clean
913 anything up until we know if it actually works.
915 anything up until we know if it actually works.
914
916
915 NOTE: this feature needs ctypes to work. ctypes is included in
917 NOTE: this feature needs ctypes to work. ctypes is included in
916 Python2.5, but 2.4 users will need to manually install it. This
918 Python2.5, but 2.4 users will need to manually install it. This
917 feature makes multi-threaded shells so much more usable that it's
919 feature makes multi-threaded shells so much more usable that it's
918 a minor price to pay (ctypes is very easy to install, already a
920 a minor price to pay (ctypes is very easy to install, already a
919 requirement for win32 and available in major linux distros).
921 requirement for win32 and available in major linux distros).
920
922
921 2007-04-04 Ville Vainio <vivainio@gmail.com>
923 2007-04-04 Ville Vainio <vivainio@gmail.com>
922
924
923 * Extensions/ipy_completers.py, ipy_stock_completers.py:
925 * Extensions/ipy_completers.py, ipy_stock_completers.py:
924 Moved implementations of 'bundled' completers to ipy_completers.py,
926 Moved implementations of 'bundled' completers to ipy_completers.py,
925 they are only enabled in ipy_stock_completers.py.
927 they are only enabled in ipy_stock_completers.py.
926
928
927 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
929 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
928
930
929 * IPython/PyColorize.py (Parser.format2): Fix identation of
931 * IPython/PyColorize.py (Parser.format2): Fix identation of
930 colorzied output and return early if color scheme is NoColor, to
932 colorzied output and return early if color scheme is NoColor, to
931 avoid unnecessary and expensive tokenization. Closes #131.
933 avoid unnecessary and expensive tokenization. Closes #131.
932
934
933 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
935 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
934
936
935 * IPython/Debugger.py: disable the use of pydb version 1.17. It
937 * IPython/Debugger.py: disable the use of pydb version 1.17. It
936 has a critical bug (a missing import that makes post-mortem not
938 has a critical bug (a missing import that makes post-mortem not
937 work at all). Unfortunately as of this time, this is the version
939 work at all). Unfortunately as of this time, this is the version
938 shipped with Ubuntu Edgy, so quite a few people have this one. I
940 shipped with Ubuntu Edgy, so quite a few people have this one. I
939 hope Edgy will update to a more recent package.
941 hope Edgy will update to a more recent package.
940
942
941 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
943 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
942
944
943 * IPython/iplib.py (_prefilter): close #52, second part of a patch
945 * IPython/iplib.py (_prefilter): close #52, second part of a patch
944 set by Stefan (only the first part had been applied before).
946 set by Stefan (only the first part had been applied before).
945
947
946 * IPython/Extensions/ipy_stock_completers.py (module_completer):
948 * IPython/Extensions/ipy_stock_completers.py (module_completer):
947 remove usage of the dangerous pkgutil.walk_packages(). See
949 remove usage of the dangerous pkgutil.walk_packages(). See
948 details in comments left in the code.
950 details in comments left in the code.
949
951
950 * IPython/Magic.py (magic_whos): add support for numpy arrays
952 * IPython/Magic.py (magic_whos): add support for numpy arrays
951 similar to what we had for Numeric.
953 similar to what we had for Numeric.
952
954
953 * IPython/completer.py (IPCompleter.complete): extend the
955 * IPython/completer.py (IPCompleter.complete): extend the
954 complete() call API to support completions by other mechanisms
956 complete() call API to support completions by other mechanisms
955 than readline. Closes #109.
957 than readline. Closes #109.
956
958
957 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
959 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
958 protect against a bug in Python's execfile(). Closes #123.
960 protect against a bug in Python's execfile(). Closes #123.
959
961
960 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
962 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
961
963
962 * IPython/iplib.py (split_user_input): ensure that when splitting
964 * IPython/iplib.py (split_user_input): ensure that when splitting
963 user input, the part that can be treated as a python name is pure
965 user input, the part that can be treated as a python name is pure
964 ascii (Python identifiers MUST be pure ascii). Part of the
966 ascii (Python identifiers MUST be pure ascii). Part of the
965 ongoing Unicode support work.
967 ongoing Unicode support work.
966
968
967 * IPython/Prompts.py (prompt_specials_color): Add \N for the
969 * IPython/Prompts.py (prompt_specials_color): Add \N for the
968 actual prompt number, without any coloring. This allows users to
970 actual prompt number, without any coloring. This allows users to
969 produce numbered prompts with their own colors. Added after a
971 produce numbered prompts with their own colors. Added after a
970 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
972 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
971
973
972 2007-03-31 Walter Doerwald <walter@livinglogic.de>
974 2007-03-31 Walter Doerwald <walter@livinglogic.de>
973
975
974 * IPython/Extensions/igrid.py: Map the return key
976 * IPython/Extensions/igrid.py: Map the return key
975 to enter() and shift-return to enterattr().
977 to enter() and shift-return to enterattr().
976
978
977 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
979 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
978
980
979 * IPython/Magic.py (magic_psearch): add unicode support by
981 * IPython/Magic.py (magic_psearch): add unicode support by
980 encoding to ascii the input, since this routine also only deals
982 encoding to ascii the input, since this routine also only deals
981 with valid Python names. Fixes a bug reported by Stefan.
983 with valid Python names. Fixes a bug reported by Stefan.
982
984
983 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
985 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
984
986
985 * IPython/Magic.py (_inspect): convert unicode input into ascii
987 * IPython/Magic.py (_inspect): convert unicode input into ascii
986 before trying to evaluate it as a Python identifier. This fixes a
988 before trying to evaluate it as a Python identifier. This fixes a
987 problem that the new unicode support had introduced when analyzing
989 problem that the new unicode support had introduced when analyzing
988 long definition lines for functions.
990 long definition lines for functions.
989
991
990 2007-03-24 Walter Doerwald <walter@livinglogic.de>
992 2007-03-24 Walter Doerwald <walter@livinglogic.de>
991
993
992 * IPython/Extensions/igrid.py: Fix picking. Using
994 * IPython/Extensions/igrid.py: Fix picking. Using
993 igrid with wxPython 2.6 and -wthread should work now.
995 igrid with wxPython 2.6 and -wthread should work now.
994 igrid.display() simply tries to create a frame without
996 igrid.display() simply tries to create a frame without
995 an application. Only if this fails an application is created.
997 an application. Only if this fails an application is created.
996
998
997 2007-03-23 Walter Doerwald <walter@livinglogic.de>
999 2007-03-23 Walter Doerwald <walter@livinglogic.de>
998
1000
999 * IPython/Extensions/path.py: Updated to version 2.2.
1001 * IPython/Extensions/path.py: Updated to version 2.2.
1000
1002
1001 2007-03-23 Ville Vainio <vivainio@gmail.com>
1003 2007-03-23 Ville Vainio <vivainio@gmail.com>
1002
1004
1003 * iplib.py: recursive alias expansion now works better, so that
1005 * iplib.py: recursive alias expansion now works better, so that
1004 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
1006 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
1005 doesn't trip up the process, if 'd' has been aliased to 'ls'.
1007 doesn't trip up the process, if 'd' has been aliased to 'ls'.
1006
1008
1007 * Extensions/ipy_gnuglobal.py added, provides %global magic
1009 * Extensions/ipy_gnuglobal.py added, provides %global magic
1008 for users of http://www.gnu.org/software/global
1010 for users of http://www.gnu.org/software/global
1009
1011
1010 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
1012 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
1011 Closes #52. Patch by Stefan van der Walt.
1013 Closes #52. Patch by Stefan van der Walt.
1012
1014
1013 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
1015 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
1014
1016
1015 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
1017 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
1016 respect the __file__ attribute when using %run. Thanks to a bug
1018 respect the __file__ attribute when using %run. Thanks to a bug
1017 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
1019 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
1018
1020
1019 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
1021 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
1020
1022
1021 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
1023 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
1022 input. Patch sent by Stefan.
1024 input. Patch sent by Stefan.
1023
1025
1024 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1026 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1025 * IPython/Extensions/ipy_stock_completer.py
1027 * IPython/Extensions/ipy_stock_completer.py
1026 shlex_split, fix bug in shlex_split. len function
1028 shlex_split, fix bug in shlex_split. len function
1027 call was missing an if statement. Caused shlex_split to
1029 call was missing an if statement. Caused shlex_split to
1028 sometimes return "" as last element.
1030 sometimes return "" as last element.
1029
1031
1030 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
1032 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
1031
1033
1032 * IPython/completer.py
1034 * IPython/completer.py
1033 (IPCompleter.file_matches.single_dir_expand): fix a problem
1035 (IPCompleter.file_matches.single_dir_expand): fix a problem
1034 reported by Stefan, where directories containign a single subdir
1036 reported by Stefan, where directories containign a single subdir
1035 would be completed too early.
1037 would be completed too early.
1036
1038
1037 * IPython/Shell.py (_load_pylab): Make the execution of 'from
1039 * IPython/Shell.py (_load_pylab): Make the execution of 'from
1038 pylab import *' when -pylab is given be optional. A new flag,
1040 pylab import *' when -pylab is given be optional. A new flag,
1039 pylab_import_all controls this behavior, the default is True for
1041 pylab_import_all controls this behavior, the default is True for
1040 backwards compatibility.
1042 backwards compatibility.
1041
1043
1042 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
1044 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
1043 modified) R. Bernstein's patch for fully syntax highlighted
1045 modified) R. Bernstein's patch for fully syntax highlighted
1044 tracebacks. The functionality is also available under ultraTB for
1046 tracebacks. The functionality is also available under ultraTB for
1045 non-ipython users (someone using ultraTB but outside an ipython
1047 non-ipython users (someone using ultraTB but outside an ipython
1046 session). They can select the color scheme by setting the
1048 session). They can select the color scheme by setting the
1047 module-level global DEFAULT_SCHEME. The highlight functionality
1049 module-level global DEFAULT_SCHEME. The highlight functionality
1048 also works when debugging.
1050 also works when debugging.
1049
1051
1050 * IPython/genutils.py (IOStream.close): small patch by
1052 * IPython/genutils.py (IOStream.close): small patch by
1051 R. Bernstein for improved pydb support.
1053 R. Bernstein for improved pydb support.
1052
1054
1053 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
1055 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
1054 DaveS <davls@telus.net> to improve support of debugging under
1056 DaveS <davls@telus.net> to improve support of debugging under
1055 NTEmacs, including improved pydb behavior.
1057 NTEmacs, including improved pydb behavior.
1056
1058
1057 * IPython/Magic.py (magic_prun): Fix saving of profile info for
1059 * IPython/Magic.py (magic_prun): Fix saving of profile info for
1058 Python 2.5, where the stats object API changed a little. Thanks
1060 Python 2.5, where the stats object API changed a little. Thanks
1059 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
1061 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
1060
1062
1061 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
1063 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
1062 Pernetty's patch to improve support for (X)Emacs under Win32.
1064 Pernetty's patch to improve support for (X)Emacs under Win32.
1063
1065
1064 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
1066 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
1065
1067
1066 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
1068 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
1067 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
1069 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
1068 a report by Nik Tautenhahn.
1070 a report by Nik Tautenhahn.
1069
1071
1070 2007-03-16 Walter Doerwald <walter@livinglogic.de>
1072 2007-03-16 Walter Doerwald <walter@livinglogic.de>
1071
1073
1072 * setup.py: Add the igrid help files to the list of data files
1074 * setup.py: Add the igrid help files to the list of data files
1073 to be installed alongside igrid.
1075 to be installed alongside igrid.
1074 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
1076 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
1075 Show the input object of the igrid browser as the window tile.
1077 Show the input object of the igrid browser as the window tile.
1076 Show the object the cursor is on in the statusbar.
1078 Show the object the cursor is on in the statusbar.
1077
1079
1078 2007-03-15 Ville Vainio <vivainio@gmail.com>
1080 2007-03-15 Ville Vainio <vivainio@gmail.com>
1079
1081
1080 * Extensions/ipy_stock_completers.py: Fixed exception
1082 * Extensions/ipy_stock_completers.py: Fixed exception
1081 on mismatching quotes in %run completer. Patch by
1083 on mismatching quotes in %run completer. Patch by
1082 Jorgen Stenarson. Closes #127.
1084 Jorgen Stenarson. Closes #127.
1083
1085
1084 2007-03-14 Ville Vainio <vivainio@gmail.com>
1086 2007-03-14 Ville Vainio <vivainio@gmail.com>
1085
1087
1086 * Extensions/ext_rehashdir.py: Do not do auto_alias
1088 * Extensions/ext_rehashdir.py: Do not do auto_alias
1087 in %rehashdir, it clobbers %store'd aliases.
1089 in %rehashdir, it clobbers %store'd aliases.
1088
1090
1089 * UserConfig/ipy_profile_sh.py: envpersist.py extension
1091 * UserConfig/ipy_profile_sh.py: envpersist.py extension
1090 (beefed up %env) imported for sh profile.
1092 (beefed up %env) imported for sh profile.
1091
1093
1092 2007-03-10 Walter Doerwald <walter@livinglogic.de>
1094 2007-03-10 Walter Doerwald <walter@livinglogic.de>
1093
1095
1094 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
1096 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
1095 as the default browser.
1097 as the default browser.
1096 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
1098 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
1097 As igrid displays all attributes it ever encounters, fetch() (which has
1099 As igrid displays all attributes it ever encounters, fetch() (which has
1098 been renamed to _fetch()) doesn't have to recalculate the display attributes
1100 been renamed to _fetch()) doesn't have to recalculate the display attributes
1099 every time a new item is fetched. This should speed up scrolling.
1101 every time a new item is fetched. This should speed up scrolling.
1100
1102
1101 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
1103 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
1102
1104
1103 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
1105 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
1104 Schmolck's recently reported tab-completion bug (my previous one
1106 Schmolck's recently reported tab-completion bug (my previous one
1105 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
1107 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
1106
1108
1107 2007-03-09 Walter Doerwald <walter@livinglogic.de>
1109 2007-03-09 Walter Doerwald <walter@livinglogic.de>
1108
1110
1109 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
1111 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
1110 Close help window if exiting igrid.
1112 Close help window if exiting igrid.
1111
1113
1112 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1114 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1113
1115
1114 * IPython/Extensions/ipy_defaults.py: Check if readline is available
1116 * IPython/Extensions/ipy_defaults.py: Check if readline is available
1115 before calling functions from readline.
1117 before calling functions from readline.
1116
1118
1117 2007-03-02 Walter Doerwald <walter@livinglogic.de>
1119 2007-03-02 Walter Doerwald <walter@livinglogic.de>
1118
1120
1119 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
1121 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
1120 igrid is a wxPython-based display object for ipipe. If your system has
1122 igrid is a wxPython-based display object for ipipe. If your system has
1121 wx installed igrid will be the default display. Without wx ipipe falls
1123 wx installed igrid will be the default display. Without wx ipipe falls
1122 back to ibrowse (which needs curses). If no curses is installed ipipe
1124 back to ibrowse (which needs curses). If no curses is installed ipipe
1123 falls back to idump.
1125 falls back to idump.
1124
1126
1125 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
1127 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
1126
1128
1127 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
1129 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
1128 my changes from yesterday, they introduced bugs. Will reactivate
1130 my changes from yesterday, they introduced bugs. Will reactivate
1129 once I get a correct solution, which will be much easier thanks to
1131 once I get a correct solution, which will be much easier thanks to
1130 Dan Milstein's new prefilter test suite.
1132 Dan Milstein's new prefilter test suite.
1131
1133
1132 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
1134 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
1133
1135
1134 * IPython/iplib.py (split_user_input): fix input splitting so we
1136 * IPython/iplib.py (split_user_input): fix input splitting so we
1135 don't attempt attribute accesses on things that can't possibly be
1137 don't attempt attribute accesses on things that can't possibly be
1136 valid Python attributes. After a bug report by Alex Schmolck.
1138 valid Python attributes. After a bug report by Alex Schmolck.
1137 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
1139 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
1138 %magic with explicit % prefix.
1140 %magic with explicit % prefix.
1139
1141
1140 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
1142 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
1141
1143
1142 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
1144 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
1143 avoid a DeprecationWarning from GTK.
1145 avoid a DeprecationWarning from GTK.
1144
1146
1145 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
1147 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
1146
1148
1147 * IPython/genutils.py (clock): I modified clock() to return total
1149 * IPython/genutils.py (clock): I modified clock() to return total
1148 time, user+system. This is a more commonly needed metric. I also
1150 time, user+system. This is a more commonly needed metric. I also
1149 introduced the new clocku/clocks to get only user/system time if
1151 introduced the new clocku/clocks to get only user/system time if
1150 one wants those instead.
1152 one wants those instead.
1151
1153
1152 ***WARNING: API CHANGE*** clock() used to return only user time,
1154 ***WARNING: API CHANGE*** clock() used to return only user time,
1153 so if you want exactly the same results as before, use clocku
1155 so if you want exactly the same results as before, use clocku
1154 instead.
1156 instead.
1155
1157
1156 2007-02-22 Ville Vainio <vivainio@gmail.com>
1158 2007-02-22 Ville Vainio <vivainio@gmail.com>
1157
1159
1158 * IPython/Extensions/ipy_p4.py: Extension for improved
1160 * IPython/Extensions/ipy_p4.py: Extension for improved
1159 p4 (perforce version control system) experience.
1161 p4 (perforce version control system) experience.
1160 Adds %p4 magic with p4 command completion and
1162 Adds %p4 magic with p4 command completion and
1161 automatic -G argument (marshall output as python dict)
1163 automatic -G argument (marshall output as python dict)
1162
1164
1163 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1165 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1164
1166
1165 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1167 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1166 stop marks.
1168 stop marks.
1167 (ClearingMixin): a simple mixin to easily make a Demo class clear
1169 (ClearingMixin): a simple mixin to easily make a Demo class clear
1168 the screen in between blocks and have empty marquees. The
1170 the screen in between blocks and have empty marquees. The
1169 ClearDemo and ClearIPDemo classes that use it are included.
1171 ClearDemo and ClearIPDemo classes that use it are included.
1170
1172
1171 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1173 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1172
1174
1173 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1175 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1174 protect against exceptions at Python shutdown time. Patch
1176 protect against exceptions at Python shutdown time. Patch
1175 sumbmitted to upstream.
1177 sumbmitted to upstream.
1176
1178
1177 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1179 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1178
1180
1179 * IPython/Extensions/ibrowse.py: If entering the first object level
1181 * IPython/Extensions/ibrowse.py: If entering the first object level
1180 (i.e. the object for which the browser has been started) fails,
1182 (i.e. the object for which the browser has been started) fails,
1181 now the error is raised directly (aborting the browser) instead of
1183 now the error is raised directly (aborting the browser) instead of
1182 running into an empty levels list later.
1184 running into an empty levels list later.
1183
1185
1184 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1186 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1185
1187
1186 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1188 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1187 for the noitem object.
1189 for the noitem object.
1188
1190
1189 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1191 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1190
1192
1191 * IPython/completer.py (Completer.attr_matches): Fix small
1193 * IPython/completer.py (Completer.attr_matches): Fix small
1192 tab-completion bug with Enthought Traits objects with units.
1194 tab-completion bug with Enthought Traits objects with units.
1193 Thanks to a bug report by Tom Denniston
1195 Thanks to a bug report by Tom Denniston
1194 <tom.denniston-AT-alum.dartmouth.org>.
1196 <tom.denniston-AT-alum.dartmouth.org>.
1195
1197
1196 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1198 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1197
1199
1198 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1200 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1199 bug where only .ipy or .py would be completed. Once the first
1201 bug where only .ipy or .py would be completed. Once the first
1200 argument to %run has been given, all completions are valid because
1202 argument to %run has been given, all completions are valid because
1201 they are the arguments to the script, which may well be non-python
1203 they are the arguments to the script, which may well be non-python
1202 filenames.
1204 filenames.
1203
1205
1204 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1206 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1205 to irunner to allow it to correctly support real doctesting of
1207 to irunner to allow it to correctly support real doctesting of
1206 out-of-process ipython code.
1208 out-of-process ipython code.
1207
1209
1208 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1210 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1209 title an option (-noterm_title) because it completely breaks
1211 title an option (-noterm_title) because it completely breaks
1210 doctesting.
1212 doctesting.
1211
1213
1212 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1214 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1213
1215
1214 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1216 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1215
1217
1216 * IPython/irunner.py (main): fix small bug where extensions were
1218 * IPython/irunner.py (main): fix small bug where extensions were
1217 not being correctly recognized.
1219 not being correctly recognized.
1218
1220
1219 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1221 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1220
1222
1221 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1223 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1222 a string containing a single line yields the string itself as the
1224 a string containing a single line yields the string itself as the
1223 only item.
1225 only item.
1224
1226
1225 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1227 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1226 object if it's the same as the one on the last level (This avoids
1228 object if it's the same as the one on the last level (This avoids
1227 infinite recursion for one line strings).
1229 infinite recursion for one line strings).
1228
1230
1229 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1231 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1230
1232
1231 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1233 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1232 all output streams before printing tracebacks. This ensures that
1234 all output streams before printing tracebacks. This ensures that
1233 user output doesn't end up interleaved with traceback output.
1235 user output doesn't end up interleaved with traceback output.
1234
1236
1235 2007-01-10 Ville Vainio <vivainio@gmail.com>
1237 2007-01-10 Ville Vainio <vivainio@gmail.com>
1236
1238
1237 * Extensions/envpersist.py: Turbocharged %env that remembers
1239 * Extensions/envpersist.py: Turbocharged %env that remembers
1238 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1240 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1239 "%env VISUAL=jed".
1241 "%env VISUAL=jed".
1240
1242
1241 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1243 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1242
1244
1243 * IPython/iplib.py (showtraceback): ensure that we correctly call
1245 * IPython/iplib.py (showtraceback): ensure that we correctly call
1244 custom handlers in all cases (some with pdb were slipping through,
1246 custom handlers in all cases (some with pdb were slipping through,
1245 but I'm not exactly sure why).
1247 but I'm not exactly sure why).
1246
1248
1247 * IPython/Debugger.py (Tracer.__init__): added new class to
1249 * IPython/Debugger.py (Tracer.__init__): added new class to
1248 support set_trace-like usage of IPython's enhanced debugger.
1250 support set_trace-like usage of IPython's enhanced debugger.
1249
1251
1250 2006-12-24 Ville Vainio <vivainio@gmail.com>
1252 2006-12-24 Ville Vainio <vivainio@gmail.com>
1251
1253
1252 * ipmaker.py: more informative message when ipy_user_conf
1254 * ipmaker.py: more informative message when ipy_user_conf
1253 import fails (suggest running %upgrade).
1255 import fails (suggest running %upgrade).
1254
1256
1255 * tools/run_ipy_in_profiler.py: Utility to see where
1257 * tools/run_ipy_in_profiler.py: Utility to see where
1256 the time during IPython startup is spent.
1258 the time during IPython startup is spent.
1257
1259
1258 2006-12-20 Ville Vainio <vivainio@gmail.com>
1260 2006-12-20 Ville Vainio <vivainio@gmail.com>
1259
1261
1260 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1262 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1261
1263
1262 * ipapi.py: Add new ipapi method, expand_alias.
1264 * ipapi.py: Add new ipapi method, expand_alias.
1263
1265
1264 * Release.py: Bump up version to 0.7.4.svn
1266 * Release.py: Bump up version to 0.7.4.svn
1265
1267
1266 2006-12-17 Ville Vainio <vivainio@gmail.com>
1268 2006-12-17 Ville Vainio <vivainio@gmail.com>
1267
1269
1268 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1270 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1269 to work properly on posix too
1271 to work properly on posix too
1270
1272
1271 * Release.py: Update revnum (version is still just 0.7.3).
1273 * Release.py: Update revnum (version is still just 0.7.3).
1272
1274
1273 2006-12-15 Ville Vainio <vivainio@gmail.com>
1275 2006-12-15 Ville Vainio <vivainio@gmail.com>
1274
1276
1275 * scripts/ipython_win_post_install: create ipython.py in
1277 * scripts/ipython_win_post_install: create ipython.py in
1276 prefix + "/scripts".
1278 prefix + "/scripts".
1277
1279
1278 * Release.py: Update version to 0.7.3.
1280 * Release.py: Update version to 0.7.3.
1279
1281
1280 2006-12-14 Ville Vainio <vivainio@gmail.com>
1282 2006-12-14 Ville Vainio <vivainio@gmail.com>
1281
1283
1282 * scripts/ipython_win_post_install: Overwrite old shortcuts
1284 * scripts/ipython_win_post_install: Overwrite old shortcuts
1283 if they already exist
1285 if they already exist
1284
1286
1285 * Release.py: release 0.7.3rc2
1287 * Release.py: release 0.7.3rc2
1286
1288
1287 2006-12-13 Ville Vainio <vivainio@gmail.com>
1289 2006-12-13 Ville Vainio <vivainio@gmail.com>
1288
1290
1289 * Branch and update Release.py for 0.7.3rc1
1291 * Branch and update Release.py for 0.7.3rc1
1290
1292
1291 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1293 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1292
1294
1293 * IPython/Shell.py (IPShellWX): update for current WX naming
1295 * IPython/Shell.py (IPShellWX): update for current WX naming
1294 conventions, to avoid a deprecation warning with current WX
1296 conventions, to avoid a deprecation warning with current WX
1295 versions. Thanks to a report by Danny Shevitz.
1297 versions. Thanks to a report by Danny Shevitz.
1296
1298
1297 2006-12-12 Ville Vainio <vivainio@gmail.com>
1299 2006-12-12 Ville Vainio <vivainio@gmail.com>
1298
1300
1299 * ipmaker.py: apply david cournapeau's patch to make
1301 * ipmaker.py: apply david cournapeau's patch to make
1300 import_some work properly even when ipythonrc does
1302 import_some work properly even when ipythonrc does
1301 import_some on empty list (it was an old bug!).
1303 import_some on empty list (it was an old bug!).
1302
1304
1303 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1305 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1304 Add deprecation note to ipythonrc and a url to wiki
1306 Add deprecation note to ipythonrc and a url to wiki
1305 in ipy_user_conf.py
1307 in ipy_user_conf.py
1306
1308
1307
1309
1308 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1310 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1309 as if it was typed on IPython command prompt, i.e.
1311 as if it was typed on IPython command prompt, i.e.
1310 as IPython script.
1312 as IPython script.
1311
1313
1312 * example-magic.py, magic_grepl.py: remove outdated examples
1314 * example-magic.py, magic_grepl.py: remove outdated examples
1313
1315
1314 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1316 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1315
1317
1316 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1318 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1317 is called before any exception has occurred.
1319 is called before any exception has occurred.
1318
1320
1319 2006-12-08 Ville Vainio <vivainio@gmail.com>
1321 2006-12-08 Ville Vainio <vivainio@gmail.com>
1320
1322
1321 * Extensions/ipy_stock_completers.py: fix cd completer
1323 * Extensions/ipy_stock_completers.py: fix cd completer
1322 to translate /'s to \'s again.
1324 to translate /'s to \'s again.
1323
1325
1324 * completer.py: prevent traceback on file completions w/
1326 * completer.py: prevent traceback on file completions w/
1325 backslash.
1327 backslash.
1326
1328
1327 * Release.py: Update release number to 0.7.3b3 for release
1329 * Release.py: Update release number to 0.7.3b3 for release
1328
1330
1329 2006-12-07 Ville Vainio <vivainio@gmail.com>
1331 2006-12-07 Ville Vainio <vivainio@gmail.com>
1330
1332
1331 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1333 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1332 while executing external code. Provides more shell-like behaviour
1334 while executing external code. Provides more shell-like behaviour
1333 and overall better response to ctrl + C / ctrl + break.
1335 and overall better response to ctrl + C / ctrl + break.
1334
1336
1335 * tools/make_tarball.py: new script to create tarball straight from svn
1337 * tools/make_tarball.py: new script to create tarball straight from svn
1336 (setup.py sdist doesn't work on win32).
1338 (setup.py sdist doesn't work on win32).
1337
1339
1338 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1340 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1339 on dirnames with spaces and use the default completer instead.
1341 on dirnames with spaces and use the default completer instead.
1340
1342
1341 * Revision.py: Change version to 0.7.3b2 for release.
1343 * Revision.py: Change version to 0.7.3b2 for release.
1342
1344
1343 2006-12-05 Ville Vainio <vivainio@gmail.com>
1345 2006-12-05 Ville Vainio <vivainio@gmail.com>
1344
1346
1345 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1347 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1346 pydb patch 4 (rm debug printing, py 2.5 checking)
1348 pydb patch 4 (rm debug printing, py 2.5 checking)
1347
1349
1348 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1350 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1349 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1351 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1350 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1352 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1351 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1353 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1352 object the cursor was on before the refresh. The command "markrange" is
1354 object the cursor was on before the refresh. The command "markrange" is
1353 mapped to "%" now.
1355 mapped to "%" now.
1354 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1356 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1355
1357
1356 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1358 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1357
1359
1358 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1360 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1359 interactive debugger on the last traceback, without having to call
1361 interactive debugger on the last traceback, without having to call
1360 %pdb and rerun your code. Made minor changes in various modules,
1362 %pdb and rerun your code. Made minor changes in various modules,
1361 should automatically recognize pydb if available.
1363 should automatically recognize pydb if available.
1362
1364
1363 2006-11-28 Ville Vainio <vivainio@gmail.com>
1365 2006-11-28 Ville Vainio <vivainio@gmail.com>
1364
1366
1365 * completer.py: If the text start with !, show file completions
1367 * completer.py: If the text start with !, show file completions
1366 properly. This helps when trying to complete command name
1368 properly. This helps when trying to complete command name
1367 for shell escapes.
1369 for shell escapes.
1368
1370
1369 2006-11-27 Ville Vainio <vivainio@gmail.com>
1371 2006-11-27 Ville Vainio <vivainio@gmail.com>
1370
1372
1371 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1373 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1372 der Walt. Clean up svn and hg completers by using a common
1374 der Walt. Clean up svn and hg completers by using a common
1373 vcs_completer.
1375 vcs_completer.
1374
1376
1375 2006-11-26 Ville Vainio <vivainio@gmail.com>
1377 2006-11-26 Ville Vainio <vivainio@gmail.com>
1376
1378
1377 * Remove ipconfig and %config; you should use _ip.options structure
1379 * Remove ipconfig and %config; you should use _ip.options structure
1378 directly instead!
1380 directly instead!
1379
1381
1380 * genutils.py: add wrap_deprecated function for deprecating callables
1382 * genutils.py: add wrap_deprecated function for deprecating callables
1381
1383
1382 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1384 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1383 _ip.system instead. ipalias is redundant.
1385 _ip.system instead. ipalias is redundant.
1384
1386
1385 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1387 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1386 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1388 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1387 explicit.
1389 explicit.
1388
1390
1389 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1391 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1390 completer. Try it by entering 'hg ' and pressing tab.
1392 completer. Try it by entering 'hg ' and pressing tab.
1391
1393
1392 * macro.py: Give Macro a useful __repr__ method
1394 * macro.py: Give Macro a useful __repr__ method
1393
1395
1394 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1396 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1395
1397
1396 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1398 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1397 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1399 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1398 we don't get a duplicate ipipe module, where registration of the xrepr
1400 we don't get a duplicate ipipe module, where registration of the xrepr
1399 implementation for Text is useless.
1401 implementation for Text is useless.
1400
1402
1401 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1403 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1402
1404
1403 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1405 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1404
1406
1405 2006-11-24 Ville Vainio <vivainio@gmail.com>
1407 2006-11-24 Ville Vainio <vivainio@gmail.com>
1406
1408
1407 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1409 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1408 try to use "cProfile" instead of the slower pure python
1410 try to use "cProfile" instead of the slower pure python
1409 "profile"
1411 "profile"
1410
1412
1411 2006-11-23 Ville Vainio <vivainio@gmail.com>
1413 2006-11-23 Ville Vainio <vivainio@gmail.com>
1412
1414
1413 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1415 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1414 Qt+IPython+Designer link in documentation.
1416 Qt+IPython+Designer link in documentation.
1415
1417
1416 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1418 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1417 correct Pdb object to %pydb.
1419 correct Pdb object to %pydb.
1418
1420
1419
1421
1420 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1422 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1421 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1423 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1422 generic xrepr(), otherwise the list implementation would kick in.
1424 generic xrepr(), otherwise the list implementation would kick in.
1423
1425
1424 2006-11-21 Ville Vainio <vivainio@gmail.com>
1426 2006-11-21 Ville Vainio <vivainio@gmail.com>
1425
1427
1426 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1428 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1427 with one from UserConfig.
1429 with one from UserConfig.
1428
1430
1429 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1431 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1430 it was missing which broke the sh profile.
1432 it was missing which broke the sh profile.
1431
1433
1432 * completer.py: file completer now uses explicit '/' instead
1434 * completer.py: file completer now uses explicit '/' instead
1433 of os.path.join, expansion of 'foo' was broken on win32
1435 of os.path.join, expansion of 'foo' was broken on win32
1434 if there was one directory with name 'foobar'.
1436 if there was one directory with name 'foobar'.
1435
1437
1436 * A bunch of patches from Kirill Smelkov:
1438 * A bunch of patches from Kirill Smelkov:
1437
1439
1438 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1440 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1439
1441
1440 * [patch 7/9] Implement %page -r (page in raw mode) -
1442 * [patch 7/9] Implement %page -r (page in raw mode) -
1441
1443
1442 * [patch 5/9] ScientificPython webpage has moved
1444 * [patch 5/9] ScientificPython webpage has moved
1443
1445
1444 * [patch 4/9] The manual mentions %ds, should be %dhist
1446 * [patch 4/9] The manual mentions %ds, should be %dhist
1445
1447
1446 * [patch 3/9] Kill old bits from %prun doc.
1448 * [patch 3/9] Kill old bits from %prun doc.
1447
1449
1448 * [patch 1/9] Fix typos here and there.
1450 * [patch 1/9] Fix typos here and there.
1449
1451
1450 2006-11-08 Ville Vainio <vivainio@gmail.com>
1452 2006-11-08 Ville Vainio <vivainio@gmail.com>
1451
1453
1452 * completer.py (attr_matches): catch all exceptions raised
1454 * completer.py (attr_matches): catch all exceptions raised
1453 by eval of expr with dots.
1455 by eval of expr with dots.
1454
1456
1455 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1457 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1456
1458
1457 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1459 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1458 input if it starts with whitespace. This allows you to paste
1460 input if it starts with whitespace. This allows you to paste
1459 indented input from any editor without manually having to type in
1461 indented input from any editor without manually having to type in
1460 the 'if 1:', which is convenient when working interactively.
1462 the 'if 1:', which is convenient when working interactively.
1461 Slightly modifed version of a patch by Bo Peng
1463 Slightly modifed version of a patch by Bo Peng
1462 <bpeng-AT-rice.edu>.
1464 <bpeng-AT-rice.edu>.
1463
1465
1464 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1466 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1465
1467
1466 * IPython/irunner.py (main): modified irunner so it automatically
1468 * IPython/irunner.py (main): modified irunner so it automatically
1467 recognizes the right runner to use based on the extension (.py for
1469 recognizes the right runner to use based on the extension (.py for
1468 python, .ipy for ipython and .sage for sage).
1470 python, .ipy for ipython and .sage for sage).
1469
1471
1470 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1472 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1471 visible in ipapi as ip.config(), to programatically control the
1473 visible in ipapi as ip.config(), to programatically control the
1472 internal rc object. There's an accompanying %config magic for
1474 internal rc object. There's an accompanying %config magic for
1473 interactive use, which has been enhanced to match the
1475 interactive use, which has been enhanced to match the
1474 funtionality in ipconfig.
1476 funtionality in ipconfig.
1475
1477
1476 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1478 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1477 so it's not just a toggle, it now takes an argument. Add support
1479 so it's not just a toggle, it now takes an argument. Add support
1478 for a customizable header when making system calls, as the new
1480 for a customizable header when making system calls, as the new
1479 system_header variable in the ipythonrc file.
1481 system_header variable in the ipythonrc file.
1480
1482
1481 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1483 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1482
1484
1483 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1485 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1484 generic functions (using Philip J. Eby's simplegeneric package).
1486 generic functions (using Philip J. Eby's simplegeneric package).
1485 This makes it possible to customize the display of third-party classes
1487 This makes it possible to customize the display of third-party classes
1486 without having to monkeypatch them. xiter() no longer supports a mode
1488 without having to monkeypatch them. xiter() no longer supports a mode
1487 argument and the XMode class has been removed. The same functionality can
1489 argument and the XMode class has been removed. The same functionality can
1488 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1490 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1489 One consequence of the switch to generic functions is that xrepr() and
1491 One consequence of the switch to generic functions is that xrepr() and
1490 xattrs() implementation must define the default value for the mode
1492 xattrs() implementation must define the default value for the mode
1491 argument themselves and xattrs() implementations must return real
1493 argument themselves and xattrs() implementations must return real
1492 descriptors.
1494 descriptors.
1493
1495
1494 * IPython/external: This new subpackage will contain all third-party
1496 * IPython/external: This new subpackage will contain all third-party
1495 packages that are bundled with IPython. (The first one is simplegeneric).
1497 packages that are bundled with IPython. (The first one is simplegeneric).
1496
1498
1497 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1499 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1498 directory which as been dropped in r1703.
1500 directory which as been dropped in r1703.
1499
1501
1500 * IPython/Extensions/ipipe.py (iless): Fixed.
1502 * IPython/Extensions/ipipe.py (iless): Fixed.
1501
1503
1502 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1504 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1503
1505
1504 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1506 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1505
1507
1506 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1508 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1507 handling in variable expansion so that shells and magics recognize
1509 handling in variable expansion so that shells and magics recognize
1508 function local scopes correctly. Bug reported by Brian.
1510 function local scopes correctly. Bug reported by Brian.
1509
1511
1510 * scripts/ipython: remove the very first entry in sys.path which
1512 * scripts/ipython: remove the very first entry in sys.path which
1511 Python auto-inserts for scripts, so that sys.path under IPython is
1513 Python auto-inserts for scripts, so that sys.path under IPython is
1512 as similar as possible to that under plain Python.
1514 as similar as possible to that under plain Python.
1513
1515
1514 * IPython/completer.py (IPCompleter.file_matches): Fix
1516 * IPython/completer.py (IPCompleter.file_matches): Fix
1515 tab-completion so that quotes are not closed unless the completion
1517 tab-completion so that quotes are not closed unless the completion
1516 is unambiguous. After a request by Stefan. Minor cleanups in
1518 is unambiguous. After a request by Stefan. Minor cleanups in
1517 ipy_stock_completers.
1519 ipy_stock_completers.
1518
1520
1519 2006-11-02 Ville Vainio <vivainio@gmail.com>
1521 2006-11-02 Ville Vainio <vivainio@gmail.com>
1520
1522
1521 * ipy_stock_completers.py: Add %run and %cd completers.
1523 * ipy_stock_completers.py: Add %run and %cd completers.
1522
1524
1523 * completer.py: Try running custom completer for both
1525 * completer.py: Try running custom completer for both
1524 "foo" and "%foo" if the command is just "foo". Ignore case
1526 "foo" and "%foo" if the command is just "foo". Ignore case
1525 when filtering possible completions.
1527 when filtering possible completions.
1526
1528
1527 * UserConfig/ipy_user_conf.py: install stock completers as default
1529 * UserConfig/ipy_user_conf.py: install stock completers as default
1528
1530
1529 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1531 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1530 simplified readline history save / restore through a wrapper
1532 simplified readline history save / restore through a wrapper
1531 function
1533 function
1532
1534
1533
1535
1534 2006-10-31 Ville Vainio <vivainio@gmail.com>
1536 2006-10-31 Ville Vainio <vivainio@gmail.com>
1535
1537
1536 * strdispatch.py, completer.py, ipy_stock_completers.py:
1538 * strdispatch.py, completer.py, ipy_stock_completers.py:
1537 Allow str_key ("command") in completer hooks. Implement
1539 Allow str_key ("command") in completer hooks. Implement
1538 trivial completer for 'import' (stdlib modules only). Rename
1540 trivial completer for 'import' (stdlib modules only). Rename
1539 ipy_linux_package_managers.py to ipy_stock_completers.py.
1541 ipy_linux_package_managers.py to ipy_stock_completers.py.
1540 SVN completer.
1542 SVN completer.
1541
1543
1542 * Extensions/ledit.py: %magic line editor for easily and
1544 * Extensions/ledit.py: %magic line editor for easily and
1543 incrementally manipulating lists of strings. The magic command
1545 incrementally manipulating lists of strings. The magic command
1544 name is %led.
1546 name is %led.
1545
1547
1546 2006-10-30 Ville Vainio <vivainio@gmail.com>
1548 2006-10-30 Ville Vainio <vivainio@gmail.com>
1547
1549
1548 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1550 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1549 Bernsteins's patches for pydb integration.
1551 Bernsteins's patches for pydb integration.
1550 http://bashdb.sourceforge.net/pydb/
1552 http://bashdb.sourceforge.net/pydb/
1551
1553
1552 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1554 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1553 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1555 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1554 custom completer hook to allow the users to implement their own
1556 custom completer hook to allow the users to implement their own
1555 completers. See ipy_linux_package_managers.py for example. The
1557 completers. See ipy_linux_package_managers.py for example. The
1556 hook name is 'complete_command'.
1558 hook name is 'complete_command'.
1557
1559
1558 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1560 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1559
1561
1560 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1562 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1561 Numeric leftovers.
1563 Numeric leftovers.
1562
1564
1563 * ipython.el (py-execute-region): apply Stefan's patch to fix
1565 * ipython.el (py-execute-region): apply Stefan's patch to fix
1564 garbled results if the python shell hasn't been previously started.
1566 garbled results if the python shell hasn't been previously started.
1565
1567
1566 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1568 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1567 pretty generic function and useful for other things.
1569 pretty generic function and useful for other things.
1568
1570
1569 * IPython/OInspect.py (getsource): Add customizable source
1571 * IPython/OInspect.py (getsource): Add customizable source
1570 extractor. After a request/patch form W. Stein (SAGE).
1572 extractor. After a request/patch form W. Stein (SAGE).
1571
1573
1572 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1574 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1573 window size to a more reasonable value from what pexpect does,
1575 window size to a more reasonable value from what pexpect does,
1574 since their choice causes wrapping bugs with long input lines.
1576 since their choice causes wrapping bugs with long input lines.
1575
1577
1576 2006-10-28 Ville Vainio <vivainio@gmail.com>
1578 2006-10-28 Ville Vainio <vivainio@gmail.com>
1577
1579
1578 * Magic.py (%run): Save and restore the readline history from
1580 * Magic.py (%run): Save and restore the readline history from
1579 file around %run commands to prevent side effects from
1581 file around %run commands to prevent side effects from
1580 %runned programs that might use readline (e.g. pydb).
1582 %runned programs that might use readline (e.g. pydb).
1581
1583
1582 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1584 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1583 invoking the pydb enhanced debugger.
1585 invoking the pydb enhanced debugger.
1584
1586
1585 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1587 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1586
1588
1587 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1589 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1588 call the base class method and propagate the return value to
1590 call the base class method and propagate the return value to
1589 ifile. This is now done by path itself.
1591 ifile. This is now done by path itself.
1590
1592
1591 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1593 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1592
1594
1593 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1595 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1594 api: set_crash_handler(), to expose the ability to change the
1596 api: set_crash_handler(), to expose the ability to change the
1595 internal crash handler.
1597 internal crash handler.
1596
1598
1597 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1599 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1598 the various parameters of the crash handler so that apps using
1600 the various parameters of the crash handler so that apps using
1599 IPython as their engine can customize crash handling. Ipmlemented
1601 IPython as their engine can customize crash handling. Ipmlemented
1600 at the request of SAGE.
1602 at the request of SAGE.
1601
1603
1602 2006-10-14 Ville Vainio <vivainio@gmail.com>
1604 2006-10-14 Ville Vainio <vivainio@gmail.com>
1603
1605
1604 * Magic.py, ipython.el: applied first "safe" part of Rocky
1606 * Magic.py, ipython.el: applied first "safe" part of Rocky
1605 Bernstein's patch set for pydb integration.
1607 Bernstein's patch set for pydb integration.
1606
1608
1607 * Magic.py (%unalias, %alias): %store'd aliases can now be
1609 * Magic.py (%unalias, %alias): %store'd aliases can now be
1608 removed with '%unalias'. %alias w/o args now shows most
1610 removed with '%unalias'. %alias w/o args now shows most
1609 interesting (stored / manually defined) aliases last
1611 interesting (stored / manually defined) aliases last
1610 where they catch the eye w/o scrolling.
1612 where they catch the eye w/o scrolling.
1611
1613
1612 * Magic.py (%rehashx), ext_rehashdir.py: files with
1614 * Magic.py (%rehashx), ext_rehashdir.py: files with
1613 'py' extension are always considered executable, even
1615 'py' extension are always considered executable, even
1614 when not in PATHEXT environment variable.
1616 when not in PATHEXT environment variable.
1615
1617
1616 2006-10-12 Ville Vainio <vivainio@gmail.com>
1618 2006-10-12 Ville Vainio <vivainio@gmail.com>
1617
1619
1618 * jobctrl.py: Add new "jobctrl" extension for spawning background
1620 * jobctrl.py: Add new "jobctrl" extension for spawning background
1619 processes with "&find /". 'import jobctrl' to try it out. Requires
1621 processes with "&find /". 'import jobctrl' to try it out. Requires
1620 'subprocess' module, standard in python 2.4+.
1622 'subprocess' module, standard in python 2.4+.
1621
1623
1622 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1624 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1623 so if foo -> bar and bar -> baz, then foo -> baz.
1625 so if foo -> bar and bar -> baz, then foo -> baz.
1624
1626
1625 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1627 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1626
1628
1627 * IPython/Magic.py (Magic.parse_options): add a new posix option
1629 * IPython/Magic.py (Magic.parse_options): add a new posix option
1628 to allow parsing of input args in magics that doesn't strip quotes
1630 to allow parsing of input args in magics that doesn't strip quotes
1629 (if posix=False). This also closes %timeit bug reported by
1631 (if posix=False). This also closes %timeit bug reported by
1630 Stefan.
1632 Stefan.
1631
1633
1632 2006-10-03 Ville Vainio <vivainio@gmail.com>
1634 2006-10-03 Ville Vainio <vivainio@gmail.com>
1633
1635
1634 * iplib.py (raw_input, interact): Return ValueError catching for
1636 * iplib.py (raw_input, interact): Return ValueError catching for
1635 raw_input. Fixes infinite loop for sys.stdin.close() or
1637 raw_input. Fixes infinite loop for sys.stdin.close() or
1636 sys.stdout.close().
1638 sys.stdout.close().
1637
1639
1638 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1640 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1639
1641
1640 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1642 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1641 to help in handling doctests. irunner is now pretty useful for
1643 to help in handling doctests. irunner is now pretty useful for
1642 running standalone scripts and simulate a full interactive session
1644 running standalone scripts and simulate a full interactive session
1643 in a format that can be then pasted as a doctest.
1645 in a format that can be then pasted as a doctest.
1644
1646
1645 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1647 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1646 on top of the default (useless) ones. This also fixes the nasty
1648 on top of the default (useless) ones. This also fixes the nasty
1647 way in which 2.5's Quitter() exits (reverted [1785]).
1649 way in which 2.5's Quitter() exits (reverted [1785]).
1648
1650
1649 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1651 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1650 2.5.
1652 2.5.
1651
1653
1652 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1654 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1653 color scheme is updated as well when color scheme is changed
1655 color scheme is updated as well when color scheme is changed
1654 interactively.
1656 interactively.
1655
1657
1656 2006-09-27 Ville Vainio <vivainio@gmail.com>
1658 2006-09-27 Ville Vainio <vivainio@gmail.com>
1657
1659
1658 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1660 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1659 infinite loop and just exit. It's a hack, but will do for a while.
1661 infinite loop and just exit. It's a hack, but will do for a while.
1660
1662
1661 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1663 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1662
1664
1663 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1665 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1664 the constructor, this makes it possible to get a list of only directories
1666 the constructor, this makes it possible to get a list of only directories
1665 or only files.
1667 or only files.
1666
1668
1667 2006-08-12 Ville Vainio <vivainio@gmail.com>
1669 2006-08-12 Ville Vainio <vivainio@gmail.com>
1668
1670
1669 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1671 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1670 they broke unittest
1672 they broke unittest
1671
1673
1672 2006-08-11 Ville Vainio <vivainio@gmail.com>
1674 2006-08-11 Ville Vainio <vivainio@gmail.com>
1673
1675
1674 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1676 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1675 by resolving issue properly, i.e. by inheriting FakeModule
1677 by resolving issue properly, i.e. by inheriting FakeModule
1676 from types.ModuleType. Pickling ipython interactive data
1678 from types.ModuleType. Pickling ipython interactive data
1677 should still work as usual (testing appreciated).
1679 should still work as usual (testing appreciated).
1678
1680
1679 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1681 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1680
1682
1681 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1683 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1682 running under python 2.3 with code from 2.4 to fix a bug with
1684 running under python 2.3 with code from 2.4 to fix a bug with
1683 help(). Reported by the Debian maintainers, Norbert Tretkowski
1685 help(). Reported by the Debian maintainers, Norbert Tretkowski
1684 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1686 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1685 <afayolle-AT-debian.org>.
1687 <afayolle-AT-debian.org>.
1686
1688
1687 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1689 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1688
1690
1689 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1691 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1690 (which was displaying "quit" twice).
1692 (which was displaying "quit" twice).
1691
1693
1692 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1694 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1693
1695
1694 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1696 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1695 the mode argument).
1697 the mode argument).
1696
1698
1697 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1699 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1698
1700
1699 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1701 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1700 not running under IPython.
1702 not running under IPython.
1701
1703
1702 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1704 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1703 and make it iterable (iterating over the attribute itself). Add two new
1705 and make it iterable (iterating over the attribute itself). Add two new
1704 magic strings for __xattrs__(): If the string starts with "-", the attribute
1706 magic strings for __xattrs__(): If the string starts with "-", the attribute
1705 will not be displayed in ibrowse's detail view (but it can still be
1707 will not be displayed in ibrowse's detail view (but it can still be
1706 iterated over). This makes it possible to add attributes that are large
1708 iterated over). This makes it possible to add attributes that are large
1707 lists or generator methods to the detail view. Replace magic attribute names
1709 lists or generator methods to the detail view. Replace magic attribute names
1708 and _attrname() and _getattr() with "descriptors": For each type of magic
1710 and _attrname() and _getattr() with "descriptors": For each type of magic
1709 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1711 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1710 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1712 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1711 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1713 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1712 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1714 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1713 are still supported.
1715 are still supported.
1714
1716
1715 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1717 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1716 fails in ibrowse.fetch(), the exception object is added as the last item
1718 fails in ibrowse.fetch(), the exception object is added as the last item
1717 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1719 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1718 a generator throws an exception midway through execution.
1720 a generator throws an exception midway through execution.
1719
1721
1720 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1722 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1721 encoding into methods.
1723 encoding into methods.
1722
1724
1723 2006-07-26 Ville Vainio <vivainio@gmail.com>
1725 2006-07-26 Ville Vainio <vivainio@gmail.com>
1724
1726
1725 * iplib.py: history now stores multiline input as single
1727 * iplib.py: history now stores multiline input as single
1726 history entries. Patch by Jorgen Cederlof.
1728 history entries. Patch by Jorgen Cederlof.
1727
1729
1728 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1730 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1729
1731
1730 * IPython/Extensions/ibrowse.py: Make cursor visible over
1732 * IPython/Extensions/ibrowse.py: Make cursor visible over
1731 non existing attributes.
1733 non existing attributes.
1732
1734
1733 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1735 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1734
1736
1735 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1737 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1736 error output of the running command doesn't mess up the screen.
1738 error output of the running command doesn't mess up the screen.
1737
1739
1738 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1740 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1739
1741
1740 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1742 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1741 argument. This sorts the items themselves.
1743 argument. This sorts the items themselves.
1742
1744
1743 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1745 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1744
1746
1745 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1747 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1746 Compile expression strings into code objects. This should speed
1748 Compile expression strings into code objects. This should speed
1747 up ifilter and friends somewhat.
1749 up ifilter and friends somewhat.
1748
1750
1749 2006-07-08 Ville Vainio <vivainio@gmail.com>
1751 2006-07-08 Ville Vainio <vivainio@gmail.com>
1750
1752
1751 * Magic.py: %cpaste now strips > from the beginning of lines
1753 * Magic.py: %cpaste now strips > from the beginning of lines
1752 to ease pasting quoted code from emails. Contributed by
1754 to ease pasting quoted code from emails. Contributed by
1753 Stefan van der Walt.
1755 Stefan van der Walt.
1754
1756
1755 2006-06-29 Ville Vainio <vivainio@gmail.com>
1757 2006-06-29 Ville Vainio <vivainio@gmail.com>
1756
1758
1757 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1759 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1758 mode, patch contributed by Darren Dale. NEEDS TESTING!
1760 mode, patch contributed by Darren Dale. NEEDS TESTING!
1759
1761
1760 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1762 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1761
1763
1762 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1764 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1763 a blue background. Fix fetching new display rows when the browser
1765 a blue background. Fix fetching new display rows when the browser
1764 scrolls more than a screenful (e.g. by using the goto command).
1766 scrolls more than a screenful (e.g. by using the goto command).
1765
1767
1766 2006-06-27 Ville Vainio <vivainio@gmail.com>
1768 2006-06-27 Ville Vainio <vivainio@gmail.com>
1767
1769
1768 * Magic.py (_inspect, _ofind) Apply David Huard's
1770 * Magic.py (_inspect, _ofind) Apply David Huard's
1769 patch for displaying the correct docstring for 'property'
1771 patch for displaying the correct docstring for 'property'
1770 attributes.
1772 attributes.
1771
1773
1772 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1774 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1773
1775
1774 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1776 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1775 commands into the methods implementing them.
1777 commands into the methods implementing them.
1776
1778
1777 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1779 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1778
1780
1779 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1781 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1780 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1782 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1781 autoindent support was authored by Jin Liu.
1783 autoindent support was authored by Jin Liu.
1782
1784
1783 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1785 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1784
1786
1785 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1787 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1786 for keymaps with a custom class that simplifies handling.
1788 for keymaps with a custom class that simplifies handling.
1787
1789
1788 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1790 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1789
1791
1790 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1792 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1791 resizing. This requires Python 2.5 to work.
1793 resizing. This requires Python 2.5 to work.
1792
1794
1793 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1795 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1794
1796
1795 * IPython/Extensions/ibrowse.py: Add two new commands to
1797 * IPython/Extensions/ibrowse.py: Add two new commands to
1796 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1798 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1797 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1799 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1798 attributes again. Remapped the help command to "?". Display
1800 attributes again. Remapped the help command to "?". Display
1799 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1801 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1800 as keys for the "home" and "end" commands. Add three new commands
1802 as keys for the "home" and "end" commands. Add three new commands
1801 to the input mode for "find" and friends: "delend" (CTRL-K)
1803 to the input mode for "find" and friends: "delend" (CTRL-K)
1802 deletes to the end of line. "incsearchup" searches upwards in the
1804 deletes to the end of line. "incsearchup" searches upwards in the
1803 command history for an input that starts with the text before the cursor.
1805 command history for an input that starts with the text before the cursor.
1804 "incsearchdown" does the same downwards. Removed a bogus mapping of
1806 "incsearchdown" does the same downwards. Removed a bogus mapping of
1805 the x key to "delete".
1807 the x key to "delete".
1806
1808
1807 2006-06-15 Ville Vainio <vivainio@gmail.com>
1809 2006-06-15 Ville Vainio <vivainio@gmail.com>
1808
1810
1809 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1811 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1810 used to create prompts dynamically, instead of the "old" way of
1812 used to create prompts dynamically, instead of the "old" way of
1811 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1813 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1812 way still works (it's invoked by the default hook), of course.
1814 way still works (it's invoked by the default hook), of course.
1813
1815
1814 * Prompts.py: added generate_output_prompt hook for altering output
1816 * Prompts.py: added generate_output_prompt hook for altering output
1815 prompt
1817 prompt
1816
1818
1817 * Release.py: Changed version string to 0.7.3.svn.
1819 * Release.py: Changed version string to 0.7.3.svn.
1818
1820
1819 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1821 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1820
1822
1821 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1823 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1822 the call to fetch() always tries to fetch enough data for at least one
1824 the call to fetch() always tries to fetch enough data for at least one
1823 full screen. This makes it possible to simply call moveto(0,0,True) in
1825 full screen. This makes it possible to simply call moveto(0,0,True) in
1824 the constructor. Fix typos and removed the obsolete goto attribute.
1826 the constructor. Fix typos and removed the obsolete goto attribute.
1825
1827
1826 2006-06-12 Ville Vainio <vivainio@gmail.com>
1828 2006-06-12 Ville Vainio <vivainio@gmail.com>
1827
1829
1828 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1830 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1829 allowing $variable interpolation within multiline statements,
1831 allowing $variable interpolation within multiline statements,
1830 though so far only with "sh" profile for a testing period.
1832 though so far only with "sh" profile for a testing period.
1831 The patch also enables splitting long commands with \ but it
1833 The patch also enables splitting long commands with \ but it
1832 doesn't work properly yet.
1834 doesn't work properly yet.
1833
1835
1834 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1836 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1835
1837
1836 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1838 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1837 input history and the position of the cursor in the input history for
1839 input history and the position of the cursor in the input history for
1838 the find, findbackwards and goto command.
1840 the find, findbackwards and goto command.
1839
1841
1840 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1842 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1841
1843
1842 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1844 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1843 implements the basic functionality of browser commands that require
1845 implements the basic functionality of browser commands that require
1844 input. Reimplement the goto, find and findbackwards commands as
1846 input. Reimplement the goto, find and findbackwards commands as
1845 subclasses of _CommandInput. Add an input history and keymaps to those
1847 subclasses of _CommandInput. Add an input history and keymaps to those
1846 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1848 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1847 execute commands.
1849 execute commands.
1848
1850
1849 2006-06-07 Ville Vainio <vivainio@gmail.com>
1851 2006-06-07 Ville Vainio <vivainio@gmail.com>
1850
1852
1851 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1853 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1852 running the batch files instead of leaving the session open.
1854 running the batch files instead of leaving the session open.
1853
1855
1854 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1856 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1855
1857
1856 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1858 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1857 the original fix was incomplete. Patch submitted by W. Maier.
1859 the original fix was incomplete. Patch submitted by W. Maier.
1858
1860
1859 2006-06-07 Ville Vainio <vivainio@gmail.com>
1861 2006-06-07 Ville Vainio <vivainio@gmail.com>
1860
1862
1861 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1863 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1862 Confirmation prompts can be supressed by 'quiet' option.
1864 Confirmation prompts can be supressed by 'quiet' option.
1863 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1865 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1864
1866
1865 2006-06-06 *** Released version 0.7.2
1867 2006-06-06 *** Released version 0.7.2
1866
1868
1867 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1869 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1868
1870
1869 * IPython/Release.py (version): Made 0.7.2 final for release.
1871 * IPython/Release.py (version): Made 0.7.2 final for release.
1870 Repo tagged and release cut.
1872 Repo tagged and release cut.
1871
1873
1872 2006-06-05 Ville Vainio <vivainio@gmail.com>
1874 2006-06-05 Ville Vainio <vivainio@gmail.com>
1873
1875
1874 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1876 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1875 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1877 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1876
1878
1877 * upgrade_dir.py: try import 'path' module a bit harder
1879 * upgrade_dir.py: try import 'path' module a bit harder
1878 (for %upgrade)
1880 (for %upgrade)
1879
1881
1880 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1882 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1881
1883
1882 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1884 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1883 instead of looping 20 times.
1885 instead of looping 20 times.
1884
1886
1885 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1887 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1886 correctly at initialization time. Bug reported by Krishna Mohan
1888 correctly at initialization time. Bug reported by Krishna Mohan
1887 Gundu <gkmohan-AT-gmail.com> on the user list.
1889 Gundu <gkmohan-AT-gmail.com> on the user list.
1888
1890
1889 * IPython/Release.py (version): Mark 0.7.2 version to start
1891 * IPython/Release.py (version): Mark 0.7.2 version to start
1890 testing for release on 06/06.
1892 testing for release on 06/06.
1891
1893
1892 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1894 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1893
1895
1894 * scripts/irunner: thin script interface so users don't have to
1896 * scripts/irunner: thin script interface so users don't have to
1895 find the module and call it as an executable, since modules rarely
1897 find the module and call it as an executable, since modules rarely
1896 live in people's PATH.
1898 live in people's PATH.
1897
1899
1898 * IPython/irunner.py (InteractiveRunner.__init__): added
1900 * IPython/irunner.py (InteractiveRunner.__init__): added
1899 delaybeforesend attribute to control delays with newer versions of
1901 delaybeforesend attribute to control delays with newer versions of
1900 pexpect. Thanks to detailed help from pexpect's author, Noah
1902 pexpect. Thanks to detailed help from pexpect's author, Noah
1901 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1903 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1902 correctly (it works in NoColor mode).
1904 correctly (it works in NoColor mode).
1903
1905
1904 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1906 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1905 SAGE list, from improper log() calls.
1907 SAGE list, from improper log() calls.
1906
1908
1907 2006-05-31 Ville Vainio <vivainio@gmail.com>
1909 2006-05-31 Ville Vainio <vivainio@gmail.com>
1908
1910
1909 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1911 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1910 with args in parens to work correctly with dirs that have spaces.
1912 with args in parens to work correctly with dirs that have spaces.
1911
1913
1912 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1914 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1913
1915
1914 * IPython/Logger.py (Logger.logstart): add option to log raw input
1916 * IPython/Logger.py (Logger.logstart): add option to log raw input
1915 instead of the processed one. A -r flag was added to the
1917 instead of the processed one. A -r flag was added to the
1916 %logstart magic used for controlling logging.
1918 %logstart magic used for controlling logging.
1917
1919
1918 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1920 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1919
1921
1920 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1922 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1921 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1923 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1922 recognize the option. After a bug report by Will Maier. This
1924 recognize the option. After a bug report by Will Maier. This
1923 closes #64 (will do it after confirmation from W. Maier).
1925 closes #64 (will do it after confirmation from W. Maier).
1924
1926
1925 * IPython/irunner.py: New module to run scripts as if manually
1927 * IPython/irunner.py: New module to run scripts as if manually
1926 typed into an interactive environment, based on pexpect. After a
1928 typed into an interactive environment, based on pexpect. After a
1927 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1929 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1928 ipython-user list. Simple unittests in the tests/ directory.
1930 ipython-user list. Simple unittests in the tests/ directory.
1929
1931
1930 * tools/release: add Will Maier, OpenBSD port maintainer, to
1932 * tools/release: add Will Maier, OpenBSD port maintainer, to
1931 recepients list. We are now officially part of the OpenBSD ports:
1933 recepients list. We are now officially part of the OpenBSD ports:
1932 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1934 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1933 work.
1935 work.
1934
1936
1935 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1937 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1936
1938
1937 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1939 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1938 so that it doesn't break tkinter apps.
1940 so that it doesn't break tkinter apps.
1939
1941
1940 * IPython/iplib.py (_prefilter): fix bug where aliases would
1942 * IPython/iplib.py (_prefilter): fix bug where aliases would
1941 shadow variables when autocall was fully off. Reported by SAGE
1943 shadow variables when autocall was fully off. Reported by SAGE
1942 author William Stein.
1944 author William Stein.
1943
1945
1944 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1946 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1945 at what detail level strings are computed when foo? is requested.
1947 at what detail level strings are computed when foo? is requested.
1946 This allows users to ask for example that the string form of an
1948 This allows users to ask for example that the string form of an
1947 object is only computed when foo?? is called, or even never, by
1949 object is only computed when foo?? is called, or even never, by
1948 setting the object_info_string_level >= 2 in the configuration
1950 setting the object_info_string_level >= 2 in the configuration
1949 file. This new option has been added and documented. After a
1951 file. This new option has been added and documented. After a
1950 request by SAGE to be able to control the printing of very large
1952 request by SAGE to be able to control the printing of very large
1951 objects more easily.
1953 objects more easily.
1952
1954
1953 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1955 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1954
1956
1955 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1957 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1956 from sys.argv, to be 100% consistent with how Python itself works
1958 from sys.argv, to be 100% consistent with how Python itself works
1957 (as seen for example with python -i file.py). After a bug report
1959 (as seen for example with python -i file.py). After a bug report
1958 by Jeffrey Collins.
1960 by Jeffrey Collins.
1959
1961
1960 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1962 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1961 nasty bug which was preventing custom namespaces with -pylab,
1963 nasty bug which was preventing custom namespaces with -pylab,
1962 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1964 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1963 compatibility (long gone from mpl).
1965 compatibility (long gone from mpl).
1964
1966
1965 * IPython/ipapi.py (make_session): name change: create->make. We
1967 * IPython/ipapi.py (make_session): name change: create->make. We
1966 use make in other places (ipmaker,...), it's shorter and easier to
1968 use make in other places (ipmaker,...), it's shorter and easier to
1967 type and say, etc. I'm trying to clean things before 0.7.2 so
1969 type and say, etc. I'm trying to clean things before 0.7.2 so
1968 that I can keep things stable wrt to ipapi in the chainsaw branch.
1970 that I can keep things stable wrt to ipapi in the chainsaw branch.
1969
1971
1970 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1972 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1971 python-mode recognizes our debugger mode. Add support for
1973 python-mode recognizes our debugger mode. Add support for
1972 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1974 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1973 <m.liu.jin-AT-gmail.com> originally written by
1975 <m.liu.jin-AT-gmail.com> originally written by
1974 doxgen-AT-newsmth.net (with minor modifications for xemacs
1976 doxgen-AT-newsmth.net (with minor modifications for xemacs
1975 compatibility)
1977 compatibility)
1976
1978
1977 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1979 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1978 tracebacks when walking the stack so that the stack tracking system
1980 tracebacks when walking the stack so that the stack tracking system
1979 in emacs' python-mode can identify the frames correctly.
1981 in emacs' python-mode can identify the frames correctly.
1980
1982
1981 * IPython/ipmaker.py (make_IPython): make the internal (and
1983 * IPython/ipmaker.py (make_IPython): make the internal (and
1982 default config) autoedit_syntax value false by default. Too many
1984 default config) autoedit_syntax value false by default. Too many
1983 users have complained to me (both on and off-list) about problems
1985 users have complained to me (both on and off-list) about problems
1984 with this option being on by default, so I'm making it default to
1986 with this option being on by default, so I'm making it default to
1985 off. It can still be enabled by anyone via the usual mechanisms.
1987 off. It can still be enabled by anyone via the usual mechanisms.
1986
1988
1987 * IPython/completer.py (Completer.attr_matches): add support for
1989 * IPython/completer.py (Completer.attr_matches): add support for
1988 PyCrust-style _getAttributeNames magic method. Patch contributed
1990 PyCrust-style _getAttributeNames magic method. Patch contributed
1989 by <mscott-AT-goldenspud.com>. Closes #50.
1991 by <mscott-AT-goldenspud.com>. Closes #50.
1990
1992
1991 * IPython/iplib.py (InteractiveShell.__init__): remove the
1993 * IPython/iplib.py (InteractiveShell.__init__): remove the
1992 deletion of exit/quit from __builtin__, which can break
1994 deletion of exit/quit from __builtin__, which can break
1993 third-party tools like the Zope debugging console. The
1995 third-party tools like the Zope debugging console. The
1994 %exit/%quit magics remain. In general, it's probably a good idea
1996 %exit/%quit magics remain. In general, it's probably a good idea
1995 not to delete anything from __builtin__, since we never know what
1997 not to delete anything from __builtin__, since we never know what
1996 that will break. In any case, python now (for 2.5) will support
1998 that will break. In any case, python now (for 2.5) will support
1997 'real' exit/quit, so this issue is moot. Closes #55.
1999 'real' exit/quit, so this issue is moot. Closes #55.
1998
2000
1999 * IPython/genutils.py (with_obj): rename the 'with' function to
2001 * IPython/genutils.py (with_obj): rename the 'with' function to
2000 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
2002 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
2001 becomes a language keyword. Closes #53.
2003 becomes a language keyword. Closes #53.
2002
2004
2003 * IPython/FakeModule.py (FakeModule.__init__): add a proper
2005 * IPython/FakeModule.py (FakeModule.__init__): add a proper
2004 __file__ attribute to this so it fools more things into thinking
2006 __file__ attribute to this so it fools more things into thinking
2005 it is a real module. Closes #59.
2007 it is a real module. Closes #59.
2006
2008
2007 * IPython/Magic.py (magic_edit): add -n option to open the editor
2009 * IPython/Magic.py (magic_edit): add -n option to open the editor
2008 at a specific line number. After a patch by Stefan van der Walt.
2010 at a specific line number. After a patch by Stefan van der Walt.
2009
2011
2010 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
2012 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
2011
2013
2012 * IPython/iplib.py (edit_syntax_error): fix crash when for some
2014 * IPython/iplib.py (edit_syntax_error): fix crash when for some
2013 reason the file could not be opened. After automatic crash
2015 reason the file could not be opened. After automatic crash
2014 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
2016 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
2015 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
2017 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
2016 (_should_recompile): Don't fire editor if using %bg, since there
2018 (_should_recompile): Don't fire editor if using %bg, since there
2017 is no file in the first place. From the same report as above.
2019 is no file in the first place. From the same report as above.
2018 (raw_input): protect against faulty third-party prefilters. After
2020 (raw_input): protect against faulty third-party prefilters. After
2019 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
2021 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
2020 while running under SAGE.
2022 while running under SAGE.
2021
2023
2022 2006-05-23 Ville Vainio <vivainio@gmail.com>
2024 2006-05-23 Ville Vainio <vivainio@gmail.com>
2023
2025
2024 * ipapi.py: Stripped down ip.to_user_ns() to work only as
2026 * ipapi.py: Stripped down ip.to_user_ns() to work only as
2025 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
2027 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
2026 now returns None (again), unless dummy is specifically allowed by
2028 now returns None (again), unless dummy is specifically allowed by
2027 ipapi.get(allow_dummy=True).
2029 ipapi.get(allow_dummy=True).
2028
2030
2029 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
2031 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
2030
2032
2031 * IPython: remove all 2.2-compatibility objects and hacks from
2033 * IPython: remove all 2.2-compatibility objects and hacks from
2032 everywhere, since we only support 2.3 at this point. Docs
2034 everywhere, since we only support 2.3 at this point. Docs
2033 updated.
2035 updated.
2034
2036
2035 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
2037 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
2036 Anything requiring extra validation can be turned into a Python
2038 Anything requiring extra validation can be turned into a Python
2037 property in the future. I used a property for the db one b/c
2039 property in the future. I used a property for the db one b/c
2038 there was a nasty circularity problem with the initialization
2040 there was a nasty circularity problem with the initialization
2039 order, which right now I don't have time to clean up.
2041 order, which right now I don't have time to clean up.
2040
2042
2041 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
2043 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
2042 another locking bug reported by Jorgen. I'm not 100% sure though,
2044 another locking bug reported by Jorgen. I'm not 100% sure though,
2043 so more testing is needed...
2045 so more testing is needed...
2044
2046
2045 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
2047 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
2046
2048
2047 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
2049 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
2048 local variables from any routine in user code (typically executed
2050 local variables from any routine in user code (typically executed
2049 with %run) directly into the interactive namespace. Very useful
2051 with %run) directly into the interactive namespace. Very useful
2050 when doing complex debugging.
2052 when doing complex debugging.
2051 (IPythonNotRunning): Changed the default None object to a dummy
2053 (IPythonNotRunning): Changed the default None object to a dummy
2052 whose attributes can be queried as well as called without
2054 whose attributes can be queried as well as called without
2053 exploding, to ease writing code which works transparently both in
2055 exploding, to ease writing code which works transparently both in
2054 and out of ipython and uses some of this API.
2056 and out of ipython and uses some of this API.
2055
2057
2056 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
2058 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
2057
2059
2058 * IPython/hooks.py (result_display): Fix the fact that our display
2060 * IPython/hooks.py (result_display): Fix the fact that our display
2059 hook was using str() instead of repr(), as the default python
2061 hook was using str() instead of repr(), as the default python
2060 console does. This had gone unnoticed b/c it only happened if
2062 console does. This had gone unnoticed b/c it only happened if
2061 %Pprint was off, but the inconsistency was there.
2063 %Pprint was off, but the inconsistency was there.
2062
2064
2063 2006-05-15 Ville Vainio <vivainio@gmail.com>
2065 2006-05-15 Ville Vainio <vivainio@gmail.com>
2064
2066
2065 * Oinspect.py: Only show docstring for nonexisting/binary files
2067 * Oinspect.py: Only show docstring for nonexisting/binary files
2066 when doing object??, closing ticket #62
2068 when doing object??, closing ticket #62
2067
2069
2068 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
2070 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
2069
2071
2070 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
2072 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
2071 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
2073 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
2072 was being released in a routine which hadn't checked if it had
2074 was being released in a routine which hadn't checked if it had
2073 been the one to acquire it.
2075 been the one to acquire it.
2074
2076
2075 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
2077 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
2076
2078
2077 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
2079 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
2078
2080
2079 2006-04-11 Ville Vainio <vivainio@gmail.com>
2081 2006-04-11 Ville Vainio <vivainio@gmail.com>
2080
2082
2081 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
2083 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
2082 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
2084 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
2083 prefilters, allowing stuff like magics and aliases in the file.
2085 prefilters, allowing stuff like magics and aliases in the file.
2084
2086
2085 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
2087 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
2086 added. Supported now are "%clear in" and "%clear out" (clear input and
2088 added. Supported now are "%clear in" and "%clear out" (clear input and
2087 output history, respectively). Also fixed CachedOutput.flush to
2089 output history, respectively). Also fixed CachedOutput.flush to
2088 properly flush the output cache.
2090 properly flush the output cache.
2089
2091
2090 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
2092 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
2091 half-success (and fail explicitly).
2093 half-success (and fail explicitly).
2092
2094
2093 2006-03-28 Ville Vainio <vivainio@gmail.com>
2095 2006-03-28 Ville Vainio <vivainio@gmail.com>
2094
2096
2095 * iplib.py: Fix quoting of aliases so that only argless ones
2097 * iplib.py: Fix quoting of aliases so that only argless ones
2096 are quoted
2098 are quoted
2097
2099
2098 2006-03-28 Ville Vainio <vivainio@gmail.com>
2100 2006-03-28 Ville Vainio <vivainio@gmail.com>
2099
2101
2100 * iplib.py: Quote aliases with spaces in the name.
2102 * iplib.py: Quote aliases with spaces in the name.
2101 "c:\program files\blah\bin" is now legal alias target.
2103 "c:\program files\blah\bin" is now legal alias target.
2102
2104
2103 * ext_rehashdir.py: Space no longer allowed as arg
2105 * ext_rehashdir.py: Space no longer allowed as arg
2104 separator, since space is legal in path names.
2106 separator, since space is legal in path names.
2105
2107
2106 2006-03-16 Ville Vainio <vivainio@gmail.com>
2108 2006-03-16 Ville Vainio <vivainio@gmail.com>
2107
2109
2108 * upgrade_dir.py: Take path.py from Extensions, correcting
2110 * upgrade_dir.py: Take path.py from Extensions, correcting
2109 %upgrade magic
2111 %upgrade magic
2110
2112
2111 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
2113 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
2112
2114
2113 * hooks.py: Only enclose editor binary in quotes if legal and
2115 * hooks.py: Only enclose editor binary in quotes if legal and
2114 necessary (space in the name, and is an existing file). Fixes a bug
2116 necessary (space in the name, and is an existing file). Fixes a bug
2115 reported by Zachary Pincus.
2117 reported by Zachary Pincus.
2116
2118
2117 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2119 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2118
2120
2119 * Manual: thanks to a tip on proper color handling for Emacs, by
2121 * Manual: thanks to a tip on proper color handling for Emacs, by
2120 Eric J Haywiser <ejh1-AT-MIT.EDU>.
2122 Eric J Haywiser <ejh1-AT-MIT.EDU>.
2121
2123
2122 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
2124 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
2123 by applying the provided patch. Thanks to Liu Jin
2125 by applying the provided patch. Thanks to Liu Jin
2124 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
2126 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
2125 XEmacs/Linux, I'm trusting the submitter that it actually helps
2127 XEmacs/Linux, I'm trusting the submitter that it actually helps
2126 under win32/GNU Emacs. Will revisit if any problems are reported.
2128 under win32/GNU Emacs. Will revisit if any problems are reported.
2127
2129
2128 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2130 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2129
2131
2130 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
2132 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
2131 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
2133 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
2132
2134
2133 2006-03-12 Ville Vainio <vivainio@gmail.com>
2135 2006-03-12 Ville Vainio <vivainio@gmail.com>
2134
2136
2135 * Magic.py (magic_timeit): Added %timeit magic, contributed by
2137 * Magic.py (magic_timeit): Added %timeit magic, contributed by
2136 Torsten Marek.
2138 Torsten Marek.
2137
2139
2138 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2140 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2139
2141
2140 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
2142 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
2141 line ranges works again.
2143 line ranges works again.
2142
2144
2143 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2145 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2144
2146
2145 * IPython/iplib.py (showtraceback): add back sys.last_traceback
2147 * IPython/iplib.py (showtraceback): add back sys.last_traceback
2146 and friends, after a discussion with Zach Pincus on ipython-user.
2148 and friends, after a discussion with Zach Pincus on ipython-user.
2147 I'm not 100% sure, but after thinking about it quite a bit, it may
2149 I'm not 100% sure, but after thinking about it quite a bit, it may
2148 be OK. Testing with the multithreaded shells didn't reveal any
2150 be OK. Testing with the multithreaded shells didn't reveal any
2149 problems, but let's keep an eye out.
2151 problems, but let's keep an eye out.
2150
2152
2151 In the process, I fixed a few things which were calling
2153 In the process, I fixed a few things which were calling
2152 self.InteractiveTB() directly (like safe_execfile), which is a
2154 self.InteractiveTB() directly (like safe_execfile), which is a
2153 mistake: ALL exception reporting should be done by calling
2155 mistake: ALL exception reporting should be done by calling
2154 self.showtraceback(), which handles state and tab-completion and
2156 self.showtraceback(), which handles state and tab-completion and
2155 more.
2157 more.
2156
2158
2157 2006-03-01 Ville Vainio <vivainio@gmail.com>
2159 2006-03-01 Ville Vainio <vivainio@gmail.com>
2158
2160
2159 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2161 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2160 To use, do "from ipipe import *".
2162 To use, do "from ipipe import *".
2161
2163
2162 2006-02-24 Ville Vainio <vivainio@gmail.com>
2164 2006-02-24 Ville Vainio <vivainio@gmail.com>
2163
2165
2164 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2166 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2165 "cleanly" and safely than the older upgrade mechanism.
2167 "cleanly" and safely than the older upgrade mechanism.
2166
2168
2167 2006-02-21 Ville Vainio <vivainio@gmail.com>
2169 2006-02-21 Ville Vainio <vivainio@gmail.com>
2168
2170
2169 * Magic.py: %save works again.
2171 * Magic.py: %save works again.
2170
2172
2171 2006-02-15 Ville Vainio <vivainio@gmail.com>
2173 2006-02-15 Ville Vainio <vivainio@gmail.com>
2172
2174
2173 * Magic.py: %Pprint works again
2175 * Magic.py: %Pprint works again
2174
2176
2175 * Extensions/ipy_sane_defaults.py: Provide everything provided
2177 * Extensions/ipy_sane_defaults.py: Provide everything provided
2176 in default ipythonrc, to make it possible to have a completely empty
2178 in default ipythonrc, to make it possible to have a completely empty
2177 ipythonrc (and thus completely rc-file free configuration)
2179 ipythonrc (and thus completely rc-file free configuration)
2178
2180
2179 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2181 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2180
2182
2181 * IPython/hooks.py (editor): quote the call to the editor command,
2183 * IPython/hooks.py (editor): quote the call to the editor command,
2182 to allow commands with spaces in them. Problem noted by watching
2184 to allow commands with spaces in them. Problem noted by watching
2183 Ian Oswald's video about textpad under win32 at
2185 Ian Oswald's video about textpad under win32 at
2184 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2186 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2185
2187
2186 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2188 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2187 describing magics (we haven't used @ for a loong time).
2189 describing magics (we haven't used @ for a loong time).
2188
2190
2189 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2191 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2190 contributed by marienz to close
2192 contributed by marienz to close
2191 http://www.scipy.net/roundup/ipython/issue53.
2193 http://www.scipy.net/roundup/ipython/issue53.
2192
2194
2193 2006-02-10 Ville Vainio <vivainio@gmail.com>
2195 2006-02-10 Ville Vainio <vivainio@gmail.com>
2194
2196
2195 * genutils.py: getoutput now works in win32 too
2197 * genutils.py: getoutput now works in win32 too
2196
2198
2197 * completer.py: alias and magic completion only invoked
2199 * completer.py: alias and magic completion only invoked
2198 at the first "item" in the line, to avoid "cd %store"
2200 at the first "item" in the line, to avoid "cd %store"
2199 nonsense.
2201 nonsense.
2200
2202
2201 2006-02-09 Ville Vainio <vivainio@gmail.com>
2203 2006-02-09 Ville Vainio <vivainio@gmail.com>
2202
2204
2203 * test/*: Added a unit testing framework (finally).
2205 * test/*: Added a unit testing framework (finally).
2204 '%run runtests.py' to run test_*.
2206 '%run runtests.py' to run test_*.
2205
2207
2206 * ipapi.py: Exposed runlines and set_custom_exc
2208 * ipapi.py: Exposed runlines and set_custom_exc
2207
2209
2208 2006-02-07 Ville Vainio <vivainio@gmail.com>
2210 2006-02-07 Ville Vainio <vivainio@gmail.com>
2209
2211
2210 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2212 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2211 instead use "f(1 2)" as before.
2213 instead use "f(1 2)" as before.
2212
2214
2213 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2215 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2214
2216
2215 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2217 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2216 facilities, for demos processed by the IPython input filter
2218 facilities, for demos processed by the IPython input filter
2217 (IPythonDemo), and for running a script one-line-at-a-time as a
2219 (IPythonDemo), and for running a script one-line-at-a-time as a
2218 demo, both for pure Python (LineDemo) and for IPython-processed
2220 demo, both for pure Python (LineDemo) and for IPython-processed
2219 input (IPythonLineDemo). After a request by Dave Kohel, from the
2221 input (IPythonLineDemo). After a request by Dave Kohel, from the
2220 SAGE team.
2222 SAGE team.
2221 (Demo.edit): added an edit() method to the demo objects, to edit
2223 (Demo.edit): added an edit() method to the demo objects, to edit
2222 the in-memory copy of the last executed block.
2224 the in-memory copy of the last executed block.
2223
2225
2224 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2226 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2225 processing to %edit, %macro and %save. These commands can now be
2227 processing to %edit, %macro and %save. These commands can now be
2226 invoked on the unprocessed input as it was typed by the user
2228 invoked on the unprocessed input as it was typed by the user
2227 (without any prefilters applied). After requests by the SAGE team
2229 (without any prefilters applied). After requests by the SAGE team
2228 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2230 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2229
2231
2230 2006-02-01 Ville Vainio <vivainio@gmail.com>
2232 2006-02-01 Ville Vainio <vivainio@gmail.com>
2231
2233
2232 * setup.py, eggsetup.py: easy_install ipython==dev works
2234 * setup.py, eggsetup.py: easy_install ipython==dev works
2233 correctly now (on Linux)
2235 correctly now (on Linux)
2234
2236
2235 * ipy_user_conf,ipmaker: user config changes, removed spurious
2237 * ipy_user_conf,ipmaker: user config changes, removed spurious
2236 warnings
2238 warnings
2237
2239
2238 * iplib: if rc.banner is string, use it as is.
2240 * iplib: if rc.banner is string, use it as is.
2239
2241
2240 * Magic: %pycat accepts a string argument and pages it's contents.
2242 * Magic: %pycat accepts a string argument and pages it's contents.
2241
2243
2242
2244
2243 2006-01-30 Ville Vainio <vivainio@gmail.com>
2245 2006-01-30 Ville Vainio <vivainio@gmail.com>
2244
2246
2245 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2247 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2246 Now %store and bookmarks work through PickleShare, meaning that
2248 Now %store and bookmarks work through PickleShare, meaning that
2247 concurrent access is possible and all ipython sessions see the
2249 concurrent access is possible and all ipython sessions see the
2248 same database situation all the time, instead of snapshot of
2250 same database situation all the time, instead of snapshot of
2249 the situation when the session was started. Hence, %bookmark
2251 the situation when the session was started. Hence, %bookmark
2250 results are immediately accessible from othes sessions. The database
2252 results are immediately accessible from othes sessions. The database
2251 is also available for use by user extensions. See:
2253 is also available for use by user extensions. See:
2252 http://www.python.org/pypi/pickleshare
2254 http://www.python.org/pypi/pickleshare
2253
2255
2254 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2256 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2255
2257
2256 * aliases can now be %store'd
2258 * aliases can now be %store'd
2257
2259
2258 * path.py moved to Extensions so that pickleshare does not need
2260 * path.py moved to Extensions so that pickleshare does not need
2259 IPython-specific import. Extensions added to pythonpath right
2261 IPython-specific import. Extensions added to pythonpath right
2260 at __init__.
2262 at __init__.
2261
2263
2262 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2264 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2263 called with _ip.system and the pre-transformed command string.
2265 called with _ip.system and the pre-transformed command string.
2264
2266
2265 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2267 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2266
2268
2267 * IPython/iplib.py (interact): Fix that we were not catching
2269 * IPython/iplib.py (interact): Fix that we were not catching
2268 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2270 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2269 logic here had to change, but it's fixed now.
2271 logic here had to change, but it's fixed now.
2270
2272
2271 2006-01-29 Ville Vainio <vivainio@gmail.com>
2273 2006-01-29 Ville Vainio <vivainio@gmail.com>
2272
2274
2273 * iplib.py: Try to import pyreadline on Windows.
2275 * iplib.py: Try to import pyreadline on Windows.
2274
2276
2275 2006-01-27 Ville Vainio <vivainio@gmail.com>
2277 2006-01-27 Ville Vainio <vivainio@gmail.com>
2276
2278
2277 * iplib.py: Expose ipapi as _ip in builtin namespace.
2279 * iplib.py: Expose ipapi as _ip in builtin namespace.
2278 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2280 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2279 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2281 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2280 syntax now produce _ip.* variant of the commands.
2282 syntax now produce _ip.* variant of the commands.
2281
2283
2282 * "_ip.options().autoedit_syntax = 2" automatically throws
2284 * "_ip.options().autoedit_syntax = 2" automatically throws
2283 user to editor for syntax error correction without prompting.
2285 user to editor for syntax error correction without prompting.
2284
2286
2285 2006-01-27 Ville Vainio <vivainio@gmail.com>
2287 2006-01-27 Ville Vainio <vivainio@gmail.com>
2286
2288
2287 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2289 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2288 'ipython' at argv[0]) executed through command line.
2290 'ipython' at argv[0]) executed through command line.
2289 NOTE: this DEPRECATES calling ipython with multiple scripts
2291 NOTE: this DEPRECATES calling ipython with multiple scripts
2290 ("ipython a.py b.py c.py")
2292 ("ipython a.py b.py c.py")
2291
2293
2292 * iplib.py, hooks.py: Added configurable input prefilter,
2294 * iplib.py, hooks.py: Added configurable input prefilter,
2293 named 'input_prefilter'. See ext_rescapture.py for example
2295 named 'input_prefilter'. See ext_rescapture.py for example
2294 usage.
2296 usage.
2295
2297
2296 * ext_rescapture.py, Magic.py: Better system command output capture
2298 * ext_rescapture.py, Magic.py: Better system command output capture
2297 through 'var = !ls' (deprecates user-visible %sc). Same notation
2299 through 'var = !ls' (deprecates user-visible %sc). Same notation
2298 applies for magics, 'var = %alias' assigns alias list to var.
2300 applies for magics, 'var = %alias' assigns alias list to var.
2299
2301
2300 * ipapi.py: added meta() for accessing extension-usable data store.
2302 * ipapi.py: added meta() for accessing extension-usable data store.
2301
2303
2302 * iplib.py: added InteractiveShell.getapi(). New magics should be
2304 * iplib.py: added InteractiveShell.getapi(). New magics should be
2303 written doing self.getapi() instead of using the shell directly.
2305 written doing self.getapi() instead of using the shell directly.
2304
2306
2305 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2307 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2306 %store foo >> ~/myfoo.txt to store variables to files (in clean
2308 %store foo >> ~/myfoo.txt to store variables to files (in clean
2307 textual form, not a restorable pickle).
2309 textual form, not a restorable pickle).
2308
2310
2309 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2311 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2310
2312
2311 * usage.py, Magic.py: added %quickref
2313 * usage.py, Magic.py: added %quickref
2312
2314
2313 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2315 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2314
2316
2315 * GetoptErrors when invoking magics etc. with wrong args
2317 * GetoptErrors when invoking magics etc. with wrong args
2316 are now more helpful:
2318 are now more helpful:
2317 GetoptError: option -l not recognized (allowed: "qb" )
2319 GetoptError: option -l not recognized (allowed: "qb" )
2318
2320
2319 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2321 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2320
2322
2321 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2323 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2322 computationally intensive blocks don't appear to stall the demo.
2324 computationally intensive blocks don't appear to stall the demo.
2323
2325
2324 2006-01-24 Ville Vainio <vivainio@gmail.com>
2326 2006-01-24 Ville Vainio <vivainio@gmail.com>
2325
2327
2326 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2328 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2327 value to manipulate resulting history entry.
2329 value to manipulate resulting history entry.
2328
2330
2329 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2331 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2330 to instance methods of IPApi class, to make extending an embedded
2332 to instance methods of IPApi class, to make extending an embedded
2331 IPython feasible. See ext_rehashdir.py for example usage.
2333 IPython feasible. See ext_rehashdir.py for example usage.
2332
2334
2333 * Merged 1071-1076 from branches/0.7.1
2335 * Merged 1071-1076 from branches/0.7.1
2334
2336
2335
2337
2336 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2338 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2337
2339
2338 * tools/release (daystamp): Fix build tools to use the new
2340 * tools/release (daystamp): Fix build tools to use the new
2339 eggsetup.py script to build lightweight eggs.
2341 eggsetup.py script to build lightweight eggs.
2340
2342
2341 * Applied changesets 1062 and 1064 before 0.7.1 release.
2343 * Applied changesets 1062 and 1064 before 0.7.1 release.
2342
2344
2343 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2345 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2344 see the raw input history (without conversions like %ls ->
2346 see the raw input history (without conversions like %ls ->
2345 ipmagic("ls")). After a request from W. Stein, SAGE
2347 ipmagic("ls")). After a request from W. Stein, SAGE
2346 (http://modular.ucsd.edu/sage) developer. This information is
2348 (http://modular.ucsd.edu/sage) developer. This information is
2347 stored in the input_hist_raw attribute of the IPython instance, so
2349 stored in the input_hist_raw attribute of the IPython instance, so
2348 developers can access it if needed (it's an InputList instance).
2350 developers can access it if needed (it's an InputList instance).
2349
2351
2350 * Versionstring = 0.7.2.svn
2352 * Versionstring = 0.7.2.svn
2351
2353
2352 * eggsetup.py: A separate script for constructing eggs, creates
2354 * eggsetup.py: A separate script for constructing eggs, creates
2353 proper launch scripts even on Windows (an .exe file in
2355 proper launch scripts even on Windows (an .exe file in
2354 \python24\scripts).
2356 \python24\scripts).
2355
2357
2356 * ipapi.py: launch_new_instance, launch entry point needed for the
2358 * ipapi.py: launch_new_instance, launch entry point needed for the
2357 egg.
2359 egg.
2358
2360
2359 2006-01-23 Ville Vainio <vivainio@gmail.com>
2361 2006-01-23 Ville Vainio <vivainio@gmail.com>
2360
2362
2361 * Added %cpaste magic for pasting python code
2363 * Added %cpaste magic for pasting python code
2362
2364
2363 2006-01-22 Ville Vainio <vivainio@gmail.com>
2365 2006-01-22 Ville Vainio <vivainio@gmail.com>
2364
2366
2365 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2367 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2366
2368
2367 * Versionstring = 0.7.2.svn
2369 * Versionstring = 0.7.2.svn
2368
2370
2369 * eggsetup.py: A separate script for constructing eggs, creates
2371 * eggsetup.py: A separate script for constructing eggs, creates
2370 proper launch scripts even on Windows (an .exe file in
2372 proper launch scripts even on Windows (an .exe file in
2371 \python24\scripts).
2373 \python24\scripts).
2372
2374
2373 * ipapi.py: launch_new_instance, launch entry point needed for the
2375 * ipapi.py: launch_new_instance, launch entry point needed for the
2374 egg.
2376 egg.
2375
2377
2376 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2378 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2377
2379
2378 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2380 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2379 %pfile foo would print the file for foo even if it was a binary.
2381 %pfile foo would print the file for foo even if it was a binary.
2380 Now, extensions '.so' and '.dll' are skipped.
2382 Now, extensions '.so' and '.dll' are skipped.
2381
2383
2382 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2384 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2383 bug, where macros would fail in all threaded modes. I'm not 100%
2385 bug, where macros would fail in all threaded modes. I'm not 100%
2384 sure, so I'm going to put out an rc instead of making a release
2386 sure, so I'm going to put out an rc instead of making a release
2385 today, and wait for feedback for at least a few days.
2387 today, and wait for feedback for at least a few days.
2386
2388
2387 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2389 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2388 it...) the handling of pasting external code with autoindent on.
2390 it...) the handling of pasting external code with autoindent on.
2389 To get out of a multiline input, the rule will appear for most
2391 To get out of a multiline input, the rule will appear for most
2390 users unchanged: two blank lines or change the indent level
2392 users unchanged: two blank lines or change the indent level
2391 proposed by IPython. But there is a twist now: you can
2393 proposed by IPython. But there is a twist now: you can
2392 add/subtract only *one or two spaces*. If you add/subtract three
2394 add/subtract only *one or two spaces*. If you add/subtract three
2393 or more (unless you completely delete the line), IPython will
2395 or more (unless you completely delete the line), IPython will
2394 accept that line, and you'll need to enter a second one of pure
2396 accept that line, and you'll need to enter a second one of pure
2395 whitespace. I know it sounds complicated, but I can't find a
2397 whitespace. I know it sounds complicated, but I can't find a
2396 different solution that covers all the cases, with the right
2398 different solution that covers all the cases, with the right
2397 heuristics. Hopefully in actual use, nobody will really notice
2399 heuristics. Hopefully in actual use, nobody will really notice
2398 all these strange rules and things will 'just work'.
2400 all these strange rules and things will 'just work'.
2399
2401
2400 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2402 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2401
2403
2402 * IPython/iplib.py (interact): catch exceptions which can be
2404 * IPython/iplib.py (interact): catch exceptions which can be
2403 triggered asynchronously by signal handlers. Thanks to an
2405 triggered asynchronously by signal handlers. Thanks to an
2404 automatic crash report, submitted by Colin Kingsley
2406 automatic crash report, submitted by Colin Kingsley
2405 <tercel-AT-gentoo.org>.
2407 <tercel-AT-gentoo.org>.
2406
2408
2407 2006-01-20 Ville Vainio <vivainio@gmail.com>
2409 2006-01-20 Ville Vainio <vivainio@gmail.com>
2408
2410
2409 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2411 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2410 (%rehashdir, very useful, try it out) of how to extend ipython
2412 (%rehashdir, very useful, try it out) of how to extend ipython
2411 with new magics. Also added Extensions dir to pythonpath to make
2413 with new magics. Also added Extensions dir to pythonpath to make
2412 importing extensions easy.
2414 importing extensions easy.
2413
2415
2414 * %store now complains when trying to store interactively declared
2416 * %store now complains when trying to store interactively declared
2415 classes / instances of those classes.
2417 classes / instances of those classes.
2416
2418
2417 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2419 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2418 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2420 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2419 if they exist, and ipy_user_conf.py with some defaults is created for
2421 if they exist, and ipy_user_conf.py with some defaults is created for
2420 the user.
2422 the user.
2421
2423
2422 * Startup rehashing done by the config file, not InterpreterExec.
2424 * Startup rehashing done by the config file, not InterpreterExec.
2423 This means system commands are available even without selecting the
2425 This means system commands are available even without selecting the
2424 pysh profile. It's the sensible default after all.
2426 pysh profile. It's the sensible default after all.
2425
2427
2426 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2428 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2427
2429
2428 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2430 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2429 multiline code with autoindent on working. But I am really not
2431 multiline code with autoindent on working. But I am really not
2430 sure, so this needs more testing. Will commit a debug-enabled
2432 sure, so this needs more testing. Will commit a debug-enabled
2431 version for now, while I test it some more, so that Ville and
2433 version for now, while I test it some more, so that Ville and
2432 others may also catch any problems. Also made
2434 others may also catch any problems. Also made
2433 self.indent_current_str() a method, to ensure that there's no
2435 self.indent_current_str() a method, to ensure that there's no
2434 chance of the indent space count and the corresponding string
2436 chance of the indent space count and the corresponding string
2435 falling out of sync. All code needing the string should just call
2437 falling out of sync. All code needing the string should just call
2436 the method.
2438 the method.
2437
2439
2438 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2440 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2439
2441
2440 * IPython/Magic.py (magic_edit): fix check for when users don't
2442 * IPython/Magic.py (magic_edit): fix check for when users don't
2441 save their output files, the try/except was in the wrong section.
2443 save their output files, the try/except was in the wrong section.
2442
2444
2443 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2445 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2444
2446
2445 * IPython/Magic.py (magic_run): fix __file__ global missing from
2447 * IPython/Magic.py (magic_run): fix __file__ global missing from
2446 script's namespace when executed via %run. After a report by
2448 script's namespace when executed via %run. After a report by
2447 Vivian.
2449 Vivian.
2448
2450
2449 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2451 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2450 when using python 2.4. The parent constructor changed in 2.4, and
2452 when using python 2.4. The parent constructor changed in 2.4, and
2451 we need to track it directly (we can't call it, as it messes up
2453 we need to track it directly (we can't call it, as it messes up
2452 readline and tab-completion inside our pdb would stop working).
2454 readline and tab-completion inside our pdb would stop working).
2453 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2455 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2454
2456
2455 2006-01-16 Ville Vainio <vivainio@gmail.com>
2457 2006-01-16 Ville Vainio <vivainio@gmail.com>
2456
2458
2457 * Ipython/magic.py: Reverted back to old %edit functionality
2459 * Ipython/magic.py: Reverted back to old %edit functionality
2458 that returns file contents on exit.
2460 that returns file contents on exit.
2459
2461
2460 * IPython/path.py: Added Jason Orendorff's "path" module to
2462 * IPython/path.py: Added Jason Orendorff's "path" module to
2461 IPython tree, http://www.jorendorff.com/articles/python/path/.
2463 IPython tree, http://www.jorendorff.com/articles/python/path/.
2462 You can get path objects conveniently through %sc, and !!, e.g.:
2464 You can get path objects conveniently through %sc, and !!, e.g.:
2463 sc files=ls
2465 sc files=ls
2464 for p in files.paths: # or files.p
2466 for p in files.paths: # or files.p
2465 print p,p.mtime
2467 print p,p.mtime
2466
2468
2467 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2469 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2468 now work again without considering the exclusion regexp -
2470 now work again without considering the exclusion regexp -
2469 hence, things like ',foo my/path' turn to 'foo("my/path")'
2471 hence, things like ',foo my/path' turn to 'foo("my/path")'
2470 instead of syntax error.
2472 instead of syntax error.
2471
2473
2472
2474
2473 2006-01-14 Ville Vainio <vivainio@gmail.com>
2475 2006-01-14 Ville Vainio <vivainio@gmail.com>
2474
2476
2475 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2477 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2476 ipapi decorators for python 2.4 users, options() provides access to rc
2478 ipapi decorators for python 2.4 users, options() provides access to rc
2477 data.
2479 data.
2478
2480
2479 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2481 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2480 as path separators (even on Linux ;-). Space character after
2482 as path separators (even on Linux ;-). Space character after
2481 backslash (as yielded by tab completer) is still space;
2483 backslash (as yielded by tab completer) is still space;
2482 "%cd long\ name" works as expected.
2484 "%cd long\ name" works as expected.
2483
2485
2484 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2486 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2485 as "chain of command", with priority. API stays the same,
2487 as "chain of command", with priority. API stays the same,
2486 TryNext exception raised by a hook function signals that
2488 TryNext exception raised by a hook function signals that
2487 current hook failed and next hook should try handling it, as
2489 current hook failed and next hook should try handling it, as
2488 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2490 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2489 requested configurable display hook, which is now implemented.
2491 requested configurable display hook, which is now implemented.
2490
2492
2491 2006-01-13 Ville Vainio <vivainio@gmail.com>
2493 2006-01-13 Ville Vainio <vivainio@gmail.com>
2492
2494
2493 * IPython/platutils*.py: platform specific utility functions,
2495 * IPython/platutils*.py: platform specific utility functions,
2494 so far only set_term_title is implemented (change terminal
2496 so far only set_term_title is implemented (change terminal
2495 label in windowing systems). %cd now changes the title to
2497 label in windowing systems). %cd now changes the title to
2496 current dir.
2498 current dir.
2497
2499
2498 * IPython/Release.py: Added myself to "authors" list,
2500 * IPython/Release.py: Added myself to "authors" list,
2499 had to create new files.
2501 had to create new files.
2500
2502
2501 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2503 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2502 shell escape; not a known bug but had potential to be one in the
2504 shell escape; not a known bug but had potential to be one in the
2503 future.
2505 future.
2504
2506
2505 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2507 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2506 extension API for IPython! See the module for usage example. Fix
2508 extension API for IPython! See the module for usage example. Fix
2507 OInspect for docstring-less magic functions.
2509 OInspect for docstring-less magic functions.
2508
2510
2509
2511
2510 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2512 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2511
2513
2512 * IPython/iplib.py (raw_input): temporarily deactivate all
2514 * IPython/iplib.py (raw_input): temporarily deactivate all
2513 attempts at allowing pasting of code with autoindent on. It
2515 attempts at allowing pasting of code with autoindent on. It
2514 introduced bugs (reported by Prabhu) and I can't seem to find a
2516 introduced bugs (reported by Prabhu) and I can't seem to find a
2515 robust combination which works in all cases. Will have to revisit
2517 robust combination which works in all cases. Will have to revisit
2516 later.
2518 later.
2517
2519
2518 * IPython/genutils.py: remove isspace() function. We've dropped
2520 * IPython/genutils.py: remove isspace() function. We've dropped
2519 2.2 compatibility, so it's OK to use the string method.
2521 2.2 compatibility, so it's OK to use the string method.
2520
2522
2521 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2523 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2522
2524
2523 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2525 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2524 matching what NOT to autocall on, to include all python binary
2526 matching what NOT to autocall on, to include all python binary
2525 operators (including things like 'and', 'or', 'is' and 'in').
2527 operators (including things like 'and', 'or', 'is' and 'in').
2526 Prompted by a bug report on 'foo & bar', but I realized we had
2528 Prompted by a bug report on 'foo & bar', but I realized we had
2527 many more potential bug cases with other operators. The regexp is
2529 many more potential bug cases with other operators. The regexp is
2528 self.re_exclude_auto, it's fairly commented.
2530 self.re_exclude_auto, it's fairly commented.
2529
2531
2530 2006-01-12 Ville Vainio <vivainio@gmail.com>
2532 2006-01-12 Ville Vainio <vivainio@gmail.com>
2531
2533
2532 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2534 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2533 Prettified and hardened string/backslash quoting with ipsystem(),
2535 Prettified and hardened string/backslash quoting with ipsystem(),
2534 ipalias() and ipmagic(). Now even \ characters are passed to
2536 ipalias() and ipmagic(). Now even \ characters are passed to
2535 %magics, !shell escapes and aliases exactly as they are in the
2537 %magics, !shell escapes and aliases exactly as they are in the
2536 ipython command line. Should improve backslash experience,
2538 ipython command line. Should improve backslash experience,
2537 particularly in Windows (path delimiter for some commands that
2539 particularly in Windows (path delimiter for some commands that
2538 won't understand '/'), but Unix benefits as well (regexps). %cd
2540 won't understand '/'), but Unix benefits as well (regexps). %cd
2539 magic still doesn't support backslash path delimiters, though. Also
2541 magic still doesn't support backslash path delimiters, though. Also
2540 deleted all pretense of supporting multiline command strings in
2542 deleted all pretense of supporting multiline command strings in
2541 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2543 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2542
2544
2543 * doc/build_doc_instructions.txt added. Documentation on how to
2545 * doc/build_doc_instructions.txt added. Documentation on how to
2544 use doc/update_manual.py, added yesterday. Both files contributed
2546 use doc/update_manual.py, added yesterday. Both files contributed
2545 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2547 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2546 doc/*.sh for deprecation at a later date.
2548 doc/*.sh for deprecation at a later date.
2547
2549
2548 * /ipython.py Added ipython.py to root directory for
2550 * /ipython.py Added ipython.py to root directory for
2549 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2551 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2550 ipython.py) and development convenience (no need to keep doing
2552 ipython.py) and development convenience (no need to keep doing
2551 "setup.py install" between changes).
2553 "setup.py install" between changes).
2552
2554
2553 * Made ! and !! shell escapes work (again) in multiline expressions:
2555 * Made ! and !! shell escapes work (again) in multiline expressions:
2554 if 1:
2556 if 1:
2555 !ls
2557 !ls
2556 !!ls
2558 !!ls
2557
2559
2558 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2560 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2559
2561
2560 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2562 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2561 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2563 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2562 module in case-insensitive installation. Was causing crashes
2564 module in case-insensitive installation. Was causing crashes
2563 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2565 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2564
2566
2565 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2567 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2566 <marienz-AT-gentoo.org>, closes
2568 <marienz-AT-gentoo.org>, closes
2567 http://www.scipy.net/roundup/ipython/issue51.
2569 http://www.scipy.net/roundup/ipython/issue51.
2568
2570
2569 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2571 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2570
2572
2571 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2573 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2572 problem of excessive CPU usage under *nix and keyboard lag under
2574 problem of excessive CPU usage under *nix and keyboard lag under
2573 win32.
2575 win32.
2574
2576
2575 2006-01-10 *** Released version 0.7.0
2577 2006-01-10 *** Released version 0.7.0
2576
2578
2577 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2579 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2578
2580
2579 * IPython/Release.py (revision): tag version number to 0.7.0,
2581 * IPython/Release.py (revision): tag version number to 0.7.0,
2580 ready for release.
2582 ready for release.
2581
2583
2582 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2584 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2583 it informs the user of the name of the temp. file used. This can
2585 it informs the user of the name of the temp. file used. This can
2584 help if you decide later to reuse that same file, so you know
2586 help if you decide later to reuse that same file, so you know
2585 where to copy the info from.
2587 where to copy the info from.
2586
2588
2587 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2589 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2588
2590
2589 * setup_bdist_egg.py: little script to build an egg. Added
2591 * setup_bdist_egg.py: little script to build an egg. Added
2590 support in the release tools as well.
2592 support in the release tools as well.
2591
2593
2592 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2594 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2593
2595
2594 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2596 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2595 version selection (new -wxversion command line and ipythonrc
2597 version selection (new -wxversion command line and ipythonrc
2596 parameter). Patch contributed by Arnd Baecker
2598 parameter). Patch contributed by Arnd Baecker
2597 <arnd.baecker-AT-web.de>.
2599 <arnd.baecker-AT-web.de>.
2598
2600
2599 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2601 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2600 embedded instances, for variables defined at the interactive
2602 embedded instances, for variables defined at the interactive
2601 prompt of the embedded ipython. Reported by Arnd.
2603 prompt of the embedded ipython. Reported by Arnd.
2602
2604
2603 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2605 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2604 it can be used as a (stateful) toggle, or with a direct parameter.
2606 it can be used as a (stateful) toggle, or with a direct parameter.
2605
2607
2606 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2608 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2607 could be triggered in certain cases and cause the traceback
2609 could be triggered in certain cases and cause the traceback
2608 printer not to work.
2610 printer not to work.
2609
2611
2610 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2612 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2611
2613
2612 * IPython/iplib.py (_should_recompile): Small fix, closes
2614 * IPython/iplib.py (_should_recompile): Small fix, closes
2613 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2615 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2614
2616
2615 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2617 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2616
2618
2617 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2619 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2618 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2620 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2619 Moad for help with tracking it down.
2621 Moad for help with tracking it down.
2620
2622
2621 * IPython/iplib.py (handle_auto): fix autocall handling for
2623 * IPython/iplib.py (handle_auto): fix autocall handling for
2622 objects which support BOTH __getitem__ and __call__ (so that f [x]
2624 objects which support BOTH __getitem__ and __call__ (so that f [x]
2623 is left alone, instead of becoming f([x]) automatically).
2625 is left alone, instead of becoming f([x]) automatically).
2624
2626
2625 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2627 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2626 Ville's patch.
2628 Ville's patch.
2627
2629
2628 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2630 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2629
2631
2630 * IPython/iplib.py (handle_auto): changed autocall semantics to
2632 * IPython/iplib.py (handle_auto): changed autocall semantics to
2631 include 'smart' mode, where the autocall transformation is NOT
2633 include 'smart' mode, where the autocall transformation is NOT
2632 applied if there are no arguments on the line. This allows you to
2634 applied if there are no arguments on the line. This allows you to
2633 just type 'foo' if foo is a callable to see its internal form,
2635 just type 'foo' if foo is a callable to see its internal form,
2634 instead of having it called with no arguments (typically a
2636 instead of having it called with no arguments (typically a
2635 mistake). The old 'full' autocall still exists: for that, you
2637 mistake). The old 'full' autocall still exists: for that, you
2636 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2638 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2637
2639
2638 * IPython/completer.py (Completer.attr_matches): add
2640 * IPython/completer.py (Completer.attr_matches): add
2639 tab-completion support for Enthoughts' traits. After a report by
2641 tab-completion support for Enthoughts' traits. After a report by
2640 Arnd and a patch by Prabhu.
2642 Arnd and a patch by Prabhu.
2641
2643
2642 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2644 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2643
2645
2644 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2646 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2645 Schmolck's patch to fix inspect.getinnerframes().
2647 Schmolck's patch to fix inspect.getinnerframes().
2646
2648
2647 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2649 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2648 for embedded instances, regarding handling of namespaces and items
2650 for embedded instances, regarding handling of namespaces and items
2649 added to the __builtin__ one. Multiple embedded instances and
2651 added to the __builtin__ one. Multiple embedded instances and
2650 recursive embeddings should work better now (though I'm not sure
2652 recursive embeddings should work better now (though I'm not sure
2651 I've got all the corner cases fixed, that code is a bit of a brain
2653 I've got all the corner cases fixed, that code is a bit of a brain
2652 twister).
2654 twister).
2653
2655
2654 * IPython/Magic.py (magic_edit): added support to edit in-memory
2656 * IPython/Magic.py (magic_edit): added support to edit in-memory
2655 macros (automatically creates the necessary temp files). %edit
2657 macros (automatically creates the necessary temp files). %edit
2656 also doesn't return the file contents anymore, it's just noise.
2658 also doesn't return the file contents anymore, it's just noise.
2657
2659
2658 * IPython/completer.py (Completer.attr_matches): revert change to
2660 * IPython/completer.py (Completer.attr_matches): revert change to
2659 complete only on attributes listed in __all__. I realized it
2661 complete only on attributes listed in __all__. I realized it
2660 cripples the tab-completion system as a tool for exploring the
2662 cripples the tab-completion system as a tool for exploring the
2661 internals of unknown libraries (it renders any non-__all__
2663 internals of unknown libraries (it renders any non-__all__
2662 attribute off-limits). I got bit by this when trying to see
2664 attribute off-limits). I got bit by this when trying to see
2663 something inside the dis module.
2665 something inside the dis module.
2664
2666
2665 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2667 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2666
2668
2667 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2669 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2668 namespace for users and extension writers to hold data in. This
2670 namespace for users and extension writers to hold data in. This
2669 follows the discussion in
2671 follows the discussion in
2670 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2672 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2671
2673
2672 * IPython/completer.py (IPCompleter.complete): small patch to help
2674 * IPython/completer.py (IPCompleter.complete): small patch to help
2673 tab-completion under Emacs, after a suggestion by John Barnard
2675 tab-completion under Emacs, after a suggestion by John Barnard
2674 <barnarj-AT-ccf.org>.
2676 <barnarj-AT-ccf.org>.
2675
2677
2676 * IPython/Magic.py (Magic.extract_input_slices): added support for
2678 * IPython/Magic.py (Magic.extract_input_slices): added support for
2677 the slice notation in magics to use N-M to represent numbers N...M
2679 the slice notation in magics to use N-M to represent numbers N...M
2678 (closed endpoints). This is used by %macro and %save.
2680 (closed endpoints). This is used by %macro and %save.
2679
2681
2680 * IPython/completer.py (Completer.attr_matches): for modules which
2682 * IPython/completer.py (Completer.attr_matches): for modules which
2681 define __all__, complete only on those. After a patch by Jeffrey
2683 define __all__, complete only on those. After a patch by Jeffrey
2682 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2684 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2683 speed up this routine.
2685 speed up this routine.
2684
2686
2685 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2687 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2686 don't know if this is the end of it, but the behavior now is
2688 don't know if this is the end of it, but the behavior now is
2687 certainly much more correct. Note that coupled with macros,
2689 certainly much more correct. Note that coupled with macros,
2688 slightly surprising (at first) behavior may occur: a macro will in
2690 slightly surprising (at first) behavior may occur: a macro will in
2689 general expand to multiple lines of input, so upon exiting, the
2691 general expand to multiple lines of input, so upon exiting, the
2690 in/out counters will both be bumped by the corresponding amount
2692 in/out counters will both be bumped by the corresponding amount
2691 (as if the macro's contents had been typed interactively). Typing
2693 (as if the macro's contents had been typed interactively). Typing
2692 %hist will reveal the intermediate (silently processed) lines.
2694 %hist will reveal the intermediate (silently processed) lines.
2693
2695
2694 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2696 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2695 pickle to fail (%run was overwriting __main__ and not restoring
2697 pickle to fail (%run was overwriting __main__ and not restoring
2696 it, but pickle relies on __main__ to operate).
2698 it, but pickle relies on __main__ to operate).
2697
2699
2698 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2700 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2699 using properties, but forgot to make the main InteractiveShell
2701 using properties, but forgot to make the main InteractiveShell
2700 class a new-style class. Properties fail silently, and
2702 class a new-style class. Properties fail silently, and
2701 mysteriously, with old-style class (getters work, but
2703 mysteriously, with old-style class (getters work, but
2702 setters don't do anything).
2704 setters don't do anything).
2703
2705
2704 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2706 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2705
2707
2706 * IPython/Magic.py (magic_history): fix history reporting bug (I
2708 * IPython/Magic.py (magic_history): fix history reporting bug (I
2707 know some nasties are still there, I just can't seem to find a
2709 know some nasties are still there, I just can't seem to find a
2708 reproducible test case to track them down; the input history is
2710 reproducible test case to track them down; the input history is
2709 falling out of sync...)
2711 falling out of sync...)
2710
2712
2711 * IPython/iplib.py (handle_shell_escape): fix bug where both
2713 * IPython/iplib.py (handle_shell_escape): fix bug where both
2712 aliases and system accesses where broken for indented code (such
2714 aliases and system accesses where broken for indented code (such
2713 as loops).
2715 as loops).
2714
2716
2715 * IPython/genutils.py (shell): fix small but critical bug for
2717 * IPython/genutils.py (shell): fix small but critical bug for
2716 win32 system access.
2718 win32 system access.
2717
2719
2718 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2720 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2719
2721
2720 * IPython/iplib.py (showtraceback): remove use of the
2722 * IPython/iplib.py (showtraceback): remove use of the
2721 sys.last_{type/value/traceback} structures, which are non
2723 sys.last_{type/value/traceback} structures, which are non
2722 thread-safe.
2724 thread-safe.
2723 (_prefilter): change control flow to ensure that we NEVER
2725 (_prefilter): change control flow to ensure that we NEVER
2724 introspect objects when autocall is off. This will guarantee that
2726 introspect objects when autocall is off. This will guarantee that
2725 having an input line of the form 'x.y', where access to attribute
2727 having an input line of the form 'x.y', where access to attribute
2726 'y' has side effects, doesn't trigger the side effect TWICE. It
2728 'y' has side effects, doesn't trigger the side effect TWICE. It
2727 is important to note that, with autocall on, these side effects
2729 is important to note that, with autocall on, these side effects
2728 can still happen.
2730 can still happen.
2729 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2731 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2730 trio. IPython offers these three kinds of special calls which are
2732 trio. IPython offers these three kinds of special calls which are
2731 not python code, and it's a good thing to have their call method
2733 not python code, and it's a good thing to have their call method
2732 be accessible as pure python functions (not just special syntax at
2734 be accessible as pure python functions (not just special syntax at
2733 the command line). It gives us a better internal implementation
2735 the command line). It gives us a better internal implementation
2734 structure, as well as exposing these for user scripting more
2736 structure, as well as exposing these for user scripting more
2735 cleanly.
2737 cleanly.
2736
2738
2737 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2739 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2738 file. Now that they'll be more likely to be used with the
2740 file. Now that they'll be more likely to be used with the
2739 persistance system (%store), I want to make sure their module path
2741 persistance system (%store), I want to make sure their module path
2740 doesn't change in the future, so that we don't break things for
2742 doesn't change in the future, so that we don't break things for
2741 users' persisted data.
2743 users' persisted data.
2742
2744
2743 * IPython/iplib.py (autoindent_update): move indentation
2745 * IPython/iplib.py (autoindent_update): move indentation
2744 management into the _text_ processing loop, not the keyboard
2746 management into the _text_ processing loop, not the keyboard
2745 interactive one. This is necessary to correctly process non-typed
2747 interactive one. This is necessary to correctly process non-typed
2746 multiline input (such as macros).
2748 multiline input (such as macros).
2747
2749
2748 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2750 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2749 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2751 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2750 which was producing problems in the resulting manual.
2752 which was producing problems in the resulting manual.
2751 (magic_whos): improve reporting of instances (show their class,
2753 (magic_whos): improve reporting of instances (show their class,
2752 instead of simply printing 'instance' which isn't terribly
2754 instead of simply printing 'instance' which isn't terribly
2753 informative).
2755 informative).
2754
2756
2755 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2757 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2756 (minor mods) to support network shares under win32.
2758 (minor mods) to support network shares under win32.
2757
2759
2758 * IPython/winconsole.py (get_console_size): add new winconsole
2760 * IPython/winconsole.py (get_console_size): add new winconsole
2759 module and fixes to page_dumb() to improve its behavior under
2761 module and fixes to page_dumb() to improve its behavior under
2760 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2762 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2761
2763
2762 * IPython/Magic.py (Macro): simplified Macro class to just
2764 * IPython/Magic.py (Macro): simplified Macro class to just
2763 subclass list. We've had only 2.2 compatibility for a very long
2765 subclass list. We've had only 2.2 compatibility for a very long
2764 time, yet I was still avoiding subclassing the builtin types. No
2766 time, yet I was still avoiding subclassing the builtin types. No
2765 more (I'm also starting to use properties, though I won't shift to
2767 more (I'm also starting to use properties, though I won't shift to
2766 2.3-specific features quite yet).
2768 2.3-specific features quite yet).
2767 (magic_store): added Ville's patch for lightweight variable
2769 (magic_store): added Ville's patch for lightweight variable
2768 persistence, after a request on the user list by Matt Wilkie
2770 persistence, after a request on the user list by Matt Wilkie
2769 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2771 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2770 details.
2772 details.
2771
2773
2772 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2774 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2773 changed the default logfile name from 'ipython.log' to
2775 changed the default logfile name from 'ipython.log' to
2774 'ipython_log.py'. These logs are real python files, and now that
2776 'ipython_log.py'. These logs are real python files, and now that
2775 we have much better multiline support, people are more likely to
2777 we have much better multiline support, people are more likely to
2776 want to use them as such. Might as well name them correctly.
2778 want to use them as such. Might as well name them correctly.
2777
2779
2778 * IPython/Magic.py: substantial cleanup. While we can't stop
2780 * IPython/Magic.py: substantial cleanup. While we can't stop
2779 using magics as mixins, due to the existing customizations 'out
2781 using magics as mixins, due to the existing customizations 'out
2780 there' which rely on the mixin naming conventions, at least I
2782 there' which rely on the mixin naming conventions, at least I
2781 cleaned out all cross-class name usage. So once we are OK with
2783 cleaned out all cross-class name usage. So once we are OK with
2782 breaking compatibility, the two systems can be separated.
2784 breaking compatibility, the two systems can be separated.
2783
2785
2784 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2786 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2785 anymore, and the class is a fair bit less hideous as well. New
2787 anymore, and the class is a fair bit less hideous as well. New
2786 features were also introduced: timestamping of input, and logging
2788 features were also introduced: timestamping of input, and logging
2787 of output results. These are user-visible with the -t and -o
2789 of output results. These are user-visible with the -t and -o
2788 options to %logstart. Closes
2790 options to %logstart. Closes
2789 http://www.scipy.net/roundup/ipython/issue11 and a request by
2791 http://www.scipy.net/roundup/ipython/issue11 and a request by
2790 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2792 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2791
2793
2792 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2794 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2793
2795
2794 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2796 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2795 better handle backslashes in paths. See the thread 'More Windows
2797 better handle backslashes in paths. See the thread 'More Windows
2796 questions part 2 - \/ characters revisited' on the iypthon user
2798 questions part 2 - \/ characters revisited' on the iypthon user
2797 list:
2799 list:
2798 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2800 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2799
2801
2800 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2802 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2801
2803
2802 (InteractiveShell.__init__): change threaded shells to not use the
2804 (InteractiveShell.__init__): change threaded shells to not use the
2803 ipython crash handler. This was causing more problems than not,
2805 ipython crash handler. This was causing more problems than not,
2804 as exceptions in the main thread (GUI code, typically) would
2806 as exceptions in the main thread (GUI code, typically) would
2805 always show up as a 'crash', when they really weren't.
2807 always show up as a 'crash', when they really weren't.
2806
2808
2807 The colors and exception mode commands (%colors/%xmode) have been
2809 The colors and exception mode commands (%colors/%xmode) have been
2808 synchronized to also take this into account, so users can get
2810 synchronized to also take this into account, so users can get
2809 verbose exceptions for their threaded code as well. I also added
2811 verbose exceptions for their threaded code as well. I also added
2810 support for activating pdb inside this exception handler as well,
2812 support for activating pdb inside this exception handler as well,
2811 so now GUI authors can use IPython's enhanced pdb at runtime.
2813 so now GUI authors can use IPython's enhanced pdb at runtime.
2812
2814
2813 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2815 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2814 true by default, and add it to the shipped ipythonrc file. Since
2816 true by default, and add it to the shipped ipythonrc file. Since
2815 this asks the user before proceeding, I think it's OK to make it
2817 this asks the user before proceeding, I think it's OK to make it
2816 true by default.
2818 true by default.
2817
2819
2818 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2820 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2819 of the previous special-casing of input in the eval loop. I think
2821 of the previous special-casing of input in the eval loop. I think
2820 this is cleaner, as they really are commands and shouldn't have
2822 this is cleaner, as they really are commands and shouldn't have
2821 a special role in the middle of the core code.
2823 a special role in the middle of the core code.
2822
2824
2823 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2825 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2824
2826
2825 * IPython/iplib.py (edit_syntax_error): added support for
2827 * IPython/iplib.py (edit_syntax_error): added support for
2826 automatically reopening the editor if the file had a syntax error
2828 automatically reopening the editor if the file had a syntax error
2827 in it. Thanks to scottt who provided the patch at:
2829 in it. Thanks to scottt who provided the patch at:
2828 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2830 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2829 version committed).
2831 version committed).
2830
2832
2831 * IPython/iplib.py (handle_normal): add suport for multi-line
2833 * IPython/iplib.py (handle_normal): add suport for multi-line
2832 input with emtpy lines. This fixes
2834 input with emtpy lines. This fixes
2833 http://www.scipy.net/roundup/ipython/issue43 and a similar
2835 http://www.scipy.net/roundup/ipython/issue43 and a similar
2834 discussion on the user list.
2836 discussion on the user list.
2835
2837
2836 WARNING: a behavior change is necessarily introduced to support
2838 WARNING: a behavior change is necessarily introduced to support
2837 blank lines: now a single blank line with whitespace does NOT
2839 blank lines: now a single blank line with whitespace does NOT
2838 break the input loop, which means that when autoindent is on, by
2840 break the input loop, which means that when autoindent is on, by
2839 default hitting return on the next (indented) line does NOT exit.
2841 default hitting return on the next (indented) line does NOT exit.
2840
2842
2841 Instead, to exit a multiline input you can either have:
2843 Instead, to exit a multiline input you can either have:
2842
2844
2843 - TWO whitespace lines (just hit return again), or
2845 - TWO whitespace lines (just hit return again), or
2844 - a single whitespace line of a different length than provided
2846 - a single whitespace line of a different length than provided
2845 by the autoindent (add or remove a space).
2847 by the autoindent (add or remove a space).
2846
2848
2847 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2849 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2848 module to better organize all readline-related functionality.
2850 module to better organize all readline-related functionality.
2849 I've deleted FlexCompleter and put all completion clases here.
2851 I've deleted FlexCompleter and put all completion clases here.
2850
2852
2851 * IPython/iplib.py (raw_input): improve indentation management.
2853 * IPython/iplib.py (raw_input): improve indentation management.
2852 It is now possible to paste indented code with autoindent on, and
2854 It is now possible to paste indented code with autoindent on, and
2853 the code is interpreted correctly (though it still looks bad on
2855 the code is interpreted correctly (though it still looks bad on
2854 screen, due to the line-oriented nature of ipython).
2856 screen, due to the line-oriented nature of ipython).
2855 (MagicCompleter.complete): change behavior so that a TAB key on an
2857 (MagicCompleter.complete): change behavior so that a TAB key on an
2856 otherwise empty line actually inserts a tab, instead of completing
2858 otherwise empty line actually inserts a tab, instead of completing
2857 on the entire global namespace. This makes it easier to use the
2859 on the entire global namespace. This makes it easier to use the
2858 TAB key for indentation. After a request by Hans Meine
2860 TAB key for indentation. After a request by Hans Meine
2859 <hans_meine-AT-gmx.net>
2861 <hans_meine-AT-gmx.net>
2860 (_prefilter): add support so that typing plain 'exit' or 'quit'
2862 (_prefilter): add support so that typing plain 'exit' or 'quit'
2861 does a sensible thing. Originally I tried to deviate as little as
2863 does a sensible thing. Originally I tried to deviate as little as
2862 possible from the default python behavior, but even that one may
2864 possible from the default python behavior, but even that one may
2863 change in this direction (thread on python-dev to that effect).
2865 change in this direction (thread on python-dev to that effect).
2864 Regardless, ipython should do the right thing even if CPython's
2866 Regardless, ipython should do the right thing even if CPython's
2865 '>>>' prompt doesn't.
2867 '>>>' prompt doesn't.
2866 (InteractiveShell): removed subclassing code.InteractiveConsole
2868 (InteractiveShell): removed subclassing code.InteractiveConsole
2867 class. By now we'd overridden just about all of its methods: I've
2869 class. By now we'd overridden just about all of its methods: I've
2868 copied the remaining two over, and now ipython is a standalone
2870 copied the remaining two over, and now ipython is a standalone
2869 class. This will provide a clearer picture for the chainsaw
2871 class. This will provide a clearer picture for the chainsaw
2870 branch refactoring.
2872 branch refactoring.
2871
2873
2872 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2874 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2873
2875
2874 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2876 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2875 failures for objects which break when dir() is called on them.
2877 failures for objects which break when dir() is called on them.
2876
2878
2877 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2879 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2878 distinct local and global namespaces in the completer API. This
2880 distinct local and global namespaces in the completer API. This
2879 change allows us to properly handle completion with distinct
2881 change allows us to properly handle completion with distinct
2880 scopes, including in embedded instances (this had never really
2882 scopes, including in embedded instances (this had never really
2881 worked correctly).
2883 worked correctly).
2882
2884
2883 Note: this introduces a change in the constructor for
2885 Note: this introduces a change in the constructor for
2884 MagicCompleter, as a new global_namespace parameter is now the
2886 MagicCompleter, as a new global_namespace parameter is now the
2885 second argument (the others were bumped one position).
2887 second argument (the others were bumped one position).
2886
2888
2887 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2889 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2888
2890
2889 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2891 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2890 embedded instances (which can be done now thanks to Vivian's
2892 embedded instances (which can be done now thanks to Vivian's
2891 frame-handling fixes for pdb).
2893 frame-handling fixes for pdb).
2892 (InteractiveShell.__init__): Fix namespace handling problem in
2894 (InteractiveShell.__init__): Fix namespace handling problem in
2893 embedded instances. We were overwriting __main__ unconditionally,
2895 embedded instances. We were overwriting __main__ unconditionally,
2894 and this should only be done for 'full' (non-embedded) IPython;
2896 and this should only be done for 'full' (non-embedded) IPython;
2895 embedded instances must respect the caller's __main__. Thanks to
2897 embedded instances must respect the caller's __main__. Thanks to
2896 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2898 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2897
2899
2898 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2900 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2899
2901
2900 * setup.py: added download_url to setup(). This registers the
2902 * setup.py: added download_url to setup(). This registers the
2901 download address at PyPI, which is not only useful to humans
2903 download address at PyPI, which is not only useful to humans
2902 browsing the site, but is also picked up by setuptools (the Eggs
2904 browsing the site, but is also picked up by setuptools (the Eggs
2903 machinery). Thanks to Ville and R. Kern for the info/discussion
2905 machinery). Thanks to Ville and R. Kern for the info/discussion
2904 on this.
2906 on this.
2905
2907
2906 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2908 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2907
2909
2908 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2910 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2909 This brings a lot of nice functionality to the pdb mode, which now
2911 This brings a lot of nice functionality to the pdb mode, which now
2910 has tab-completion, syntax highlighting, and better stack handling
2912 has tab-completion, syntax highlighting, and better stack handling
2911 than before. Many thanks to Vivian De Smedt
2913 than before. Many thanks to Vivian De Smedt
2912 <vivian-AT-vdesmedt.com> for the original patches.
2914 <vivian-AT-vdesmedt.com> for the original patches.
2913
2915
2914 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2916 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2915
2917
2916 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2918 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2917 sequence to consistently accept the banner argument. The
2919 sequence to consistently accept the banner argument. The
2918 inconsistency was tripping SAGE, thanks to Gary Zablackis
2920 inconsistency was tripping SAGE, thanks to Gary Zablackis
2919 <gzabl-AT-yahoo.com> for the report.
2921 <gzabl-AT-yahoo.com> for the report.
2920
2922
2921 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2923 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2922
2924
2923 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2925 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2924 Fix bug where a naked 'alias' call in the ipythonrc file would
2926 Fix bug where a naked 'alias' call in the ipythonrc file would
2925 cause a crash. Bug reported by Jorgen Stenarson.
2927 cause a crash. Bug reported by Jorgen Stenarson.
2926
2928
2927 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2929 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2928
2930
2929 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2931 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2930 startup time.
2932 startup time.
2931
2933
2932 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2934 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2933 instances had introduced a bug with globals in normal code. Now
2935 instances had introduced a bug with globals in normal code. Now
2934 it's working in all cases.
2936 it's working in all cases.
2935
2937
2936 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2938 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2937 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2939 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2938 has been introduced to set the default case sensitivity of the
2940 has been introduced to set the default case sensitivity of the
2939 searches. Users can still select either mode at runtime on a
2941 searches. Users can still select either mode at runtime on a
2940 per-search basis.
2942 per-search basis.
2941
2943
2942 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2944 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2943
2945
2944 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2946 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2945 attributes in wildcard searches for subclasses. Modified version
2947 attributes in wildcard searches for subclasses. Modified version
2946 of a patch by Jorgen.
2948 of a patch by Jorgen.
2947
2949
2948 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2950 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2949
2951
2950 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2952 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2951 embedded instances. I added a user_global_ns attribute to the
2953 embedded instances. I added a user_global_ns attribute to the
2952 InteractiveShell class to handle this.
2954 InteractiveShell class to handle this.
2953
2955
2954 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2956 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2955
2957
2956 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2958 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2957 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2959 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2958 (reported under win32, but may happen also in other platforms).
2960 (reported under win32, but may happen also in other platforms).
2959 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2961 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2960
2962
2961 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2963 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2962
2964
2963 * IPython/Magic.py (magic_psearch): new support for wildcard
2965 * IPython/Magic.py (magic_psearch): new support for wildcard
2964 patterns. Now, typing ?a*b will list all names which begin with a
2966 patterns. Now, typing ?a*b will list all names which begin with a
2965 and end in b, for example. The %psearch magic has full
2967 and end in b, for example. The %psearch magic has full
2966 docstrings. Many thanks to JΓΆrgen Stenarson
2968 docstrings. Many thanks to JΓΆrgen Stenarson
2967 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2969 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2968 implementing this functionality.
2970 implementing this functionality.
2969
2971
2970 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2972 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2971
2973
2972 * Manual: fixed long-standing annoyance of double-dashes (as in
2974 * Manual: fixed long-standing annoyance of double-dashes (as in
2973 --prefix=~, for example) being stripped in the HTML version. This
2975 --prefix=~, for example) being stripped in the HTML version. This
2974 is a latex2html bug, but a workaround was provided. Many thanks
2976 is a latex2html bug, but a workaround was provided. Many thanks
2975 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2977 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2976 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2978 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2977 rolling. This seemingly small issue had tripped a number of users
2979 rolling. This seemingly small issue had tripped a number of users
2978 when first installing, so I'm glad to see it gone.
2980 when first installing, so I'm glad to see it gone.
2979
2981
2980 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2982 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2981
2983
2982 * IPython/Extensions/numeric_formats.py: fix missing import,
2984 * IPython/Extensions/numeric_formats.py: fix missing import,
2983 reported by Stephen Walton.
2985 reported by Stephen Walton.
2984
2986
2985 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2987 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2986
2988
2987 * IPython/demo.py: finish demo module, fully documented now.
2989 * IPython/demo.py: finish demo module, fully documented now.
2988
2990
2989 * IPython/genutils.py (file_read): simple little utility to read a
2991 * IPython/genutils.py (file_read): simple little utility to read a
2990 file and ensure it's closed afterwards.
2992 file and ensure it's closed afterwards.
2991
2993
2992 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2994 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2993
2995
2994 * IPython/demo.py (Demo.__init__): added support for individually
2996 * IPython/demo.py (Demo.__init__): added support for individually
2995 tagging blocks for automatic execution.
2997 tagging blocks for automatic execution.
2996
2998
2997 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2999 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2998 syntax-highlighted python sources, requested by John.
3000 syntax-highlighted python sources, requested by John.
2999
3001
3000 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
3002 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
3001
3003
3002 * IPython/demo.py (Demo.again): fix bug where again() blocks after
3004 * IPython/demo.py (Demo.again): fix bug where again() blocks after
3003 finishing.
3005 finishing.
3004
3006
3005 * IPython/genutils.py (shlex_split): moved from Magic to here,
3007 * IPython/genutils.py (shlex_split): moved from Magic to here,
3006 where all 2.2 compatibility stuff lives. I needed it for demo.py.
3008 where all 2.2 compatibility stuff lives. I needed it for demo.py.
3007
3009
3008 * IPython/demo.py (Demo.__init__): added support for silent
3010 * IPython/demo.py (Demo.__init__): added support for silent
3009 blocks, improved marks as regexps, docstrings written.
3011 blocks, improved marks as regexps, docstrings written.
3010 (Demo.__init__): better docstring, added support for sys.argv.
3012 (Demo.__init__): better docstring, added support for sys.argv.
3011
3013
3012 * IPython/genutils.py (marquee): little utility used by the demo
3014 * IPython/genutils.py (marquee): little utility used by the demo
3013 code, handy in general.
3015 code, handy in general.
3014
3016
3015 * IPython/demo.py (Demo.__init__): new class for interactive
3017 * IPython/demo.py (Demo.__init__): new class for interactive
3016 demos. Not documented yet, I just wrote it in a hurry for
3018 demos. Not documented yet, I just wrote it in a hurry for
3017 scipy'05. Will docstring later.
3019 scipy'05. Will docstring later.
3018
3020
3019 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
3021 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
3020
3022
3021 * IPython/Shell.py (sigint_handler): Drastic simplification which
3023 * IPython/Shell.py (sigint_handler): Drastic simplification which
3022 also seems to make Ctrl-C work correctly across threads! This is
3024 also seems to make Ctrl-C work correctly across threads! This is
3023 so simple, that I can't beleive I'd missed it before. Needs more
3025 so simple, that I can't beleive I'd missed it before. Needs more
3024 testing, though.
3026 testing, though.
3025 (KBINT): Never mind, revert changes. I'm sure I'd tried something
3027 (KBINT): Never mind, revert changes. I'm sure I'd tried something
3026 like this before...
3028 like this before...
3027
3029
3028 * IPython/genutils.py (get_home_dir): add protection against
3030 * IPython/genutils.py (get_home_dir): add protection against
3029 non-dirs in win32 registry.
3031 non-dirs in win32 registry.
3030
3032
3031 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
3033 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
3032 bug where dict was mutated while iterating (pysh crash).
3034 bug where dict was mutated while iterating (pysh crash).
3033
3035
3034 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
3036 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
3035
3037
3036 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
3038 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
3037 spurious newlines added by this routine. After a report by
3039 spurious newlines added by this routine. After a report by
3038 F. Mantegazza.
3040 F. Mantegazza.
3039
3041
3040 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
3042 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
3041
3043
3042 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
3044 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
3043 calls. These were a leftover from the GTK 1.x days, and can cause
3045 calls. These were a leftover from the GTK 1.x days, and can cause
3044 problems in certain cases (after a report by John Hunter).
3046 problems in certain cases (after a report by John Hunter).
3045
3047
3046 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
3048 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
3047 os.getcwd() fails at init time. Thanks to patch from David Remahl
3049 os.getcwd() fails at init time. Thanks to patch from David Remahl
3048 <chmod007-AT-mac.com>.
3050 <chmod007-AT-mac.com>.
3049 (InteractiveShell.__init__): prevent certain special magics from
3051 (InteractiveShell.__init__): prevent certain special magics from
3050 being shadowed by aliases. Closes
3052 being shadowed by aliases. Closes
3051 http://www.scipy.net/roundup/ipython/issue41.
3053 http://www.scipy.net/roundup/ipython/issue41.
3052
3054
3053 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
3055 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
3054
3056
3055 * IPython/iplib.py (InteractiveShell.complete): Added new
3057 * IPython/iplib.py (InteractiveShell.complete): Added new
3056 top-level completion method to expose the completion mechanism
3058 top-level completion method to expose the completion mechanism
3057 beyond readline-based environments.
3059 beyond readline-based environments.
3058
3060
3059 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
3061 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
3060
3062
3061 * tools/ipsvnc (svnversion): fix svnversion capture.
3063 * tools/ipsvnc (svnversion): fix svnversion capture.
3062
3064
3063 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
3065 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
3064 attribute to self, which was missing. Before, it was set by a
3066 attribute to self, which was missing. Before, it was set by a
3065 routine which in certain cases wasn't being called, so the
3067 routine which in certain cases wasn't being called, so the
3066 instance could end up missing the attribute. This caused a crash.
3068 instance could end up missing the attribute. This caused a crash.
3067 Closes http://www.scipy.net/roundup/ipython/issue40.
3069 Closes http://www.scipy.net/roundup/ipython/issue40.
3068
3070
3069 2005-08-16 Fernando Perez <fperez@colorado.edu>
3071 2005-08-16 Fernando Perez <fperez@colorado.edu>
3070
3072
3071 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
3073 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
3072 contains non-string attribute. Closes
3074 contains non-string attribute. Closes
3073 http://www.scipy.net/roundup/ipython/issue38.
3075 http://www.scipy.net/roundup/ipython/issue38.
3074
3076
3075 2005-08-14 Fernando Perez <fperez@colorado.edu>
3077 2005-08-14 Fernando Perez <fperez@colorado.edu>
3076
3078
3077 * tools/ipsvnc: Minor improvements, to add changeset info.
3079 * tools/ipsvnc: Minor improvements, to add changeset info.
3078
3080
3079 2005-08-12 Fernando Perez <fperez@colorado.edu>
3081 2005-08-12 Fernando Perez <fperez@colorado.edu>
3080
3082
3081 * IPython/iplib.py (runsource): remove self.code_to_run_src
3083 * IPython/iplib.py (runsource): remove self.code_to_run_src
3082 attribute. I realized this is nothing more than
3084 attribute. I realized this is nothing more than
3083 '\n'.join(self.buffer), and having the same data in two different
3085 '\n'.join(self.buffer), and having the same data in two different
3084 places is just asking for synchronization bugs. This may impact
3086 places is just asking for synchronization bugs. This may impact
3085 people who have custom exception handlers, so I need to warn
3087 people who have custom exception handlers, so I need to warn
3086 ipython-dev about it (F. Mantegazza may use them).
3088 ipython-dev about it (F. Mantegazza may use them).
3087
3089
3088 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
3090 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
3089
3091
3090 * IPython/genutils.py: fix 2.2 compatibility (generators)
3092 * IPython/genutils.py: fix 2.2 compatibility (generators)
3091
3093
3092 2005-07-18 Fernando Perez <fperez@colorado.edu>
3094 2005-07-18 Fernando Perez <fperez@colorado.edu>
3093
3095
3094 * IPython/genutils.py (get_home_dir): fix to help users with
3096 * IPython/genutils.py (get_home_dir): fix to help users with
3095 invalid $HOME under win32.
3097 invalid $HOME under win32.
3096
3098
3097 2005-07-17 Fernando Perez <fperez@colorado.edu>
3099 2005-07-17 Fernando Perez <fperez@colorado.edu>
3098
3100
3099 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
3101 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
3100 some old hacks and clean up a bit other routines; code should be
3102 some old hacks and clean up a bit other routines; code should be
3101 simpler and a bit faster.
3103 simpler and a bit faster.
3102
3104
3103 * IPython/iplib.py (interact): removed some last-resort attempts
3105 * IPython/iplib.py (interact): removed some last-resort attempts
3104 to survive broken stdout/stderr. That code was only making it
3106 to survive broken stdout/stderr. That code was only making it
3105 harder to abstract out the i/o (necessary for gui integration),
3107 harder to abstract out the i/o (necessary for gui integration),
3106 and the crashes it could prevent were extremely rare in practice
3108 and the crashes it could prevent were extremely rare in practice
3107 (besides being fully user-induced in a pretty violent manner).
3109 (besides being fully user-induced in a pretty violent manner).
3108
3110
3109 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
3111 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
3110 Nothing major yet, but the code is simpler to read; this should
3112 Nothing major yet, but the code is simpler to read; this should
3111 make it easier to do more serious modifications in the future.
3113 make it easier to do more serious modifications in the future.
3112
3114
3113 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
3115 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
3114 which broke in .15 (thanks to a report by Ville).
3116 which broke in .15 (thanks to a report by Ville).
3115
3117
3116 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
3118 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
3117 be quite correct, I know next to nothing about unicode). This
3119 be quite correct, I know next to nothing about unicode). This
3118 will allow unicode strings to be used in prompts, amongst other
3120 will allow unicode strings to be used in prompts, amongst other
3119 cases. It also will prevent ipython from crashing when unicode
3121 cases. It also will prevent ipython from crashing when unicode
3120 shows up unexpectedly in many places. If ascii encoding fails, we
3122 shows up unexpectedly in many places. If ascii encoding fails, we
3121 assume utf_8. Currently the encoding is not a user-visible
3123 assume utf_8. Currently the encoding is not a user-visible
3122 setting, though it could be made so if there is demand for it.
3124 setting, though it could be made so if there is demand for it.
3123
3125
3124 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
3126 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
3125
3127
3126 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
3128 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
3127
3129
3128 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
3130 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
3129
3131
3130 * IPython/genutils.py: Add 2.2 compatibility here, so all other
3132 * IPython/genutils.py: Add 2.2 compatibility here, so all other
3131 code can work transparently for 2.2/2.3.
3133 code can work transparently for 2.2/2.3.
3132
3134
3133 2005-07-16 Fernando Perez <fperez@colorado.edu>
3135 2005-07-16 Fernando Perez <fperez@colorado.edu>
3134
3136
3135 * IPython/ultraTB.py (ExceptionColors): Make a global variable
3137 * IPython/ultraTB.py (ExceptionColors): Make a global variable
3136 out of the color scheme table used for coloring exception
3138 out of the color scheme table used for coloring exception
3137 tracebacks. This allows user code to add new schemes at runtime.
3139 tracebacks. This allows user code to add new schemes at runtime.
3138 This is a minimally modified version of the patch at
3140 This is a minimally modified version of the patch at
3139 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
3141 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
3140 for the contribution.
3142 for the contribution.
3141
3143
3142 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
3144 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
3143 slightly modified version of the patch in
3145 slightly modified version of the patch in
3144 http://www.scipy.net/roundup/ipython/issue34, which also allows me
3146 http://www.scipy.net/roundup/ipython/issue34, which also allows me
3145 to remove the previous try/except solution (which was costlier).
3147 to remove the previous try/except solution (which was costlier).
3146 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
3148 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
3147
3149
3148 2005-06-08 Fernando Perez <fperez@colorado.edu>
3150 2005-06-08 Fernando Perez <fperez@colorado.edu>
3149
3151
3150 * IPython/iplib.py (write/write_err): Add methods to abstract all
3152 * IPython/iplib.py (write/write_err): Add methods to abstract all
3151 I/O a bit more.
3153 I/O a bit more.
3152
3154
3153 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3155 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3154 warning, reported by Aric Hagberg, fix by JD Hunter.
3156 warning, reported by Aric Hagberg, fix by JD Hunter.
3155
3157
3156 2005-06-02 *** Released version 0.6.15
3158 2005-06-02 *** Released version 0.6.15
3157
3159
3158 2005-06-01 Fernando Perez <fperez@colorado.edu>
3160 2005-06-01 Fernando Perez <fperez@colorado.edu>
3159
3161
3160 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3162 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3161 tab-completion of filenames within open-quoted strings. Note that
3163 tab-completion of filenames within open-quoted strings. Note that
3162 this requires that in ~/.ipython/ipythonrc, users change the
3164 this requires that in ~/.ipython/ipythonrc, users change the
3163 readline delimiters configuration to read:
3165 readline delimiters configuration to read:
3164
3166
3165 readline_remove_delims -/~
3167 readline_remove_delims -/~
3166
3168
3167
3169
3168 2005-05-31 *** Released version 0.6.14
3170 2005-05-31 *** Released version 0.6.14
3169
3171
3170 2005-05-29 Fernando Perez <fperez@colorado.edu>
3172 2005-05-29 Fernando Perez <fperez@colorado.edu>
3171
3173
3172 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3174 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3173 with files not on the filesystem. Reported by Eliyahu Sandler
3175 with files not on the filesystem. Reported by Eliyahu Sandler
3174 <eli@gondolin.net>
3176 <eli@gondolin.net>
3175
3177
3176 2005-05-22 Fernando Perez <fperez@colorado.edu>
3178 2005-05-22 Fernando Perez <fperez@colorado.edu>
3177
3179
3178 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3180 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3179 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3181 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3180
3182
3181 2005-05-19 Fernando Perez <fperez@colorado.edu>
3183 2005-05-19 Fernando Perez <fperez@colorado.edu>
3182
3184
3183 * IPython/iplib.py (safe_execfile): close a file which could be
3185 * IPython/iplib.py (safe_execfile): close a file which could be
3184 left open (causing problems in win32, which locks open files).
3186 left open (causing problems in win32, which locks open files).
3185 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3187 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3186
3188
3187 2005-05-18 Fernando Perez <fperez@colorado.edu>
3189 2005-05-18 Fernando Perez <fperez@colorado.edu>
3188
3190
3189 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3191 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3190 keyword arguments correctly to safe_execfile().
3192 keyword arguments correctly to safe_execfile().
3191
3193
3192 2005-05-13 Fernando Perez <fperez@colorado.edu>
3194 2005-05-13 Fernando Perez <fperez@colorado.edu>
3193
3195
3194 * ipython.1: Added info about Qt to manpage, and threads warning
3196 * ipython.1: Added info about Qt to manpage, and threads warning
3195 to usage page (invoked with --help).
3197 to usage page (invoked with --help).
3196
3198
3197 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3199 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3198 new matcher (it goes at the end of the priority list) to do
3200 new matcher (it goes at the end of the priority list) to do
3199 tab-completion on named function arguments. Submitted by George
3201 tab-completion on named function arguments. Submitted by George
3200 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3202 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3201 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3203 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3202 for more details.
3204 for more details.
3203
3205
3204 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3206 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3205 SystemExit exceptions in the script being run. Thanks to a report
3207 SystemExit exceptions in the script being run. Thanks to a report
3206 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3208 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3207 producing very annoying behavior when running unit tests.
3209 producing very annoying behavior when running unit tests.
3208
3210
3209 2005-05-12 Fernando Perez <fperez@colorado.edu>
3211 2005-05-12 Fernando Perez <fperez@colorado.edu>
3210
3212
3211 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3213 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3212 which I'd broken (again) due to a changed regexp. In the process,
3214 which I'd broken (again) due to a changed regexp. In the process,
3213 added ';' as an escape to auto-quote the whole line without
3215 added ';' as an escape to auto-quote the whole line without
3214 splitting its arguments. Thanks to a report by Jerry McRae
3216 splitting its arguments. Thanks to a report by Jerry McRae
3215 <qrs0xyc02-AT-sneakemail.com>.
3217 <qrs0xyc02-AT-sneakemail.com>.
3216
3218
3217 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3219 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3218 possible crashes caused by a TokenError. Reported by Ed Schofield
3220 possible crashes caused by a TokenError. Reported by Ed Schofield
3219 <schofield-AT-ftw.at>.
3221 <schofield-AT-ftw.at>.
3220
3222
3221 2005-05-06 Fernando Perez <fperez@colorado.edu>
3223 2005-05-06 Fernando Perez <fperez@colorado.edu>
3222
3224
3223 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3225 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3224
3226
3225 2005-04-29 Fernando Perez <fperez@colorado.edu>
3227 2005-04-29 Fernando Perez <fperez@colorado.edu>
3226
3228
3227 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3229 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3228 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3230 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3229 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3231 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3230 which provides support for Qt interactive usage (similar to the
3232 which provides support for Qt interactive usage (similar to the
3231 existing one for WX and GTK). This had been often requested.
3233 existing one for WX and GTK). This had been often requested.
3232
3234
3233 2005-04-14 *** Released version 0.6.13
3235 2005-04-14 *** Released version 0.6.13
3234
3236
3235 2005-04-08 Fernando Perez <fperez@colorado.edu>
3237 2005-04-08 Fernando Perez <fperez@colorado.edu>
3236
3238
3237 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3239 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3238 from _ofind, which gets called on almost every input line. Now,
3240 from _ofind, which gets called on almost every input line. Now,
3239 we only try to get docstrings if they are actually going to be
3241 we only try to get docstrings if they are actually going to be
3240 used (the overhead of fetching unnecessary docstrings can be
3242 used (the overhead of fetching unnecessary docstrings can be
3241 noticeable for certain objects, such as Pyro proxies).
3243 noticeable for certain objects, such as Pyro proxies).
3242
3244
3243 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3245 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3244 for completers. For some reason I had been passing them the state
3246 for completers. For some reason I had been passing them the state
3245 variable, which completers never actually need, and was in
3247 variable, which completers never actually need, and was in
3246 conflict with the rlcompleter API. Custom completers ONLY need to
3248 conflict with the rlcompleter API. Custom completers ONLY need to
3247 take the text parameter.
3249 take the text parameter.
3248
3250
3249 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3251 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3250 work correctly in pysh. I've also moved all the logic which used
3252 work correctly in pysh. I've also moved all the logic which used
3251 to be in pysh.py here, which will prevent problems with future
3253 to be in pysh.py here, which will prevent problems with future
3252 upgrades. However, this time I must warn users to update their
3254 upgrades. However, this time I must warn users to update their
3253 pysh profile to include the line
3255 pysh profile to include the line
3254
3256
3255 import_all IPython.Extensions.InterpreterExec
3257 import_all IPython.Extensions.InterpreterExec
3256
3258
3257 because otherwise things won't work for them. They MUST also
3259 because otherwise things won't work for them. They MUST also
3258 delete pysh.py and the line
3260 delete pysh.py and the line
3259
3261
3260 execfile pysh.py
3262 execfile pysh.py
3261
3263
3262 from their ipythonrc-pysh.
3264 from their ipythonrc-pysh.
3263
3265
3264 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3266 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3265 robust in the face of objects whose dir() returns non-strings
3267 robust in the face of objects whose dir() returns non-strings
3266 (which it shouldn't, but some broken libs like ITK do). Thanks to
3268 (which it shouldn't, but some broken libs like ITK do). Thanks to
3267 a patch by John Hunter (implemented differently, though). Also
3269 a patch by John Hunter (implemented differently, though). Also
3268 minor improvements by using .extend instead of + on lists.
3270 minor improvements by using .extend instead of + on lists.
3269
3271
3270 * pysh.py:
3272 * pysh.py:
3271
3273
3272 2005-04-06 Fernando Perez <fperez@colorado.edu>
3274 2005-04-06 Fernando Perez <fperez@colorado.edu>
3273
3275
3274 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3276 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3275 by default, so that all users benefit from it. Those who don't
3277 by default, so that all users benefit from it. Those who don't
3276 want it can still turn it off.
3278 want it can still turn it off.
3277
3279
3278 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3280 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3279 config file, I'd forgotten about this, so users were getting it
3281 config file, I'd forgotten about this, so users were getting it
3280 off by default.
3282 off by default.
3281
3283
3282 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3284 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3283 consistency. Now magics can be called in multiline statements,
3285 consistency. Now magics can be called in multiline statements,
3284 and python variables can be expanded in magic calls via $var.
3286 and python variables can be expanded in magic calls via $var.
3285 This makes the magic system behave just like aliases or !system
3287 This makes the magic system behave just like aliases or !system
3286 calls.
3288 calls.
3287
3289
3288 2005-03-28 Fernando Perez <fperez@colorado.edu>
3290 2005-03-28 Fernando Perez <fperez@colorado.edu>
3289
3291
3290 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3292 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3291 expensive string additions for building command. Add support for
3293 expensive string additions for building command. Add support for
3292 trailing ';' when autocall is used.
3294 trailing ';' when autocall is used.
3293
3295
3294 2005-03-26 Fernando Perez <fperez@colorado.edu>
3296 2005-03-26 Fernando Perez <fperez@colorado.edu>
3295
3297
3296 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3298 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3297 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3299 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3298 ipython.el robust against prompts with any number of spaces
3300 ipython.el robust against prompts with any number of spaces
3299 (including 0) after the ':' character.
3301 (including 0) after the ':' character.
3300
3302
3301 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3303 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3302 continuation prompt, which misled users to think the line was
3304 continuation prompt, which misled users to think the line was
3303 already indented. Closes debian Bug#300847, reported to me by
3305 already indented. Closes debian Bug#300847, reported to me by
3304 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3306 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3305
3307
3306 2005-03-23 Fernando Perez <fperez@colorado.edu>
3308 2005-03-23 Fernando Perez <fperez@colorado.edu>
3307
3309
3308 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3310 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3309 properly aligned if they have embedded newlines.
3311 properly aligned if they have embedded newlines.
3310
3312
3311 * IPython/iplib.py (runlines): Add a public method to expose
3313 * IPython/iplib.py (runlines): Add a public method to expose
3312 IPython's code execution machinery, so that users can run strings
3314 IPython's code execution machinery, so that users can run strings
3313 as if they had been typed at the prompt interactively.
3315 as if they had been typed at the prompt interactively.
3314 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3316 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3315 methods which can call the system shell, but with python variable
3317 methods which can call the system shell, but with python variable
3316 expansion. The three such methods are: __IPYTHON__.system,
3318 expansion. The three such methods are: __IPYTHON__.system,
3317 .getoutput and .getoutputerror. These need to be documented in a
3319 .getoutput and .getoutputerror. These need to be documented in a
3318 'public API' section (to be written) of the manual.
3320 'public API' section (to be written) of the manual.
3319
3321
3320 2005-03-20 Fernando Perez <fperez@colorado.edu>
3322 2005-03-20 Fernando Perez <fperez@colorado.edu>
3321
3323
3322 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3324 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3323 for custom exception handling. This is quite powerful, and it
3325 for custom exception handling. This is quite powerful, and it
3324 allows for user-installable exception handlers which can trap
3326 allows for user-installable exception handlers which can trap
3325 custom exceptions at runtime and treat them separately from
3327 custom exceptions at runtime and treat them separately from
3326 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3328 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3327 Mantegazza <mantegazza-AT-ill.fr>.
3329 Mantegazza <mantegazza-AT-ill.fr>.
3328 (InteractiveShell.set_custom_completer): public API function to
3330 (InteractiveShell.set_custom_completer): public API function to
3329 add new completers at runtime.
3331 add new completers at runtime.
3330
3332
3331 2005-03-19 Fernando Perez <fperez@colorado.edu>
3333 2005-03-19 Fernando Perez <fperez@colorado.edu>
3332
3334
3333 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3335 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3334 allow objects which provide their docstrings via non-standard
3336 allow objects which provide their docstrings via non-standard
3335 mechanisms (like Pyro proxies) to still be inspected by ipython's
3337 mechanisms (like Pyro proxies) to still be inspected by ipython's
3336 ? system.
3338 ? system.
3337
3339
3338 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3340 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3339 automatic capture system. I tried quite hard to make it work
3341 automatic capture system. I tried quite hard to make it work
3340 reliably, and simply failed. I tried many combinations with the
3342 reliably, and simply failed. I tried many combinations with the
3341 subprocess module, but eventually nothing worked in all needed
3343 subprocess module, but eventually nothing worked in all needed
3342 cases (not blocking stdin for the child, duplicating stdout
3344 cases (not blocking stdin for the child, duplicating stdout
3343 without blocking, etc). The new %sc/%sx still do capture to these
3345 without blocking, etc). The new %sc/%sx still do capture to these
3344 magical list/string objects which make shell use much more
3346 magical list/string objects which make shell use much more
3345 conveninent, so not all is lost.
3347 conveninent, so not all is lost.
3346
3348
3347 XXX - FIX MANUAL for the change above!
3349 XXX - FIX MANUAL for the change above!
3348
3350
3349 (runsource): I copied code.py's runsource() into ipython to modify
3351 (runsource): I copied code.py's runsource() into ipython to modify
3350 it a bit. Now the code object and source to be executed are
3352 it a bit. Now the code object and source to be executed are
3351 stored in ipython. This makes this info accessible to third-party
3353 stored in ipython. This makes this info accessible to third-party
3352 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3354 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3353 Mantegazza <mantegazza-AT-ill.fr>.
3355 Mantegazza <mantegazza-AT-ill.fr>.
3354
3356
3355 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3357 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3356 history-search via readline (like C-p/C-n). I'd wanted this for a
3358 history-search via readline (like C-p/C-n). I'd wanted this for a
3357 long time, but only recently found out how to do it. For users
3359 long time, but only recently found out how to do it. For users
3358 who already have their ipythonrc files made and want this, just
3360 who already have their ipythonrc files made and want this, just
3359 add:
3361 add:
3360
3362
3361 readline_parse_and_bind "\e[A": history-search-backward
3363 readline_parse_and_bind "\e[A": history-search-backward
3362 readline_parse_and_bind "\e[B": history-search-forward
3364 readline_parse_and_bind "\e[B": history-search-forward
3363
3365
3364 2005-03-18 Fernando Perez <fperez@colorado.edu>
3366 2005-03-18 Fernando Perez <fperez@colorado.edu>
3365
3367
3366 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3368 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3367 LSString and SList classes which allow transparent conversions
3369 LSString and SList classes which allow transparent conversions
3368 between list mode and whitespace-separated string.
3370 between list mode and whitespace-separated string.
3369 (magic_r): Fix recursion problem in %r.
3371 (magic_r): Fix recursion problem in %r.
3370
3372
3371 * IPython/genutils.py (LSString): New class to be used for
3373 * IPython/genutils.py (LSString): New class to be used for
3372 automatic storage of the results of all alias/system calls in _o
3374 automatic storage of the results of all alias/system calls in _o
3373 and _e (stdout/err). These provide a .l/.list attribute which
3375 and _e (stdout/err). These provide a .l/.list attribute which
3374 does automatic splitting on newlines. This means that for most
3376 does automatic splitting on newlines. This means that for most
3375 uses, you'll never need to do capturing of output with %sc/%sx
3377 uses, you'll never need to do capturing of output with %sc/%sx
3376 anymore, since ipython keeps this always done for you. Note that
3378 anymore, since ipython keeps this always done for you. Note that
3377 only the LAST results are stored, the _o/e variables are
3379 only the LAST results are stored, the _o/e variables are
3378 overwritten on each call. If you need to save their contents
3380 overwritten on each call. If you need to save their contents
3379 further, simply bind them to any other name.
3381 further, simply bind them to any other name.
3380
3382
3381 2005-03-17 Fernando Perez <fperez@colorado.edu>
3383 2005-03-17 Fernando Perez <fperez@colorado.edu>
3382
3384
3383 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3385 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3384 prompt namespace handling.
3386 prompt namespace handling.
3385
3387
3386 2005-03-16 Fernando Perez <fperez@colorado.edu>
3388 2005-03-16 Fernando Perez <fperez@colorado.edu>
3387
3389
3388 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3390 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3389 classic prompts to be '>>> ' (final space was missing, and it
3391 classic prompts to be '>>> ' (final space was missing, and it
3390 trips the emacs python mode).
3392 trips the emacs python mode).
3391 (BasePrompt.__str__): Added safe support for dynamic prompt
3393 (BasePrompt.__str__): Added safe support for dynamic prompt
3392 strings. Now you can set your prompt string to be '$x', and the
3394 strings. Now you can set your prompt string to be '$x', and the
3393 value of x will be printed from your interactive namespace. The
3395 value of x will be printed from your interactive namespace. The
3394 interpolation syntax includes the full Itpl support, so
3396 interpolation syntax includes the full Itpl support, so
3395 ${foo()+x+bar()} is a valid prompt string now, and the function
3397 ${foo()+x+bar()} is a valid prompt string now, and the function
3396 calls will be made at runtime.
3398 calls will be made at runtime.
3397
3399
3398 2005-03-15 Fernando Perez <fperez@colorado.edu>
3400 2005-03-15 Fernando Perez <fperez@colorado.edu>
3399
3401
3400 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3402 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3401 avoid name clashes in pylab. %hist still works, it just forwards
3403 avoid name clashes in pylab. %hist still works, it just forwards
3402 the call to %history.
3404 the call to %history.
3403
3405
3404 2005-03-02 *** Released version 0.6.12
3406 2005-03-02 *** Released version 0.6.12
3405
3407
3406 2005-03-02 Fernando Perez <fperez@colorado.edu>
3408 2005-03-02 Fernando Perez <fperez@colorado.edu>
3407
3409
3408 * IPython/iplib.py (handle_magic): log magic calls properly as
3410 * IPython/iplib.py (handle_magic): log magic calls properly as
3409 ipmagic() function calls.
3411 ipmagic() function calls.
3410
3412
3411 * IPython/Magic.py (magic_time): Improved %time to support
3413 * IPython/Magic.py (magic_time): Improved %time to support
3412 statements and provide wall-clock as well as CPU time.
3414 statements and provide wall-clock as well as CPU time.
3413
3415
3414 2005-02-27 Fernando Perez <fperez@colorado.edu>
3416 2005-02-27 Fernando Perez <fperez@colorado.edu>
3415
3417
3416 * IPython/hooks.py: New hooks module, to expose user-modifiable
3418 * IPython/hooks.py: New hooks module, to expose user-modifiable
3417 IPython functionality in a clean manner. For now only the editor
3419 IPython functionality in a clean manner. For now only the editor
3418 hook is actually written, and other thigns which I intend to turn
3420 hook is actually written, and other thigns which I intend to turn
3419 into proper hooks aren't yet there. The display and prefilter
3421 into proper hooks aren't yet there. The display and prefilter
3420 stuff, for example, should be hooks. But at least now the
3422 stuff, for example, should be hooks. But at least now the
3421 framework is in place, and the rest can be moved here with more
3423 framework is in place, and the rest can be moved here with more
3422 time later. IPython had had a .hooks variable for a long time for
3424 time later. IPython had had a .hooks variable for a long time for
3423 this purpose, but I'd never actually used it for anything.
3425 this purpose, but I'd never actually used it for anything.
3424
3426
3425 2005-02-26 Fernando Perez <fperez@colorado.edu>
3427 2005-02-26 Fernando Perez <fperez@colorado.edu>
3426
3428
3427 * IPython/ipmaker.py (make_IPython): make the default ipython
3429 * IPython/ipmaker.py (make_IPython): make the default ipython
3428 directory be called _ipython under win32, to follow more the
3430 directory be called _ipython under win32, to follow more the
3429 naming peculiarities of that platform (where buggy software like
3431 naming peculiarities of that platform (where buggy software like
3430 Visual Sourcesafe breaks with .named directories). Reported by
3432 Visual Sourcesafe breaks with .named directories). Reported by
3431 Ville Vainio.
3433 Ville Vainio.
3432
3434
3433 2005-02-23 Fernando Perez <fperez@colorado.edu>
3435 2005-02-23 Fernando Perez <fperez@colorado.edu>
3434
3436
3435 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3437 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3436 auto_aliases for win32 which were causing problems. Users can
3438 auto_aliases for win32 which were causing problems. Users can
3437 define the ones they personally like.
3439 define the ones they personally like.
3438
3440
3439 2005-02-21 Fernando Perez <fperez@colorado.edu>
3441 2005-02-21 Fernando Perez <fperez@colorado.edu>
3440
3442
3441 * IPython/Magic.py (magic_time): new magic to time execution of
3443 * IPython/Magic.py (magic_time): new magic to time execution of
3442 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3444 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3443
3445
3444 2005-02-19 Fernando Perez <fperez@colorado.edu>
3446 2005-02-19 Fernando Perez <fperez@colorado.edu>
3445
3447
3446 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3448 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3447 into keys (for prompts, for example).
3449 into keys (for prompts, for example).
3448
3450
3449 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3451 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3450 prompts in case users want them. This introduces a small behavior
3452 prompts in case users want them. This introduces a small behavior
3451 change: ipython does not automatically add a space to all prompts
3453 change: ipython does not automatically add a space to all prompts
3452 anymore. To get the old prompts with a space, users should add it
3454 anymore. To get the old prompts with a space, users should add it
3453 manually to their ipythonrc file, so for example prompt_in1 should
3455 manually to their ipythonrc file, so for example prompt_in1 should
3454 now read 'In [\#]: ' instead of 'In [\#]:'.
3456 now read 'In [\#]: ' instead of 'In [\#]:'.
3455 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3457 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3456 file) to control left-padding of secondary prompts.
3458 file) to control left-padding of secondary prompts.
3457
3459
3458 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3460 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3459 the profiler can't be imported. Fix for Debian, which removed
3461 the profiler can't be imported. Fix for Debian, which removed
3460 profile.py because of License issues. I applied a slightly
3462 profile.py because of License issues. I applied a slightly
3461 modified version of the original Debian patch at
3463 modified version of the original Debian patch at
3462 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3464 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3463
3465
3464 2005-02-17 Fernando Perez <fperez@colorado.edu>
3466 2005-02-17 Fernando Perez <fperez@colorado.edu>
3465
3467
3466 * IPython/genutils.py (native_line_ends): Fix bug which would
3468 * IPython/genutils.py (native_line_ends): Fix bug which would
3467 cause improper line-ends under win32 b/c I was not opening files
3469 cause improper line-ends under win32 b/c I was not opening files
3468 in binary mode. Bug report and fix thanks to Ville.
3470 in binary mode. Bug report and fix thanks to Ville.
3469
3471
3470 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3472 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3471 trying to catch spurious foo[1] autocalls. My fix actually broke
3473 trying to catch spurious foo[1] autocalls. My fix actually broke
3472 ',/' autoquote/call with explicit escape (bad regexp).
3474 ',/' autoquote/call with explicit escape (bad regexp).
3473
3475
3474 2005-02-15 *** Released version 0.6.11
3476 2005-02-15 *** Released version 0.6.11
3475
3477
3476 2005-02-14 Fernando Perez <fperez@colorado.edu>
3478 2005-02-14 Fernando Perez <fperez@colorado.edu>
3477
3479
3478 * IPython/background_jobs.py: New background job management
3480 * IPython/background_jobs.py: New background job management
3479 subsystem. This is implemented via a new set of classes, and
3481 subsystem. This is implemented via a new set of classes, and
3480 IPython now provides a builtin 'jobs' object for background job
3482 IPython now provides a builtin 'jobs' object for background job
3481 execution. A convenience %bg magic serves as a lightweight
3483 execution. A convenience %bg magic serves as a lightweight
3482 frontend for starting the more common type of calls. This was
3484 frontend for starting the more common type of calls. This was
3483 inspired by discussions with B. Granger and the BackgroundCommand
3485 inspired by discussions with B. Granger and the BackgroundCommand
3484 class described in the book Python Scripting for Computational
3486 class described in the book Python Scripting for Computational
3485 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3487 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3486 (although ultimately no code from this text was used, as IPython's
3488 (although ultimately no code from this text was used, as IPython's
3487 system is a separate implementation).
3489 system is a separate implementation).
3488
3490
3489 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3491 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3490 to control the completion of single/double underscore names
3492 to control the completion of single/double underscore names
3491 separately. As documented in the example ipytonrc file, the
3493 separately. As documented in the example ipytonrc file, the
3492 readline_omit__names variable can now be set to 2, to omit even
3494 readline_omit__names variable can now be set to 2, to omit even
3493 single underscore names. Thanks to a patch by Brian Wong
3495 single underscore names. Thanks to a patch by Brian Wong
3494 <BrianWong-AT-AirgoNetworks.Com>.
3496 <BrianWong-AT-AirgoNetworks.Com>.
3495 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3497 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3496 be autocalled as foo([1]) if foo were callable. A problem for
3498 be autocalled as foo([1]) if foo were callable. A problem for
3497 things which are both callable and implement __getitem__.
3499 things which are both callable and implement __getitem__.
3498 (init_readline): Fix autoindentation for win32. Thanks to a patch
3500 (init_readline): Fix autoindentation for win32. Thanks to a patch
3499 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3501 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3500
3502
3501 2005-02-12 Fernando Perez <fperez@colorado.edu>
3503 2005-02-12 Fernando Perez <fperez@colorado.edu>
3502
3504
3503 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3505 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3504 which I had written long ago to sort out user error messages which
3506 which I had written long ago to sort out user error messages which
3505 may occur during startup. This seemed like a good idea initially,
3507 may occur during startup. This seemed like a good idea initially,
3506 but it has proven a disaster in retrospect. I don't want to
3508 but it has proven a disaster in retrospect. I don't want to
3507 change much code for now, so my fix is to set the internal 'debug'
3509 change much code for now, so my fix is to set the internal 'debug'
3508 flag to true everywhere, whose only job was precisely to control
3510 flag to true everywhere, whose only job was precisely to control
3509 this subsystem. This closes issue 28 (as well as avoiding all
3511 this subsystem. This closes issue 28 (as well as avoiding all
3510 sorts of strange hangups which occur from time to time).
3512 sorts of strange hangups which occur from time to time).
3511
3513
3512 2005-02-07 Fernando Perez <fperez@colorado.edu>
3514 2005-02-07 Fernando Perez <fperez@colorado.edu>
3513
3515
3514 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3516 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3515 previous call produced a syntax error.
3517 previous call produced a syntax error.
3516
3518
3517 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3519 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3518 classes without constructor.
3520 classes without constructor.
3519
3521
3520 2005-02-06 Fernando Perez <fperez@colorado.edu>
3522 2005-02-06 Fernando Perez <fperez@colorado.edu>
3521
3523
3522 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3524 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3523 completions with the results of each matcher, so we return results
3525 completions with the results of each matcher, so we return results
3524 to the user from all namespaces. This breaks with ipython
3526 to the user from all namespaces. This breaks with ipython
3525 tradition, but I think it's a nicer behavior. Now you get all
3527 tradition, but I think it's a nicer behavior. Now you get all
3526 possible completions listed, from all possible namespaces (python,
3528 possible completions listed, from all possible namespaces (python,
3527 filesystem, magics...) After a request by John Hunter
3529 filesystem, magics...) After a request by John Hunter
3528 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3530 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3529
3531
3530 2005-02-05 Fernando Perez <fperez@colorado.edu>
3532 2005-02-05 Fernando Perez <fperez@colorado.edu>
3531
3533
3532 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3534 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3533 the call had quote characters in it (the quotes were stripped).
3535 the call had quote characters in it (the quotes were stripped).
3534
3536
3535 2005-01-31 Fernando Perez <fperez@colorado.edu>
3537 2005-01-31 Fernando Perez <fperez@colorado.edu>
3536
3538
3537 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3539 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3538 Itpl.itpl() to make the code more robust against psyco
3540 Itpl.itpl() to make the code more robust against psyco
3539 optimizations.
3541 optimizations.
3540
3542
3541 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3543 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3542 of causing an exception. Quicker, cleaner.
3544 of causing an exception. Quicker, cleaner.
3543
3545
3544 2005-01-28 Fernando Perez <fperez@colorado.edu>
3546 2005-01-28 Fernando Perez <fperez@colorado.edu>
3545
3547
3546 * scripts/ipython_win_post_install.py (install): hardcode
3548 * scripts/ipython_win_post_install.py (install): hardcode
3547 sys.prefix+'python.exe' as the executable path. It turns out that
3549 sys.prefix+'python.exe' as the executable path. It turns out that
3548 during the post-installation run, sys.executable resolves to the
3550 during the post-installation run, sys.executable resolves to the
3549 name of the binary installer! I should report this as a distutils
3551 name of the binary installer! I should report this as a distutils
3550 bug, I think. I updated the .10 release with this tiny fix, to
3552 bug, I think. I updated the .10 release with this tiny fix, to
3551 avoid annoying the lists further.
3553 avoid annoying the lists further.
3552
3554
3553 2005-01-27 *** Released version 0.6.10
3555 2005-01-27 *** Released version 0.6.10
3554
3556
3555 2005-01-27 Fernando Perez <fperez@colorado.edu>
3557 2005-01-27 Fernando Perez <fperez@colorado.edu>
3556
3558
3557 * IPython/numutils.py (norm): Added 'inf' as optional name for
3559 * IPython/numutils.py (norm): Added 'inf' as optional name for
3558 L-infinity norm, included references to mathworld.com for vector
3560 L-infinity norm, included references to mathworld.com for vector
3559 norm definitions.
3561 norm definitions.
3560 (amin/amax): added amin/amax for array min/max. Similar to what
3562 (amin/amax): added amin/amax for array min/max. Similar to what
3561 pylab ships with after the recent reorganization of names.
3563 pylab ships with after the recent reorganization of names.
3562 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3564 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3563
3565
3564 * ipython.el: committed Alex's recent fixes and improvements.
3566 * ipython.el: committed Alex's recent fixes and improvements.
3565 Tested with python-mode from CVS, and it looks excellent. Since
3567 Tested with python-mode from CVS, and it looks excellent. Since
3566 python-mode hasn't released anything in a while, I'm temporarily
3568 python-mode hasn't released anything in a while, I'm temporarily
3567 putting a copy of today's CVS (v 4.70) of python-mode in:
3569 putting a copy of today's CVS (v 4.70) of python-mode in:
3568 http://ipython.scipy.org/tmp/python-mode.el
3570 http://ipython.scipy.org/tmp/python-mode.el
3569
3571
3570 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3572 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3571 sys.executable for the executable name, instead of assuming it's
3573 sys.executable for the executable name, instead of assuming it's
3572 called 'python.exe' (the post-installer would have produced broken
3574 called 'python.exe' (the post-installer would have produced broken
3573 setups on systems with a differently named python binary).
3575 setups on systems with a differently named python binary).
3574
3576
3575 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3577 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3576 references to os.linesep, to make the code more
3578 references to os.linesep, to make the code more
3577 platform-independent. This is also part of the win32 coloring
3579 platform-independent. This is also part of the win32 coloring
3578 fixes.
3580 fixes.
3579
3581
3580 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3582 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3581 lines, which actually cause coloring bugs because the length of
3583 lines, which actually cause coloring bugs because the length of
3582 the line is very difficult to correctly compute with embedded
3584 the line is very difficult to correctly compute with embedded
3583 escapes. This was the source of all the coloring problems under
3585 escapes. This was the source of all the coloring problems under
3584 Win32. I think that _finally_, Win32 users have a properly
3586 Win32. I think that _finally_, Win32 users have a properly
3585 working ipython in all respects. This would never have happened
3587 working ipython in all respects. This would never have happened
3586 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3588 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3587
3589
3588 2005-01-26 *** Released version 0.6.9
3590 2005-01-26 *** Released version 0.6.9
3589
3591
3590 2005-01-25 Fernando Perez <fperez@colorado.edu>
3592 2005-01-25 Fernando Perez <fperez@colorado.edu>
3591
3593
3592 * setup.py: finally, we have a true Windows installer, thanks to
3594 * setup.py: finally, we have a true Windows installer, thanks to
3593 the excellent work of Viktor Ransmayr
3595 the excellent work of Viktor Ransmayr
3594 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3596 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3595 Windows users. The setup routine is quite a bit cleaner thanks to
3597 Windows users. The setup routine is quite a bit cleaner thanks to
3596 this, and the post-install script uses the proper functions to
3598 this, and the post-install script uses the proper functions to
3597 allow a clean de-installation using the standard Windows Control
3599 allow a clean de-installation using the standard Windows Control
3598 Panel.
3600 Panel.
3599
3601
3600 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3602 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3601 environment variable under all OSes (including win32) if
3603 environment variable under all OSes (including win32) if
3602 available. This will give consistency to win32 users who have set
3604 available. This will give consistency to win32 users who have set
3603 this variable for any reason. If os.environ['HOME'] fails, the
3605 this variable for any reason. If os.environ['HOME'] fails, the
3604 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3606 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3605
3607
3606 2005-01-24 Fernando Perez <fperez@colorado.edu>
3608 2005-01-24 Fernando Perez <fperez@colorado.edu>
3607
3609
3608 * IPython/numutils.py (empty_like): add empty_like(), similar to
3610 * IPython/numutils.py (empty_like): add empty_like(), similar to
3609 zeros_like() but taking advantage of the new empty() Numeric routine.
3611 zeros_like() but taking advantage of the new empty() Numeric routine.
3610
3612
3611 2005-01-23 *** Released version 0.6.8
3613 2005-01-23 *** Released version 0.6.8
3612
3614
3613 2005-01-22 Fernando Perez <fperez@colorado.edu>
3615 2005-01-22 Fernando Perez <fperez@colorado.edu>
3614
3616
3615 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3617 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3616 automatic show() calls. After discussing things with JDH, it
3618 automatic show() calls. After discussing things with JDH, it
3617 turns out there are too many corner cases where this can go wrong.
3619 turns out there are too many corner cases where this can go wrong.
3618 It's best not to try to be 'too smart', and simply have ipython
3620 It's best not to try to be 'too smart', and simply have ipython
3619 reproduce as much as possible the default behavior of a normal
3621 reproduce as much as possible the default behavior of a normal
3620 python shell.
3622 python shell.
3621
3623
3622 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3624 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3623 line-splitting regexp and _prefilter() to avoid calling getattr()
3625 line-splitting regexp and _prefilter() to avoid calling getattr()
3624 on assignments. This closes
3626 on assignments. This closes
3625 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3627 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3626 readline uses getattr(), so a simple <TAB> keypress is still
3628 readline uses getattr(), so a simple <TAB> keypress is still
3627 enough to trigger getattr() calls on an object.
3629 enough to trigger getattr() calls on an object.
3628
3630
3629 2005-01-21 Fernando Perez <fperez@colorado.edu>
3631 2005-01-21 Fernando Perez <fperez@colorado.edu>
3630
3632
3631 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3633 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3632 docstring under pylab so it doesn't mask the original.
3634 docstring under pylab so it doesn't mask the original.
3633
3635
3634 2005-01-21 *** Released version 0.6.7
3636 2005-01-21 *** Released version 0.6.7
3635
3637
3636 2005-01-21 Fernando Perez <fperez@colorado.edu>
3638 2005-01-21 Fernando Perez <fperez@colorado.edu>
3637
3639
3638 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3640 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3639 signal handling for win32 users in multithreaded mode.
3641 signal handling for win32 users in multithreaded mode.
3640
3642
3641 2005-01-17 Fernando Perez <fperez@colorado.edu>
3643 2005-01-17 Fernando Perez <fperez@colorado.edu>
3642
3644
3643 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3645 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3644 instances with no __init__. After a crash report by Norbert Nemec
3646 instances with no __init__. After a crash report by Norbert Nemec
3645 <Norbert-AT-nemec-online.de>.
3647 <Norbert-AT-nemec-online.de>.
3646
3648
3647 2005-01-14 Fernando Perez <fperez@colorado.edu>
3649 2005-01-14 Fernando Perez <fperez@colorado.edu>
3648
3650
3649 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3651 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3650 names for verbose exceptions, when multiple dotted names and the
3652 names for verbose exceptions, when multiple dotted names and the
3651 'parent' object were present on the same line.
3653 'parent' object were present on the same line.
3652
3654
3653 2005-01-11 Fernando Perez <fperez@colorado.edu>
3655 2005-01-11 Fernando Perez <fperez@colorado.edu>
3654
3656
3655 * IPython/genutils.py (flag_calls): new utility to trap and flag
3657 * IPython/genutils.py (flag_calls): new utility to trap and flag
3656 calls in functions. I need it to clean up matplotlib support.
3658 calls in functions. I need it to clean up matplotlib support.
3657 Also removed some deprecated code in genutils.
3659 Also removed some deprecated code in genutils.
3658
3660
3659 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3661 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3660 that matplotlib scripts called with %run, which don't call show()
3662 that matplotlib scripts called with %run, which don't call show()
3661 themselves, still have their plotting windows open.
3663 themselves, still have their plotting windows open.
3662
3664
3663 2005-01-05 Fernando Perez <fperez@colorado.edu>
3665 2005-01-05 Fernando Perez <fperez@colorado.edu>
3664
3666
3665 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3667 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3666 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3668 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3667
3669
3668 2004-12-19 Fernando Perez <fperez@colorado.edu>
3670 2004-12-19 Fernando Perez <fperez@colorado.edu>
3669
3671
3670 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3672 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3671 parent_runcode, which was an eyesore. The same result can be
3673 parent_runcode, which was an eyesore. The same result can be
3672 obtained with Python's regular superclass mechanisms.
3674 obtained with Python's regular superclass mechanisms.
3673
3675
3674 2004-12-17 Fernando Perez <fperez@colorado.edu>
3676 2004-12-17 Fernando Perez <fperez@colorado.edu>
3675
3677
3676 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3678 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3677 reported by Prabhu.
3679 reported by Prabhu.
3678 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3680 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3679 sys.stderr) instead of explicitly calling sys.stderr. This helps
3681 sys.stderr) instead of explicitly calling sys.stderr. This helps
3680 maintain our I/O abstractions clean, for future GUI embeddings.
3682 maintain our I/O abstractions clean, for future GUI embeddings.
3681
3683
3682 * IPython/genutils.py (info): added new utility for sys.stderr
3684 * IPython/genutils.py (info): added new utility for sys.stderr
3683 unified info message handling (thin wrapper around warn()).
3685 unified info message handling (thin wrapper around warn()).
3684
3686
3685 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3687 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3686 composite (dotted) names on verbose exceptions.
3688 composite (dotted) names on verbose exceptions.
3687 (VerboseTB.nullrepr): harden against another kind of errors which
3689 (VerboseTB.nullrepr): harden against another kind of errors which
3688 Python's inspect module can trigger, and which were crashing
3690 Python's inspect module can trigger, and which were crashing
3689 IPython. Thanks to a report by Marco Lombardi
3691 IPython. Thanks to a report by Marco Lombardi
3690 <mlombard-AT-ma010192.hq.eso.org>.
3692 <mlombard-AT-ma010192.hq.eso.org>.
3691
3693
3692 2004-12-13 *** Released version 0.6.6
3694 2004-12-13 *** Released version 0.6.6
3693
3695
3694 2004-12-12 Fernando Perez <fperez@colorado.edu>
3696 2004-12-12 Fernando Perez <fperez@colorado.edu>
3695
3697
3696 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3698 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3697 generated by pygtk upon initialization if it was built without
3699 generated by pygtk upon initialization if it was built without
3698 threads (for matplotlib users). After a crash reported by
3700 threads (for matplotlib users). After a crash reported by
3699 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3701 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3700
3702
3701 * IPython/ipmaker.py (make_IPython): fix small bug in the
3703 * IPython/ipmaker.py (make_IPython): fix small bug in the
3702 import_some parameter for multiple imports.
3704 import_some parameter for multiple imports.
3703
3705
3704 * IPython/iplib.py (ipmagic): simplified the interface of
3706 * IPython/iplib.py (ipmagic): simplified the interface of
3705 ipmagic() to take a single string argument, just as it would be
3707 ipmagic() to take a single string argument, just as it would be
3706 typed at the IPython cmd line.
3708 typed at the IPython cmd line.
3707 (ipalias): Added new ipalias() with an interface identical to
3709 (ipalias): Added new ipalias() with an interface identical to
3708 ipmagic(). This completes exposing a pure python interface to the
3710 ipmagic(). This completes exposing a pure python interface to the
3709 alias and magic system, which can be used in loops or more complex
3711 alias and magic system, which can be used in loops or more complex
3710 code where IPython's automatic line mangling is not active.
3712 code where IPython's automatic line mangling is not active.
3711
3713
3712 * IPython/genutils.py (timing): changed interface of timing to
3714 * IPython/genutils.py (timing): changed interface of timing to
3713 simply run code once, which is the most common case. timings()
3715 simply run code once, which is the most common case. timings()
3714 remains unchanged, for the cases where you want multiple runs.
3716 remains unchanged, for the cases where you want multiple runs.
3715
3717
3716 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3718 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3717 bug where Python2.2 crashes with exec'ing code which does not end
3719 bug where Python2.2 crashes with exec'ing code which does not end
3718 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3720 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3719 before.
3721 before.
3720
3722
3721 2004-12-10 Fernando Perez <fperez@colorado.edu>
3723 2004-12-10 Fernando Perez <fperez@colorado.edu>
3722
3724
3723 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3725 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3724 -t to -T, to accomodate the new -t flag in %run (the %run and
3726 -t to -T, to accomodate the new -t flag in %run (the %run and
3725 %prun options are kind of intermixed, and it's not easy to change
3727 %prun options are kind of intermixed, and it's not easy to change
3726 this with the limitations of python's getopt).
3728 this with the limitations of python's getopt).
3727
3729
3728 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3730 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3729 the execution of scripts. It's not as fine-tuned as timeit.py,
3731 the execution of scripts. It's not as fine-tuned as timeit.py,
3730 but it works from inside ipython (and under 2.2, which lacks
3732 but it works from inside ipython (and under 2.2, which lacks
3731 timeit.py). Optionally a number of runs > 1 can be given for
3733 timeit.py). Optionally a number of runs > 1 can be given for
3732 timing very short-running code.
3734 timing very short-running code.
3733
3735
3734 * IPython/genutils.py (uniq_stable): new routine which returns a
3736 * IPython/genutils.py (uniq_stable): new routine which returns a
3735 list of unique elements in any iterable, but in stable order of
3737 list of unique elements in any iterable, but in stable order of
3736 appearance. I needed this for the ultraTB fixes, and it's a handy
3738 appearance. I needed this for the ultraTB fixes, and it's a handy
3737 utility.
3739 utility.
3738
3740
3739 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3741 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3740 dotted names in Verbose exceptions. This had been broken since
3742 dotted names in Verbose exceptions. This had been broken since
3741 the very start, now x.y will properly be printed in a Verbose
3743 the very start, now x.y will properly be printed in a Verbose
3742 traceback, instead of x being shown and y appearing always as an
3744 traceback, instead of x being shown and y appearing always as an
3743 'undefined global'. Getting this to work was a bit tricky,
3745 'undefined global'. Getting this to work was a bit tricky,
3744 because by default python tokenizers are stateless. Saved by
3746 because by default python tokenizers are stateless. Saved by
3745 python's ability to easily add a bit of state to an arbitrary
3747 python's ability to easily add a bit of state to an arbitrary
3746 function (without needing to build a full-blown callable object).
3748 function (without needing to build a full-blown callable object).
3747
3749
3748 Also big cleanup of this code, which had horrendous runtime
3750 Also big cleanup of this code, which had horrendous runtime
3749 lookups of zillions of attributes for colorization. Moved all
3751 lookups of zillions of attributes for colorization. Moved all
3750 this code into a few templates, which make it cleaner and quicker.
3752 this code into a few templates, which make it cleaner and quicker.
3751
3753
3752 Printout quality was also improved for Verbose exceptions: one
3754 Printout quality was also improved for Verbose exceptions: one
3753 variable per line, and memory addresses are printed (this can be
3755 variable per line, and memory addresses are printed (this can be
3754 quite handy in nasty debugging situations, which is what Verbose
3756 quite handy in nasty debugging situations, which is what Verbose
3755 is for).
3757 is for).
3756
3758
3757 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3759 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3758 the command line as scripts to be loaded by embedded instances.
3760 the command line as scripts to be loaded by embedded instances.
3759 Doing so has the potential for an infinite recursion if there are
3761 Doing so has the potential for an infinite recursion if there are
3760 exceptions thrown in the process. This fixes a strange crash
3762 exceptions thrown in the process. This fixes a strange crash
3761 reported by Philippe MULLER <muller-AT-irit.fr>.
3763 reported by Philippe MULLER <muller-AT-irit.fr>.
3762
3764
3763 2004-12-09 Fernando Perez <fperez@colorado.edu>
3765 2004-12-09 Fernando Perez <fperez@colorado.edu>
3764
3766
3765 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3767 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3766 to reflect new names in matplotlib, which now expose the
3768 to reflect new names in matplotlib, which now expose the
3767 matlab-compatible interface via a pylab module instead of the
3769 matlab-compatible interface via a pylab module instead of the
3768 'matlab' name. The new code is backwards compatible, so users of
3770 'matlab' name. The new code is backwards compatible, so users of
3769 all matplotlib versions are OK. Patch by J. Hunter.
3771 all matplotlib versions are OK. Patch by J. Hunter.
3770
3772
3771 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3773 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3772 of __init__ docstrings for instances (class docstrings are already
3774 of __init__ docstrings for instances (class docstrings are already
3773 automatically printed). Instances with customized docstrings
3775 automatically printed). Instances with customized docstrings
3774 (indep. of the class) are also recognized and all 3 separate
3776 (indep. of the class) are also recognized and all 3 separate
3775 docstrings are printed (instance, class, constructor). After some
3777 docstrings are printed (instance, class, constructor). After some
3776 comments/suggestions by J. Hunter.
3778 comments/suggestions by J. Hunter.
3777
3779
3778 2004-12-05 Fernando Perez <fperez@colorado.edu>
3780 2004-12-05 Fernando Perez <fperez@colorado.edu>
3779
3781
3780 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3782 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3781 warnings when tab-completion fails and triggers an exception.
3783 warnings when tab-completion fails and triggers an exception.
3782
3784
3783 2004-12-03 Fernando Perez <fperez@colorado.edu>
3785 2004-12-03 Fernando Perez <fperez@colorado.edu>
3784
3786
3785 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3787 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3786 be triggered when using 'run -p'. An incorrect option flag was
3788 be triggered when using 'run -p'. An incorrect option flag was
3787 being set ('d' instead of 'D').
3789 being set ('d' instead of 'D').
3788 (manpage): fix missing escaped \- sign.
3790 (manpage): fix missing escaped \- sign.
3789
3791
3790 2004-11-30 *** Released version 0.6.5
3792 2004-11-30 *** Released version 0.6.5
3791
3793
3792 2004-11-30 Fernando Perez <fperez@colorado.edu>
3794 2004-11-30 Fernando Perez <fperez@colorado.edu>
3793
3795
3794 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3796 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3795 setting with -d option.
3797 setting with -d option.
3796
3798
3797 * setup.py (docfiles): Fix problem where the doc glob I was using
3799 * setup.py (docfiles): Fix problem where the doc glob I was using
3798 was COMPLETELY BROKEN. It was giving the right files by pure
3800 was COMPLETELY BROKEN. It was giving the right files by pure
3799 accident, but failed once I tried to include ipython.el. Note:
3801 accident, but failed once I tried to include ipython.el. Note:
3800 glob() does NOT allow you to do exclusion on multiple endings!
3802 glob() does NOT allow you to do exclusion on multiple endings!
3801
3803
3802 2004-11-29 Fernando Perez <fperez@colorado.edu>
3804 2004-11-29 Fernando Perez <fperez@colorado.edu>
3803
3805
3804 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3806 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3805 the manpage as the source. Better formatting & consistency.
3807 the manpage as the source. Better formatting & consistency.
3806
3808
3807 * IPython/Magic.py (magic_run): Added new -d option, to run
3809 * IPython/Magic.py (magic_run): Added new -d option, to run
3808 scripts under the control of the python pdb debugger. Note that
3810 scripts under the control of the python pdb debugger. Note that
3809 this required changing the %prun option -d to -D, to avoid a clash
3811 this required changing the %prun option -d to -D, to avoid a clash
3810 (since %run must pass options to %prun, and getopt is too dumb to
3812 (since %run must pass options to %prun, and getopt is too dumb to
3811 handle options with string values with embedded spaces). Thanks
3813 handle options with string values with embedded spaces). Thanks
3812 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3814 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3813 (magic_who_ls): added type matching to %who and %whos, so that one
3815 (magic_who_ls): added type matching to %who and %whos, so that one
3814 can filter their output to only include variables of certain
3816 can filter their output to only include variables of certain
3815 types. Another suggestion by Matthew.
3817 types. Another suggestion by Matthew.
3816 (magic_whos): Added memory summaries in kb and Mb for arrays.
3818 (magic_whos): Added memory summaries in kb and Mb for arrays.
3817 (magic_who): Improve formatting (break lines every 9 vars).
3819 (magic_who): Improve formatting (break lines every 9 vars).
3818
3820
3819 2004-11-28 Fernando Perez <fperez@colorado.edu>
3821 2004-11-28 Fernando Perez <fperez@colorado.edu>
3820
3822
3821 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3823 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3822 cache when empty lines were present.
3824 cache when empty lines were present.
3823
3825
3824 2004-11-24 Fernando Perez <fperez@colorado.edu>
3826 2004-11-24 Fernando Perez <fperez@colorado.edu>
3825
3827
3826 * IPython/usage.py (__doc__): document the re-activated threading
3828 * IPython/usage.py (__doc__): document the re-activated threading
3827 options for WX and GTK.
3829 options for WX and GTK.
3828
3830
3829 2004-11-23 Fernando Perez <fperez@colorado.edu>
3831 2004-11-23 Fernando Perez <fperez@colorado.edu>
3830
3832
3831 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3833 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3832 the -wthread and -gthread options, along with a new -tk one to try
3834 the -wthread and -gthread options, along with a new -tk one to try
3833 and coordinate Tk threading with wx/gtk. The tk support is very
3835 and coordinate Tk threading with wx/gtk. The tk support is very
3834 platform dependent, since it seems to require Tcl and Tk to be
3836 platform dependent, since it seems to require Tcl and Tk to be
3835 built with threads (Fedora1/2 appears NOT to have it, but in
3837 built with threads (Fedora1/2 appears NOT to have it, but in
3836 Prabhu's Debian boxes it works OK). But even with some Tk
3838 Prabhu's Debian boxes it works OK). But even with some Tk
3837 limitations, this is a great improvement.
3839 limitations, this is a great improvement.
3838
3840
3839 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3841 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3840 info in user prompts. Patch by Prabhu.
3842 info in user prompts. Patch by Prabhu.
3841
3843
3842 2004-11-18 Fernando Perez <fperez@colorado.edu>
3844 2004-11-18 Fernando Perez <fperez@colorado.edu>
3843
3845
3844 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3846 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3845 EOFErrors and bail, to avoid infinite loops if a non-terminating
3847 EOFErrors and bail, to avoid infinite loops if a non-terminating
3846 file is fed into ipython. Patch submitted in issue 19 by user,
3848 file is fed into ipython. Patch submitted in issue 19 by user,
3847 many thanks.
3849 many thanks.
3848
3850
3849 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3851 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3850 autoquote/parens in continuation prompts, which can cause lots of
3852 autoquote/parens in continuation prompts, which can cause lots of
3851 problems. Closes roundup issue 20.
3853 problems. Closes roundup issue 20.
3852
3854
3853 2004-11-17 Fernando Perez <fperez@colorado.edu>
3855 2004-11-17 Fernando Perez <fperez@colorado.edu>
3854
3856
3855 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3857 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3856 reported as debian bug #280505. I'm not sure my local changelog
3858 reported as debian bug #280505. I'm not sure my local changelog
3857 entry has the proper debian format (Jack?).
3859 entry has the proper debian format (Jack?).
3858
3860
3859 2004-11-08 *** Released version 0.6.4
3861 2004-11-08 *** Released version 0.6.4
3860
3862
3861 2004-11-08 Fernando Perez <fperez@colorado.edu>
3863 2004-11-08 Fernando Perez <fperez@colorado.edu>
3862
3864
3863 * IPython/iplib.py (init_readline): Fix exit message for Windows
3865 * IPython/iplib.py (init_readline): Fix exit message for Windows
3864 when readline is active. Thanks to a report by Eric Jones
3866 when readline is active. Thanks to a report by Eric Jones
3865 <eric-AT-enthought.com>.
3867 <eric-AT-enthought.com>.
3866
3868
3867 2004-11-07 Fernando Perez <fperez@colorado.edu>
3869 2004-11-07 Fernando Perez <fperez@colorado.edu>
3868
3870
3869 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3871 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3870 sometimes seen by win2k/cygwin users.
3872 sometimes seen by win2k/cygwin users.
3871
3873
3872 2004-11-06 Fernando Perez <fperez@colorado.edu>
3874 2004-11-06 Fernando Perez <fperez@colorado.edu>
3873
3875
3874 * IPython/iplib.py (interact): Change the handling of %Exit from
3876 * IPython/iplib.py (interact): Change the handling of %Exit from
3875 trying to propagate a SystemExit to an internal ipython flag.
3877 trying to propagate a SystemExit to an internal ipython flag.
3876 This is less elegant than using Python's exception mechanism, but
3878 This is less elegant than using Python's exception mechanism, but
3877 I can't get that to work reliably with threads, so under -pylab
3879 I can't get that to work reliably with threads, so under -pylab
3878 %Exit was hanging IPython. Cross-thread exception handling is
3880 %Exit was hanging IPython. Cross-thread exception handling is
3879 really a bitch. Thaks to a bug report by Stephen Walton
3881 really a bitch. Thaks to a bug report by Stephen Walton
3880 <stephen.walton-AT-csun.edu>.
3882 <stephen.walton-AT-csun.edu>.
3881
3883
3882 2004-11-04 Fernando Perez <fperez@colorado.edu>
3884 2004-11-04 Fernando Perez <fperez@colorado.edu>
3883
3885
3884 * IPython/iplib.py (raw_input_original): store a pointer to the
3886 * IPython/iplib.py (raw_input_original): store a pointer to the
3885 true raw_input to harden against code which can modify it
3887 true raw_input to harden against code which can modify it
3886 (wx.py.PyShell does this and would otherwise crash ipython).
3888 (wx.py.PyShell does this and would otherwise crash ipython).
3887 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3889 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3888
3890
3889 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3891 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3890 Ctrl-C problem, which does not mess up the input line.
3892 Ctrl-C problem, which does not mess up the input line.
3891
3893
3892 2004-11-03 Fernando Perez <fperez@colorado.edu>
3894 2004-11-03 Fernando Perez <fperez@colorado.edu>
3893
3895
3894 * IPython/Release.py: Changed licensing to BSD, in all files.
3896 * IPython/Release.py: Changed licensing to BSD, in all files.
3895 (name): lowercase name for tarball/RPM release.
3897 (name): lowercase name for tarball/RPM release.
3896
3898
3897 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3899 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3898 use throughout ipython.
3900 use throughout ipython.
3899
3901
3900 * IPython/Magic.py (Magic._ofind): Switch to using the new
3902 * IPython/Magic.py (Magic._ofind): Switch to using the new
3901 OInspect.getdoc() function.
3903 OInspect.getdoc() function.
3902
3904
3903 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3905 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3904 of the line currently being canceled via Ctrl-C. It's extremely
3906 of the line currently being canceled via Ctrl-C. It's extremely
3905 ugly, but I don't know how to do it better (the problem is one of
3907 ugly, but I don't know how to do it better (the problem is one of
3906 handling cross-thread exceptions).
3908 handling cross-thread exceptions).
3907
3909
3908 2004-10-28 Fernando Perez <fperez@colorado.edu>
3910 2004-10-28 Fernando Perez <fperez@colorado.edu>
3909
3911
3910 * IPython/Shell.py (signal_handler): add signal handlers to trap
3912 * IPython/Shell.py (signal_handler): add signal handlers to trap
3911 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3913 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3912 report by Francesc Alted.
3914 report by Francesc Alted.
3913
3915
3914 2004-10-21 Fernando Perez <fperez@colorado.edu>
3916 2004-10-21 Fernando Perez <fperez@colorado.edu>
3915
3917
3916 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3918 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3917 to % for pysh syntax extensions.
3919 to % for pysh syntax extensions.
3918
3920
3919 2004-10-09 Fernando Perez <fperez@colorado.edu>
3921 2004-10-09 Fernando Perez <fperez@colorado.edu>
3920
3922
3921 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3923 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3922 arrays to print a more useful summary, without calling str(arr).
3924 arrays to print a more useful summary, without calling str(arr).
3923 This avoids the problem of extremely lengthy computations which
3925 This avoids the problem of extremely lengthy computations which
3924 occur if arr is large, and appear to the user as a system lockup
3926 occur if arr is large, and appear to the user as a system lockup
3925 with 100% cpu activity. After a suggestion by Kristian Sandberg
3927 with 100% cpu activity. After a suggestion by Kristian Sandberg
3926 <Kristian.Sandberg@colorado.edu>.
3928 <Kristian.Sandberg@colorado.edu>.
3927 (Magic.__init__): fix bug in global magic escapes not being
3929 (Magic.__init__): fix bug in global magic escapes not being
3928 correctly set.
3930 correctly set.
3929
3931
3930 2004-10-08 Fernando Perez <fperez@colorado.edu>
3932 2004-10-08 Fernando Perez <fperez@colorado.edu>
3931
3933
3932 * IPython/Magic.py (__license__): change to absolute imports of
3934 * IPython/Magic.py (__license__): change to absolute imports of
3933 ipython's own internal packages, to start adapting to the absolute
3935 ipython's own internal packages, to start adapting to the absolute
3934 import requirement of PEP-328.
3936 import requirement of PEP-328.
3935
3937
3936 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3938 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3937 files, and standardize author/license marks through the Release
3939 files, and standardize author/license marks through the Release
3938 module instead of having per/file stuff (except for files with
3940 module instead of having per/file stuff (except for files with
3939 particular licenses, like the MIT/PSF-licensed codes).
3941 particular licenses, like the MIT/PSF-licensed codes).
3940
3942
3941 * IPython/Debugger.py: remove dead code for python 2.1
3943 * IPython/Debugger.py: remove dead code for python 2.1
3942
3944
3943 2004-10-04 Fernando Perez <fperez@colorado.edu>
3945 2004-10-04 Fernando Perez <fperez@colorado.edu>
3944
3946
3945 * IPython/iplib.py (ipmagic): New function for accessing magics
3947 * IPython/iplib.py (ipmagic): New function for accessing magics
3946 via a normal python function call.
3948 via a normal python function call.
3947
3949
3948 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3950 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3949 from '@' to '%', to accomodate the new @decorator syntax of python
3951 from '@' to '%', to accomodate the new @decorator syntax of python
3950 2.4.
3952 2.4.
3951
3953
3952 2004-09-29 Fernando Perez <fperez@colorado.edu>
3954 2004-09-29 Fernando Perez <fperez@colorado.edu>
3953
3955
3954 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3956 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3955 matplotlib.use to prevent running scripts which try to switch
3957 matplotlib.use to prevent running scripts which try to switch
3956 interactive backends from within ipython. This will just crash
3958 interactive backends from within ipython. This will just crash
3957 the python interpreter, so we can't allow it (but a detailed error
3959 the python interpreter, so we can't allow it (but a detailed error
3958 is given to the user).
3960 is given to the user).
3959
3961
3960 2004-09-28 Fernando Perez <fperez@colorado.edu>
3962 2004-09-28 Fernando Perez <fperez@colorado.edu>
3961
3963
3962 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3964 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3963 matplotlib-related fixes so that using @run with non-matplotlib
3965 matplotlib-related fixes so that using @run with non-matplotlib
3964 scripts doesn't pop up spurious plot windows. This requires
3966 scripts doesn't pop up spurious plot windows. This requires
3965 matplotlib >= 0.63, where I had to make some changes as well.
3967 matplotlib >= 0.63, where I had to make some changes as well.
3966
3968
3967 * IPython/ipmaker.py (make_IPython): update version requirement to
3969 * IPython/ipmaker.py (make_IPython): update version requirement to
3968 python 2.2.
3970 python 2.2.
3969
3971
3970 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3972 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3971 banner arg for embedded customization.
3973 banner arg for embedded customization.
3972
3974
3973 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3975 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3974 explicit uses of __IP as the IPython's instance name. Now things
3976 explicit uses of __IP as the IPython's instance name. Now things
3975 are properly handled via the shell.name value. The actual code
3977 are properly handled via the shell.name value. The actual code
3976 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3978 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3977 is much better than before. I'll clean things completely when the
3979 is much better than before. I'll clean things completely when the
3978 magic stuff gets a real overhaul.
3980 magic stuff gets a real overhaul.
3979
3981
3980 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3982 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3981 minor changes to debian dir.
3983 minor changes to debian dir.
3982
3984
3983 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3985 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3984 pointer to the shell itself in the interactive namespace even when
3986 pointer to the shell itself in the interactive namespace even when
3985 a user-supplied dict is provided. This is needed for embedding
3987 a user-supplied dict is provided. This is needed for embedding
3986 purposes (found by tests with Michel Sanner).
3988 purposes (found by tests with Michel Sanner).
3987
3989
3988 2004-09-27 Fernando Perez <fperez@colorado.edu>
3990 2004-09-27 Fernando Perez <fperez@colorado.edu>
3989
3991
3990 * IPython/UserConfig/ipythonrc: remove []{} from
3992 * IPython/UserConfig/ipythonrc: remove []{} from
3991 readline_remove_delims, so that things like [modname.<TAB> do
3993 readline_remove_delims, so that things like [modname.<TAB> do
3992 proper completion. This disables [].TAB, but that's a less common
3994 proper completion. This disables [].TAB, but that's a less common
3993 case than module names in list comprehensions, for example.
3995 case than module names in list comprehensions, for example.
3994 Thanks to a report by Andrea Riciputi.
3996 Thanks to a report by Andrea Riciputi.
3995
3997
3996 2004-09-09 Fernando Perez <fperez@colorado.edu>
3998 2004-09-09 Fernando Perez <fperez@colorado.edu>
3997
3999
3998 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
4000 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3999 blocking problems in win32 and osx. Fix by John.
4001 blocking problems in win32 and osx. Fix by John.
4000
4002
4001 2004-09-08 Fernando Perez <fperez@colorado.edu>
4003 2004-09-08 Fernando Perez <fperez@colorado.edu>
4002
4004
4003 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
4005 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
4004 for Win32 and OSX. Fix by John Hunter.
4006 for Win32 and OSX. Fix by John Hunter.
4005
4007
4006 2004-08-30 *** Released version 0.6.3
4008 2004-08-30 *** Released version 0.6.3
4007
4009
4008 2004-08-30 Fernando Perez <fperez@colorado.edu>
4010 2004-08-30 Fernando Perez <fperez@colorado.edu>
4009
4011
4010 * setup.py (isfile): Add manpages to list of dependent files to be
4012 * setup.py (isfile): Add manpages to list of dependent files to be
4011 updated.
4013 updated.
4012
4014
4013 2004-08-27 Fernando Perez <fperez@colorado.edu>
4015 2004-08-27 Fernando Perez <fperez@colorado.edu>
4014
4016
4015 * IPython/Shell.py (start): I've disabled -wthread and -gthread
4017 * IPython/Shell.py (start): I've disabled -wthread and -gthread
4016 for now. They don't really work with standalone WX/GTK code
4018 for now. They don't really work with standalone WX/GTK code
4017 (though matplotlib IS working fine with both of those backends).
4019 (though matplotlib IS working fine with both of those backends).
4018 This will neeed much more testing. I disabled most things with
4020 This will neeed much more testing. I disabled most things with
4019 comments, so turning it back on later should be pretty easy.
4021 comments, so turning it back on later should be pretty easy.
4020
4022
4021 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
4023 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
4022 autocalling of expressions like r'foo', by modifying the line
4024 autocalling of expressions like r'foo', by modifying the line
4023 split regexp. Closes
4025 split regexp. Closes
4024 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
4026 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
4025 Riley <ipythonbugs-AT-sabi.net>.
4027 Riley <ipythonbugs-AT-sabi.net>.
4026 (InteractiveShell.mainloop): honor --nobanner with banner
4028 (InteractiveShell.mainloop): honor --nobanner with banner
4027 extensions.
4029 extensions.
4028
4030
4029 * IPython/Shell.py: Significant refactoring of all classes, so
4031 * IPython/Shell.py: Significant refactoring of all classes, so
4030 that we can really support ALL matplotlib backends and threading
4032 that we can really support ALL matplotlib backends and threading
4031 models (John spotted a bug with Tk which required this). Now we
4033 models (John spotted a bug with Tk which required this). Now we
4032 should support single-threaded, WX-threads and GTK-threads, both
4034 should support single-threaded, WX-threads and GTK-threads, both
4033 for generic code and for matplotlib.
4035 for generic code and for matplotlib.
4034
4036
4035 * IPython/ipmaker.py (__call__): Changed -mpthread option to
4037 * IPython/ipmaker.py (__call__): Changed -mpthread option to
4036 -pylab, to simplify things for users. Will also remove the pylab
4038 -pylab, to simplify things for users. Will also remove the pylab
4037 profile, since now all of matplotlib configuration is directly
4039 profile, since now all of matplotlib configuration is directly
4038 handled here. This also reduces startup time.
4040 handled here. This also reduces startup time.
4039
4041
4040 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
4042 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
4041 shell wasn't being correctly called. Also in IPShellWX.
4043 shell wasn't being correctly called. Also in IPShellWX.
4042
4044
4043 * IPython/iplib.py (InteractiveShell.__init__): Added option to
4045 * IPython/iplib.py (InteractiveShell.__init__): Added option to
4044 fine-tune banner.
4046 fine-tune banner.
4045
4047
4046 * IPython/numutils.py (spike): Deprecate these spike functions,
4048 * IPython/numutils.py (spike): Deprecate these spike functions,
4047 delete (long deprecated) gnuplot_exec handler.
4049 delete (long deprecated) gnuplot_exec handler.
4048
4050
4049 2004-08-26 Fernando Perez <fperez@colorado.edu>
4051 2004-08-26 Fernando Perez <fperez@colorado.edu>
4050
4052
4051 * ipython.1: Update for threading options, plus some others which
4053 * ipython.1: Update for threading options, plus some others which
4052 were missing.
4054 were missing.
4053
4055
4054 * IPython/ipmaker.py (__call__): Added -wthread option for
4056 * IPython/ipmaker.py (__call__): Added -wthread option for
4055 wxpython thread handling. Make sure threading options are only
4057 wxpython thread handling. Make sure threading options are only
4056 valid at the command line.
4058 valid at the command line.
4057
4059
4058 * scripts/ipython: moved shell selection into a factory function
4060 * scripts/ipython: moved shell selection into a factory function
4059 in Shell.py, to keep the starter script to a minimum.
4061 in Shell.py, to keep the starter script to a minimum.
4060
4062
4061 2004-08-25 Fernando Perez <fperez@colorado.edu>
4063 2004-08-25 Fernando Perez <fperez@colorado.edu>
4062
4064
4063 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
4065 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
4064 John. Along with some recent changes he made to matplotlib, the
4066 John. Along with some recent changes he made to matplotlib, the
4065 next versions of both systems should work very well together.
4067 next versions of both systems should work very well together.
4066
4068
4067 2004-08-24 Fernando Perez <fperez@colorado.edu>
4069 2004-08-24 Fernando Perez <fperez@colorado.edu>
4068
4070
4069 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
4071 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
4070 tried to switch the profiling to using hotshot, but I'm getting
4072 tried to switch the profiling to using hotshot, but I'm getting
4071 strange errors from prof.runctx() there. I may be misreading the
4073 strange errors from prof.runctx() there. I may be misreading the
4072 docs, but it looks weird. For now the profiling code will
4074 docs, but it looks weird. For now the profiling code will
4073 continue to use the standard profiler.
4075 continue to use the standard profiler.
4074
4076
4075 2004-08-23 Fernando Perez <fperez@colorado.edu>
4077 2004-08-23 Fernando Perez <fperez@colorado.edu>
4076
4078
4077 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
4079 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
4078 threaded shell, by John Hunter. It's not quite ready yet, but
4080 threaded shell, by John Hunter. It's not quite ready yet, but
4079 close.
4081 close.
4080
4082
4081 2004-08-22 Fernando Perez <fperez@colorado.edu>
4083 2004-08-22 Fernando Perez <fperez@colorado.edu>
4082
4084
4083 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
4085 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
4084 in Magic and ultraTB.
4086 in Magic and ultraTB.
4085
4087
4086 * ipython.1: document threading options in manpage.
4088 * ipython.1: document threading options in manpage.
4087
4089
4088 * scripts/ipython: Changed name of -thread option to -gthread,
4090 * scripts/ipython: Changed name of -thread option to -gthread,
4089 since this is GTK specific. I want to leave the door open for a
4091 since this is GTK specific. I want to leave the door open for a
4090 -wthread option for WX, which will most likely be necessary. This
4092 -wthread option for WX, which will most likely be necessary. This
4091 change affects usage and ipmaker as well.
4093 change affects usage and ipmaker as well.
4092
4094
4093 * IPython/Shell.py (matplotlib_shell): Add a factory function to
4095 * IPython/Shell.py (matplotlib_shell): Add a factory function to
4094 handle the matplotlib shell issues. Code by John Hunter
4096 handle the matplotlib shell issues. Code by John Hunter
4095 <jdhunter-AT-nitace.bsd.uchicago.edu>.
4097 <jdhunter-AT-nitace.bsd.uchicago.edu>.
4096 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
4098 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
4097 broken (and disabled for end users) for now, but it puts the
4099 broken (and disabled for end users) for now, but it puts the
4098 infrastructure in place.
4100 infrastructure in place.
4099
4101
4100 2004-08-21 Fernando Perez <fperez@colorado.edu>
4102 2004-08-21 Fernando Perez <fperez@colorado.edu>
4101
4103
4102 * ipythonrc-pylab: Add matplotlib support.
4104 * ipythonrc-pylab: Add matplotlib support.
4103
4105
4104 * matplotlib_config.py: new files for matplotlib support, part of
4106 * matplotlib_config.py: new files for matplotlib support, part of
4105 the pylab profile.
4107 the pylab profile.
4106
4108
4107 * IPython/usage.py (__doc__): documented the threading options.
4109 * IPython/usage.py (__doc__): documented the threading options.
4108
4110
4109 2004-08-20 Fernando Perez <fperez@colorado.edu>
4111 2004-08-20 Fernando Perez <fperez@colorado.edu>
4110
4112
4111 * ipython: Modified the main calling routine to handle the -thread
4113 * ipython: Modified the main calling routine to handle the -thread
4112 and -mpthread options. This needs to be done as a top-level hack,
4114 and -mpthread options. This needs to be done as a top-level hack,
4113 because it determines which class to instantiate for IPython
4115 because it determines which class to instantiate for IPython
4114 itself.
4116 itself.
4115
4117
4116 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
4118 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
4117 classes to support multithreaded GTK operation without blocking,
4119 classes to support multithreaded GTK operation without blocking,
4118 and matplotlib with all backends. This is a lot of still very
4120 and matplotlib with all backends. This is a lot of still very
4119 experimental code, and threads are tricky. So it may still have a
4121 experimental code, and threads are tricky. So it may still have a
4120 few rough edges... This code owes a lot to
4122 few rough edges... This code owes a lot to
4121 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
4123 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
4122 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
4124 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
4123 to John Hunter for all the matplotlib work.
4125 to John Hunter for all the matplotlib work.
4124
4126
4125 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
4127 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
4126 options for gtk thread and matplotlib support.
4128 options for gtk thread and matplotlib support.
4127
4129
4128 2004-08-16 Fernando Perez <fperez@colorado.edu>
4130 2004-08-16 Fernando Perez <fperez@colorado.edu>
4129
4131
4130 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
4132 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
4131 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
4133 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
4132 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
4134 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
4133
4135
4134 2004-08-11 Fernando Perez <fperez@colorado.edu>
4136 2004-08-11 Fernando Perez <fperez@colorado.edu>
4135
4137
4136 * setup.py (isfile): Fix build so documentation gets updated for
4138 * setup.py (isfile): Fix build so documentation gets updated for
4137 rpms (it was only done for .tgz builds).
4139 rpms (it was only done for .tgz builds).
4138
4140
4139 2004-08-10 Fernando Perez <fperez@colorado.edu>
4141 2004-08-10 Fernando Perez <fperez@colorado.edu>
4140
4142
4141 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
4143 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
4142
4144
4143 * iplib.py : Silence syntax error exceptions in tab-completion.
4145 * iplib.py : Silence syntax error exceptions in tab-completion.
4144
4146
4145 2004-08-05 Fernando Perez <fperez@colorado.edu>
4147 2004-08-05 Fernando Perez <fperez@colorado.edu>
4146
4148
4147 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
4149 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
4148 'color off' mark for continuation prompts. This was causing long
4150 'color off' mark for continuation prompts. This was causing long
4149 continuation lines to mis-wrap.
4151 continuation lines to mis-wrap.
4150
4152
4151 2004-08-01 Fernando Perez <fperez@colorado.edu>
4153 2004-08-01 Fernando Perez <fperez@colorado.edu>
4152
4154
4153 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4155 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4154 for building ipython to be a parameter. All this is necessary
4156 for building ipython to be a parameter. All this is necessary
4155 right now to have a multithreaded version, but this insane
4157 right now to have a multithreaded version, but this insane
4156 non-design will be cleaned up soon. For now, it's a hack that
4158 non-design will be cleaned up soon. For now, it's a hack that
4157 works.
4159 works.
4158
4160
4159 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4161 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4160 args in various places. No bugs so far, but it's a dangerous
4162 args in various places. No bugs so far, but it's a dangerous
4161 practice.
4163 practice.
4162
4164
4163 2004-07-31 Fernando Perez <fperez@colorado.edu>
4165 2004-07-31 Fernando Perez <fperez@colorado.edu>
4164
4166
4165 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4167 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4166 fix completion of files with dots in their names under most
4168 fix completion of files with dots in their names under most
4167 profiles (pysh was OK because the completion order is different).
4169 profiles (pysh was OK because the completion order is different).
4168
4170
4169 2004-07-27 Fernando Perez <fperez@colorado.edu>
4171 2004-07-27 Fernando Perez <fperez@colorado.edu>
4170
4172
4171 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4173 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4172 keywords manually, b/c the one in keyword.py was removed in python
4174 keywords manually, b/c the one in keyword.py was removed in python
4173 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4175 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4174 This is NOT a bug under python 2.3 and earlier.
4176 This is NOT a bug under python 2.3 and earlier.
4175
4177
4176 2004-07-26 Fernando Perez <fperez@colorado.edu>
4178 2004-07-26 Fernando Perez <fperez@colorado.edu>
4177
4179
4178 * IPython/ultraTB.py (VerboseTB.text): Add another
4180 * IPython/ultraTB.py (VerboseTB.text): Add another
4179 linecache.checkcache() call to try to prevent inspect.py from
4181 linecache.checkcache() call to try to prevent inspect.py from
4180 crashing under python 2.3. I think this fixes
4182 crashing under python 2.3. I think this fixes
4181 http://www.scipy.net/roundup/ipython/issue17.
4183 http://www.scipy.net/roundup/ipython/issue17.
4182
4184
4183 2004-07-26 *** Released version 0.6.2
4185 2004-07-26 *** Released version 0.6.2
4184
4186
4185 2004-07-26 Fernando Perez <fperez@colorado.edu>
4187 2004-07-26 Fernando Perez <fperez@colorado.edu>
4186
4188
4187 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4189 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4188 fail for any number.
4190 fail for any number.
4189 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4191 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4190 empty bookmarks.
4192 empty bookmarks.
4191
4193
4192 2004-07-26 *** Released version 0.6.1
4194 2004-07-26 *** Released version 0.6.1
4193
4195
4194 2004-07-26 Fernando Perez <fperez@colorado.edu>
4196 2004-07-26 Fernando Perez <fperez@colorado.edu>
4195
4197
4196 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4198 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4197
4199
4198 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4200 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4199 escaping '()[]{}' in filenames.
4201 escaping '()[]{}' in filenames.
4200
4202
4201 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4203 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4202 Python 2.2 users who lack a proper shlex.split.
4204 Python 2.2 users who lack a proper shlex.split.
4203
4205
4204 2004-07-19 Fernando Perez <fperez@colorado.edu>
4206 2004-07-19 Fernando Perez <fperez@colorado.edu>
4205
4207
4206 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4208 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4207 for reading readline's init file. I follow the normal chain:
4209 for reading readline's init file. I follow the normal chain:
4208 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4210 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4209 report by Mike Heeter. This closes
4211 report by Mike Heeter. This closes
4210 http://www.scipy.net/roundup/ipython/issue16.
4212 http://www.scipy.net/roundup/ipython/issue16.
4211
4213
4212 2004-07-18 Fernando Perez <fperez@colorado.edu>
4214 2004-07-18 Fernando Perez <fperez@colorado.edu>
4213
4215
4214 * IPython/iplib.py (__init__): Add better handling of '\' under
4216 * IPython/iplib.py (__init__): Add better handling of '\' under
4215 Win32 for filenames. After a patch by Ville.
4217 Win32 for filenames. After a patch by Ville.
4216
4218
4217 2004-07-17 Fernando Perez <fperez@colorado.edu>
4219 2004-07-17 Fernando Perez <fperez@colorado.edu>
4218
4220
4219 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4221 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4220 autocalling would be triggered for 'foo is bar' if foo is
4222 autocalling would be triggered for 'foo is bar' if foo is
4221 callable. I also cleaned up the autocall detection code to use a
4223 callable. I also cleaned up the autocall detection code to use a
4222 regexp, which is faster. Bug reported by Alexander Schmolck.
4224 regexp, which is faster. Bug reported by Alexander Schmolck.
4223
4225
4224 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4226 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4225 '?' in them would confuse the help system. Reported by Alex
4227 '?' in them would confuse the help system. Reported by Alex
4226 Schmolck.
4228 Schmolck.
4227
4229
4228 2004-07-16 Fernando Perez <fperez@colorado.edu>
4230 2004-07-16 Fernando Perez <fperez@colorado.edu>
4229
4231
4230 * IPython/GnuplotInteractive.py (__all__): added plot2.
4232 * IPython/GnuplotInteractive.py (__all__): added plot2.
4231
4233
4232 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4234 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4233 plotting dictionaries, lists or tuples of 1d arrays.
4235 plotting dictionaries, lists or tuples of 1d arrays.
4234
4236
4235 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4237 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4236 optimizations.
4238 optimizations.
4237
4239
4238 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4240 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4239 the information which was there from Janko's original IPP code:
4241 the information which was there from Janko's original IPP code:
4240
4242
4241 03.05.99 20:53 porto.ifm.uni-kiel.de
4243 03.05.99 20:53 porto.ifm.uni-kiel.de
4242 --Started changelog.
4244 --Started changelog.
4243 --make clear do what it say it does
4245 --make clear do what it say it does
4244 --added pretty output of lines from inputcache
4246 --added pretty output of lines from inputcache
4245 --Made Logger a mixin class, simplifies handling of switches
4247 --Made Logger a mixin class, simplifies handling of switches
4246 --Added own completer class. .string<TAB> expands to last history
4248 --Added own completer class. .string<TAB> expands to last history
4247 line which starts with string. The new expansion is also present
4249 line which starts with string. The new expansion is also present
4248 with Ctrl-r from the readline library. But this shows, who this
4250 with Ctrl-r from the readline library. But this shows, who this
4249 can be done for other cases.
4251 can be done for other cases.
4250 --Added convention that all shell functions should accept a
4252 --Added convention that all shell functions should accept a
4251 parameter_string This opens the door for different behaviour for
4253 parameter_string This opens the door for different behaviour for
4252 each function. @cd is a good example of this.
4254 each function. @cd is a good example of this.
4253
4255
4254 04.05.99 12:12 porto.ifm.uni-kiel.de
4256 04.05.99 12:12 porto.ifm.uni-kiel.de
4255 --added logfile rotation
4257 --added logfile rotation
4256 --added new mainloop method which freezes first the namespace
4258 --added new mainloop method which freezes first the namespace
4257
4259
4258 07.05.99 21:24 porto.ifm.uni-kiel.de
4260 07.05.99 21:24 porto.ifm.uni-kiel.de
4259 --added the docreader classes. Now there is a help system.
4261 --added the docreader classes. Now there is a help system.
4260 -This is only a first try. Currently it's not easy to put new
4262 -This is only a first try. Currently it's not easy to put new
4261 stuff in the indices. But this is the way to go. Info would be
4263 stuff in the indices. But this is the way to go. Info would be
4262 better, but HTML is every where and not everybody has an info
4264 better, but HTML is every where and not everybody has an info
4263 system installed and it's not so easy to change html-docs to info.
4265 system installed and it's not so easy to change html-docs to info.
4264 --added global logfile option
4266 --added global logfile option
4265 --there is now a hook for object inspection method pinfo needs to
4267 --there is now a hook for object inspection method pinfo needs to
4266 be provided for this. Can be reached by two '??'.
4268 be provided for this. Can be reached by two '??'.
4267
4269
4268 08.05.99 20:51 porto.ifm.uni-kiel.de
4270 08.05.99 20:51 porto.ifm.uni-kiel.de
4269 --added a README
4271 --added a README
4270 --bug in rc file. Something has changed so functions in the rc
4272 --bug in rc file. Something has changed so functions in the rc
4271 file need to reference the shell and not self. Not clear if it's a
4273 file need to reference the shell and not self. Not clear if it's a
4272 bug or feature.
4274 bug or feature.
4273 --changed rc file for new behavior
4275 --changed rc file for new behavior
4274
4276
4275 2004-07-15 Fernando Perez <fperez@colorado.edu>
4277 2004-07-15 Fernando Perez <fperez@colorado.edu>
4276
4278
4277 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4279 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4278 cache was falling out of sync in bizarre manners when multi-line
4280 cache was falling out of sync in bizarre manners when multi-line
4279 input was present. Minor optimizations and cleanup.
4281 input was present. Minor optimizations and cleanup.
4280
4282
4281 (Logger): Remove old Changelog info for cleanup. This is the
4283 (Logger): Remove old Changelog info for cleanup. This is the
4282 information which was there from Janko's original code:
4284 information which was there from Janko's original code:
4283
4285
4284 Changes to Logger: - made the default log filename a parameter
4286 Changes to Logger: - made the default log filename a parameter
4285
4287
4286 - put a check for lines beginning with !@? in log(). Needed
4288 - put a check for lines beginning with !@? in log(). Needed
4287 (even if the handlers properly log their lines) for mid-session
4289 (even if the handlers properly log their lines) for mid-session
4288 logging activation to work properly. Without this, lines logged
4290 logging activation to work properly. Without this, lines logged
4289 in mid session, which get read from the cache, would end up
4291 in mid session, which get read from the cache, would end up
4290 'bare' (with !@? in the open) in the log. Now they are caught
4292 'bare' (with !@? in the open) in the log. Now they are caught
4291 and prepended with a #.
4293 and prepended with a #.
4292
4294
4293 * IPython/iplib.py (InteractiveShell.init_readline): added check
4295 * IPython/iplib.py (InteractiveShell.init_readline): added check
4294 in case MagicCompleter fails to be defined, so we don't crash.
4296 in case MagicCompleter fails to be defined, so we don't crash.
4295
4297
4296 2004-07-13 Fernando Perez <fperez@colorado.edu>
4298 2004-07-13 Fernando Perez <fperez@colorado.edu>
4297
4299
4298 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4300 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4299 of EPS if the requested filename ends in '.eps'.
4301 of EPS if the requested filename ends in '.eps'.
4300
4302
4301 2004-07-04 Fernando Perez <fperez@colorado.edu>
4303 2004-07-04 Fernando Perez <fperez@colorado.edu>
4302
4304
4303 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4305 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4304 escaping of quotes when calling the shell.
4306 escaping of quotes when calling the shell.
4305
4307
4306 2004-07-02 Fernando Perez <fperez@colorado.edu>
4308 2004-07-02 Fernando Perez <fperez@colorado.edu>
4307
4309
4308 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4310 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4309 gettext not working because we were clobbering '_'. Fixes
4311 gettext not working because we were clobbering '_'. Fixes
4310 http://www.scipy.net/roundup/ipython/issue6.
4312 http://www.scipy.net/roundup/ipython/issue6.
4311
4313
4312 2004-07-01 Fernando Perez <fperez@colorado.edu>
4314 2004-07-01 Fernando Perez <fperez@colorado.edu>
4313
4315
4314 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4316 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4315 into @cd. Patch by Ville.
4317 into @cd. Patch by Ville.
4316
4318
4317 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4319 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4318 new function to store things after ipmaker runs. Patch by Ville.
4320 new function to store things after ipmaker runs. Patch by Ville.
4319 Eventually this will go away once ipmaker is removed and the class
4321 Eventually this will go away once ipmaker is removed and the class
4320 gets cleaned up, but for now it's ok. Key functionality here is
4322 gets cleaned up, but for now it's ok. Key functionality here is
4321 the addition of the persistent storage mechanism, a dict for
4323 the addition of the persistent storage mechanism, a dict for
4322 keeping data across sessions (for now just bookmarks, but more can
4324 keeping data across sessions (for now just bookmarks, but more can
4323 be implemented later).
4325 be implemented later).
4324
4326
4325 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4327 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4326 persistent across sections. Patch by Ville, I modified it
4328 persistent across sections. Patch by Ville, I modified it
4327 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4329 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4328 added a '-l' option to list all bookmarks.
4330 added a '-l' option to list all bookmarks.
4329
4331
4330 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4332 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4331 center for cleanup. Registered with atexit.register(). I moved
4333 center for cleanup. Registered with atexit.register(). I moved
4332 here the old exit_cleanup(). After a patch by Ville.
4334 here the old exit_cleanup(). After a patch by Ville.
4333
4335
4334 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4336 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4335 characters in the hacked shlex_split for python 2.2.
4337 characters in the hacked shlex_split for python 2.2.
4336
4338
4337 * IPython/iplib.py (file_matches): more fixes to filenames with
4339 * IPython/iplib.py (file_matches): more fixes to filenames with
4338 whitespace in them. It's not perfect, but limitations in python's
4340 whitespace in them. It's not perfect, but limitations in python's
4339 readline make it impossible to go further.
4341 readline make it impossible to go further.
4340
4342
4341 2004-06-29 Fernando Perez <fperez@colorado.edu>
4343 2004-06-29 Fernando Perez <fperez@colorado.edu>
4342
4344
4343 * IPython/iplib.py (file_matches): escape whitespace correctly in
4345 * IPython/iplib.py (file_matches): escape whitespace correctly in
4344 filename completions. Bug reported by Ville.
4346 filename completions. Bug reported by Ville.
4345
4347
4346 2004-06-28 Fernando Perez <fperez@colorado.edu>
4348 2004-06-28 Fernando Perez <fperez@colorado.edu>
4347
4349
4348 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4350 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4349 the history file will be called 'history-PROFNAME' (or just
4351 the history file will be called 'history-PROFNAME' (or just
4350 'history' if no profile is loaded). I was getting annoyed at
4352 'history' if no profile is loaded). I was getting annoyed at
4351 getting my Numerical work history clobbered by pysh sessions.
4353 getting my Numerical work history clobbered by pysh sessions.
4352
4354
4353 * IPython/iplib.py (InteractiveShell.__init__): Internal
4355 * IPython/iplib.py (InteractiveShell.__init__): Internal
4354 getoutputerror() function so that we can honor the system_verbose
4356 getoutputerror() function so that we can honor the system_verbose
4355 flag for _all_ system calls. I also added escaping of #
4357 flag for _all_ system calls. I also added escaping of #
4356 characters here to avoid confusing Itpl.
4358 characters here to avoid confusing Itpl.
4357
4359
4358 * IPython/Magic.py (shlex_split): removed call to shell in
4360 * IPython/Magic.py (shlex_split): removed call to shell in
4359 parse_options and replaced it with shlex.split(). The annoying
4361 parse_options and replaced it with shlex.split(). The annoying
4360 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4362 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4361 to backport it from 2.3, with several frail hacks (the shlex
4363 to backport it from 2.3, with several frail hacks (the shlex
4362 module is rather limited in 2.2). Thanks to a suggestion by Ville
4364 module is rather limited in 2.2). Thanks to a suggestion by Ville
4363 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4365 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4364 problem.
4366 problem.
4365
4367
4366 (Magic.magic_system_verbose): new toggle to print the actual
4368 (Magic.magic_system_verbose): new toggle to print the actual
4367 system calls made by ipython. Mainly for debugging purposes.
4369 system calls made by ipython. Mainly for debugging purposes.
4368
4370
4369 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4371 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4370 doesn't support persistence. Reported (and fix suggested) by
4372 doesn't support persistence. Reported (and fix suggested) by
4371 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4373 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4372
4374
4373 2004-06-26 Fernando Perez <fperez@colorado.edu>
4375 2004-06-26 Fernando Perez <fperez@colorado.edu>
4374
4376
4375 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4377 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4376 continue prompts.
4378 continue prompts.
4377
4379
4378 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4380 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4379 function (basically a big docstring) and a few more things here to
4381 function (basically a big docstring) and a few more things here to
4380 speedup startup. pysh.py is now very lightweight. We want because
4382 speedup startup. pysh.py is now very lightweight. We want because
4381 it gets execfile'd, while InterpreterExec gets imported, so
4383 it gets execfile'd, while InterpreterExec gets imported, so
4382 byte-compilation saves time.
4384 byte-compilation saves time.
4383
4385
4384 2004-06-25 Fernando Perez <fperez@colorado.edu>
4386 2004-06-25 Fernando Perez <fperez@colorado.edu>
4385
4387
4386 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4388 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4387 -NUM', which was recently broken.
4389 -NUM', which was recently broken.
4388
4390
4389 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4391 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4390 in multi-line input (but not !!, which doesn't make sense there).
4392 in multi-line input (but not !!, which doesn't make sense there).
4391
4393
4392 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4394 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4393 It's just too useful, and people can turn it off in the less
4395 It's just too useful, and people can turn it off in the less
4394 common cases where it's a problem.
4396 common cases where it's a problem.
4395
4397
4396 2004-06-24 Fernando Perez <fperez@colorado.edu>
4398 2004-06-24 Fernando Perez <fperez@colorado.edu>
4397
4399
4398 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4400 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4399 special syntaxes (like alias calling) is now allied in multi-line
4401 special syntaxes (like alias calling) is now allied in multi-line
4400 input. This is still _very_ experimental, but it's necessary for
4402 input. This is still _very_ experimental, but it's necessary for
4401 efficient shell usage combining python looping syntax with system
4403 efficient shell usage combining python looping syntax with system
4402 calls. For now it's restricted to aliases, I don't think it
4404 calls. For now it's restricted to aliases, I don't think it
4403 really even makes sense to have this for magics.
4405 really even makes sense to have this for magics.
4404
4406
4405 2004-06-23 Fernando Perez <fperez@colorado.edu>
4407 2004-06-23 Fernando Perez <fperez@colorado.edu>
4406
4408
4407 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4409 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4408 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4410 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4409
4411
4410 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4412 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4411 extensions under Windows (after code sent by Gary Bishop). The
4413 extensions under Windows (after code sent by Gary Bishop). The
4412 extensions considered 'executable' are stored in IPython's rc
4414 extensions considered 'executable' are stored in IPython's rc
4413 structure as win_exec_ext.
4415 structure as win_exec_ext.
4414
4416
4415 * IPython/genutils.py (shell): new function, like system() but
4417 * IPython/genutils.py (shell): new function, like system() but
4416 without return value. Very useful for interactive shell work.
4418 without return value. Very useful for interactive shell work.
4417
4419
4418 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4420 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4419 delete aliases.
4421 delete aliases.
4420
4422
4421 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4423 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4422 sure that the alias table doesn't contain python keywords.
4424 sure that the alias table doesn't contain python keywords.
4423
4425
4424 2004-06-21 Fernando Perez <fperez@colorado.edu>
4426 2004-06-21 Fernando Perez <fperez@colorado.edu>
4425
4427
4426 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4428 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4427 non-existent items are found in $PATH. Reported by Thorsten.
4429 non-existent items are found in $PATH. Reported by Thorsten.
4428
4430
4429 2004-06-20 Fernando Perez <fperez@colorado.edu>
4431 2004-06-20 Fernando Perez <fperez@colorado.edu>
4430
4432
4431 * IPython/iplib.py (complete): modified the completer so that the
4433 * IPython/iplib.py (complete): modified the completer so that the
4432 order of priorities can be easily changed at runtime.
4434 order of priorities can be easily changed at runtime.
4433
4435
4434 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4436 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4435 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4437 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4436
4438
4437 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4439 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4438 expand Python variables prepended with $ in all system calls. The
4440 expand Python variables prepended with $ in all system calls. The
4439 same was done to InteractiveShell.handle_shell_escape. Now all
4441 same was done to InteractiveShell.handle_shell_escape. Now all
4440 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4442 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4441 expansion of python variables and expressions according to the
4443 expansion of python variables and expressions according to the
4442 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4444 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4443
4445
4444 Though PEP-215 has been rejected, a similar (but simpler) one
4446 Though PEP-215 has been rejected, a similar (but simpler) one
4445 seems like it will go into Python 2.4, PEP-292 -
4447 seems like it will go into Python 2.4, PEP-292 -
4446 http://www.python.org/peps/pep-0292.html.
4448 http://www.python.org/peps/pep-0292.html.
4447
4449
4448 I'll keep the full syntax of PEP-215, since IPython has since the
4450 I'll keep the full syntax of PEP-215, since IPython has since the
4449 start used Ka-Ping Yee's reference implementation discussed there
4451 start used Ka-Ping Yee's reference implementation discussed there
4450 (Itpl), and I actually like the powerful semantics it offers.
4452 (Itpl), and I actually like the powerful semantics it offers.
4451
4453
4452 In order to access normal shell variables, the $ has to be escaped
4454 In order to access normal shell variables, the $ has to be escaped
4453 via an extra $. For example:
4455 via an extra $. For example:
4454
4456
4455 In [7]: PATH='a python variable'
4457 In [7]: PATH='a python variable'
4456
4458
4457 In [8]: !echo $PATH
4459 In [8]: !echo $PATH
4458 a python variable
4460 a python variable
4459
4461
4460 In [9]: !echo $$PATH
4462 In [9]: !echo $$PATH
4461 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4463 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4462
4464
4463 (Magic.parse_options): escape $ so the shell doesn't evaluate
4465 (Magic.parse_options): escape $ so the shell doesn't evaluate
4464 things prematurely.
4466 things prematurely.
4465
4467
4466 * IPython/iplib.py (InteractiveShell.call_alias): added the
4468 * IPython/iplib.py (InteractiveShell.call_alias): added the
4467 ability for aliases to expand python variables via $.
4469 ability for aliases to expand python variables via $.
4468
4470
4469 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4471 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4470 system, now there's a @rehash/@rehashx pair of magics. These work
4472 system, now there's a @rehash/@rehashx pair of magics. These work
4471 like the csh rehash command, and can be invoked at any time. They
4473 like the csh rehash command, and can be invoked at any time. They
4472 build a table of aliases to everything in the user's $PATH
4474 build a table of aliases to everything in the user's $PATH
4473 (@rehash uses everything, @rehashx is slower but only adds
4475 (@rehash uses everything, @rehashx is slower but only adds
4474 executable files). With this, the pysh.py-based shell profile can
4476 executable files). With this, the pysh.py-based shell profile can
4475 now simply call rehash upon startup, and full access to all
4477 now simply call rehash upon startup, and full access to all
4476 programs in the user's path is obtained.
4478 programs in the user's path is obtained.
4477
4479
4478 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4480 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4479 functionality is now fully in place. I removed the old dynamic
4481 functionality is now fully in place. I removed the old dynamic
4480 code generation based approach, in favor of a much lighter one
4482 code generation based approach, in favor of a much lighter one
4481 based on a simple dict. The advantage is that this allows me to
4483 based on a simple dict. The advantage is that this allows me to
4482 now have thousands of aliases with negligible cost (unthinkable
4484 now have thousands of aliases with negligible cost (unthinkable
4483 with the old system).
4485 with the old system).
4484
4486
4485 2004-06-19 Fernando Perez <fperez@colorado.edu>
4487 2004-06-19 Fernando Perez <fperez@colorado.edu>
4486
4488
4487 * IPython/iplib.py (__init__): extended MagicCompleter class to
4489 * IPython/iplib.py (__init__): extended MagicCompleter class to
4488 also complete (last in priority) on user aliases.
4490 also complete (last in priority) on user aliases.
4489
4491
4490 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4492 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4491 call to eval.
4493 call to eval.
4492 (ItplNS.__init__): Added a new class which functions like Itpl,
4494 (ItplNS.__init__): Added a new class which functions like Itpl,
4493 but allows configuring the namespace for the evaluation to occur
4495 but allows configuring the namespace for the evaluation to occur
4494 in.
4496 in.
4495
4497
4496 2004-06-18 Fernando Perez <fperez@colorado.edu>
4498 2004-06-18 Fernando Perez <fperez@colorado.edu>
4497
4499
4498 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4500 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4499 better message when 'exit' or 'quit' are typed (a common newbie
4501 better message when 'exit' or 'quit' are typed (a common newbie
4500 confusion).
4502 confusion).
4501
4503
4502 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4504 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4503 check for Windows users.
4505 check for Windows users.
4504
4506
4505 * IPython/iplib.py (InteractiveShell.user_setup): removed
4507 * IPython/iplib.py (InteractiveShell.user_setup): removed
4506 disabling of colors for Windows. I'll test at runtime and issue a
4508 disabling of colors for Windows. I'll test at runtime and issue a
4507 warning if Gary's readline isn't found, as to nudge users to
4509 warning if Gary's readline isn't found, as to nudge users to
4508 download it.
4510 download it.
4509
4511
4510 2004-06-16 Fernando Perez <fperez@colorado.edu>
4512 2004-06-16 Fernando Perez <fperez@colorado.edu>
4511
4513
4512 * IPython/genutils.py (Stream.__init__): changed to print errors
4514 * IPython/genutils.py (Stream.__init__): changed to print errors
4513 to sys.stderr. I had a circular dependency here. Now it's
4515 to sys.stderr. I had a circular dependency here. Now it's
4514 possible to run ipython as IDLE's shell (consider this pre-alpha,
4516 possible to run ipython as IDLE's shell (consider this pre-alpha,
4515 since true stdout things end up in the starting terminal instead
4517 since true stdout things end up in the starting terminal instead
4516 of IDLE's out).
4518 of IDLE's out).
4517
4519
4518 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4520 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4519 users who haven't # updated their prompt_in2 definitions. Remove
4521 users who haven't # updated their prompt_in2 definitions. Remove
4520 eventually.
4522 eventually.
4521 (multiple_replace): added credit to original ASPN recipe.
4523 (multiple_replace): added credit to original ASPN recipe.
4522
4524
4523 2004-06-15 Fernando Perez <fperez@colorado.edu>
4525 2004-06-15 Fernando Perez <fperez@colorado.edu>
4524
4526
4525 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4527 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4526 list of auto-defined aliases.
4528 list of auto-defined aliases.
4527
4529
4528 2004-06-13 Fernando Perez <fperez@colorado.edu>
4530 2004-06-13 Fernando Perez <fperez@colorado.edu>
4529
4531
4530 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4532 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4531 install was really requested (so setup.py can be used for other
4533 install was really requested (so setup.py can be used for other
4532 things under Windows).
4534 things under Windows).
4533
4535
4534 2004-06-10 Fernando Perez <fperez@colorado.edu>
4536 2004-06-10 Fernando Perez <fperez@colorado.edu>
4535
4537
4536 * IPython/Logger.py (Logger.create_log): Manually remove any old
4538 * IPython/Logger.py (Logger.create_log): Manually remove any old
4537 backup, since os.remove may fail under Windows. Fixes bug
4539 backup, since os.remove may fail under Windows. Fixes bug
4538 reported by Thorsten.
4540 reported by Thorsten.
4539
4541
4540 2004-06-09 Fernando Perez <fperez@colorado.edu>
4542 2004-06-09 Fernando Perez <fperez@colorado.edu>
4541
4543
4542 * examples/example-embed.py: fixed all references to %n (replaced
4544 * examples/example-embed.py: fixed all references to %n (replaced
4543 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4545 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4544 for all examples and the manual as well.
4546 for all examples and the manual as well.
4545
4547
4546 2004-06-08 Fernando Perez <fperez@colorado.edu>
4548 2004-06-08 Fernando Perez <fperez@colorado.edu>
4547
4549
4548 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4550 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4549 alignment and color management. All 3 prompt subsystems now
4551 alignment and color management. All 3 prompt subsystems now
4550 inherit from BasePrompt.
4552 inherit from BasePrompt.
4551
4553
4552 * tools/release: updates for windows installer build and tag rpms
4554 * tools/release: updates for windows installer build and tag rpms
4553 with python version (since paths are fixed).
4555 with python version (since paths are fixed).
4554
4556
4555 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4557 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4556 which will become eventually obsolete. Also fixed the default
4558 which will become eventually obsolete. Also fixed the default
4557 prompt_in2 to use \D, so at least new users start with the correct
4559 prompt_in2 to use \D, so at least new users start with the correct
4558 defaults.
4560 defaults.
4559 WARNING: Users with existing ipythonrc files will need to apply
4561 WARNING: Users with existing ipythonrc files will need to apply
4560 this fix manually!
4562 this fix manually!
4561
4563
4562 * setup.py: make windows installer (.exe). This is finally the
4564 * setup.py: make windows installer (.exe). This is finally the
4563 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4565 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4564 which I hadn't included because it required Python 2.3 (or recent
4566 which I hadn't included because it required Python 2.3 (or recent
4565 distutils).
4567 distutils).
4566
4568
4567 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4569 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4568 usage of new '\D' escape.
4570 usage of new '\D' escape.
4569
4571
4570 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4572 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4571 lacks os.getuid())
4573 lacks os.getuid())
4572 (CachedOutput.set_colors): Added the ability to turn coloring
4574 (CachedOutput.set_colors): Added the ability to turn coloring
4573 on/off with @colors even for manually defined prompt colors. It
4575 on/off with @colors even for manually defined prompt colors. It
4574 uses a nasty global, but it works safely and via the generic color
4576 uses a nasty global, but it works safely and via the generic color
4575 handling mechanism.
4577 handling mechanism.
4576 (Prompt2.__init__): Introduced new escape '\D' for continuation
4578 (Prompt2.__init__): Introduced new escape '\D' for continuation
4577 prompts. It represents the counter ('\#') as dots.
4579 prompts. It represents the counter ('\#') as dots.
4578 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4580 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4579 need to update their ipythonrc files and replace '%n' with '\D' in
4581 need to update their ipythonrc files and replace '%n' with '\D' in
4580 their prompt_in2 settings everywhere. Sorry, but there's
4582 their prompt_in2 settings everywhere. Sorry, but there's
4581 otherwise no clean way to get all prompts to properly align. The
4583 otherwise no clean way to get all prompts to properly align. The
4582 ipythonrc shipped with IPython has been updated.
4584 ipythonrc shipped with IPython has been updated.
4583
4585
4584 2004-06-07 Fernando Perez <fperez@colorado.edu>
4586 2004-06-07 Fernando Perez <fperez@colorado.edu>
4585
4587
4586 * setup.py (isfile): Pass local_icons option to latex2html, so the
4588 * setup.py (isfile): Pass local_icons option to latex2html, so the
4587 resulting HTML file is self-contained. Thanks to
4589 resulting HTML file is self-contained. Thanks to
4588 dryice-AT-liu.com.cn for the tip.
4590 dryice-AT-liu.com.cn for the tip.
4589
4591
4590 * pysh.py: I created a new profile 'shell', which implements a
4592 * pysh.py: I created a new profile 'shell', which implements a
4591 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4593 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4592 system shell, nor will it become one anytime soon. It's mainly
4594 system shell, nor will it become one anytime soon. It's mainly
4593 meant to illustrate the use of the new flexible bash-like prompts.
4595 meant to illustrate the use of the new flexible bash-like prompts.
4594 I guess it could be used by hardy souls for true shell management,
4596 I guess it could be used by hardy souls for true shell management,
4595 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4597 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4596 profile. This uses the InterpreterExec extension provided by
4598 profile. This uses the InterpreterExec extension provided by
4597 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4599 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4598
4600
4599 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4601 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4600 auto-align itself with the length of the previous input prompt
4602 auto-align itself with the length of the previous input prompt
4601 (taking into account the invisible color escapes).
4603 (taking into account the invisible color escapes).
4602 (CachedOutput.__init__): Large restructuring of this class. Now
4604 (CachedOutput.__init__): Large restructuring of this class. Now
4603 all three prompts (primary1, primary2, output) are proper objects,
4605 all three prompts (primary1, primary2, output) are proper objects,
4604 managed by the 'parent' CachedOutput class. The code is still a
4606 managed by the 'parent' CachedOutput class. The code is still a
4605 bit hackish (all prompts share state via a pointer to the cache),
4607 bit hackish (all prompts share state via a pointer to the cache),
4606 but it's overall far cleaner than before.
4608 but it's overall far cleaner than before.
4607
4609
4608 * IPython/genutils.py (getoutputerror): modified to add verbose,
4610 * IPython/genutils.py (getoutputerror): modified to add verbose,
4609 debug and header options. This makes the interface of all getout*
4611 debug and header options. This makes the interface of all getout*
4610 functions uniform.
4612 functions uniform.
4611 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4613 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4612
4614
4613 * IPython/Magic.py (Magic.default_option): added a function to
4615 * IPython/Magic.py (Magic.default_option): added a function to
4614 allow registering default options for any magic command. This
4616 allow registering default options for any magic command. This
4615 makes it easy to have profiles which customize the magics globally
4617 makes it easy to have profiles which customize the magics globally
4616 for a certain use. The values set through this function are
4618 for a certain use. The values set through this function are
4617 picked up by the parse_options() method, which all magics should
4619 picked up by the parse_options() method, which all magics should
4618 use to parse their options.
4620 use to parse their options.
4619
4621
4620 * IPython/genutils.py (warn): modified the warnings framework to
4622 * IPython/genutils.py (warn): modified the warnings framework to
4621 use the Term I/O class. I'm trying to slowly unify all of
4623 use the Term I/O class. I'm trying to slowly unify all of
4622 IPython's I/O operations to pass through Term.
4624 IPython's I/O operations to pass through Term.
4623
4625
4624 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4626 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4625 the secondary prompt to correctly match the length of the primary
4627 the secondary prompt to correctly match the length of the primary
4626 one for any prompt. Now multi-line code will properly line up
4628 one for any prompt. Now multi-line code will properly line up
4627 even for path dependent prompts, such as the new ones available
4629 even for path dependent prompts, such as the new ones available
4628 via the prompt_specials.
4630 via the prompt_specials.
4629
4631
4630 2004-06-06 Fernando Perez <fperez@colorado.edu>
4632 2004-06-06 Fernando Perez <fperez@colorado.edu>
4631
4633
4632 * IPython/Prompts.py (prompt_specials): Added the ability to have
4634 * IPython/Prompts.py (prompt_specials): Added the ability to have
4633 bash-like special sequences in the prompts, which get
4635 bash-like special sequences in the prompts, which get
4634 automatically expanded. Things like hostname, current working
4636 automatically expanded. Things like hostname, current working
4635 directory and username are implemented already, but it's easy to
4637 directory and username are implemented already, but it's easy to
4636 add more in the future. Thanks to a patch by W.J. van der Laan
4638 add more in the future. Thanks to a patch by W.J. van der Laan
4637 <gnufnork-AT-hetdigitalegat.nl>
4639 <gnufnork-AT-hetdigitalegat.nl>
4638 (prompt_specials): Added color support for prompt strings, so
4640 (prompt_specials): Added color support for prompt strings, so
4639 users can define arbitrary color setups for their prompts.
4641 users can define arbitrary color setups for their prompts.
4640
4642
4641 2004-06-05 Fernando Perez <fperez@colorado.edu>
4643 2004-06-05 Fernando Perez <fperez@colorado.edu>
4642
4644
4643 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4645 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4644 code to load Gary Bishop's readline and configure it
4646 code to load Gary Bishop's readline and configure it
4645 automatically. Thanks to Gary for help on this.
4647 automatically. Thanks to Gary for help on this.
4646
4648
4647 2004-06-01 Fernando Perez <fperez@colorado.edu>
4649 2004-06-01 Fernando Perez <fperez@colorado.edu>
4648
4650
4649 * IPython/Logger.py (Logger.create_log): fix bug for logging
4651 * IPython/Logger.py (Logger.create_log): fix bug for logging
4650 with no filename (previous fix was incomplete).
4652 with no filename (previous fix was incomplete).
4651
4653
4652 2004-05-25 Fernando Perez <fperez@colorado.edu>
4654 2004-05-25 Fernando Perez <fperez@colorado.edu>
4653
4655
4654 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4656 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4655 parens would get passed to the shell.
4657 parens would get passed to the shell.
4656
4658
4657 2004-05-20 Fernando Perez <fperez@colorado.edu>
4659 2004-05-20 Fernando Perez <fperez@colorado.edu>
4658
4660
4659 * IPython/Magic.py (Magic.magic_prun): changed default profile
4661 * IPython/Magic.py (Magic.magic_prun): changed default profile
4660 sort order to 'time' (the more common profiling need).
4662 sort order to 'time' (the more common profiling need).
4661
4663
4662 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4664 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4663 so that source code shown is guaranteed in sync with the file on
4665 so that source code shown is guaranteed in sync with the file on
4664 disk (also changed in psource). Similar fix to the one for
4666 disk (also changed in psource). Similar fix to the one for
4665 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4667 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4666 <yann.ledu-AT-noos.fr>.
4668 <yann.ledu-AT-noos.fr>.
4667
4669
4668 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4670 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4669 with a single option would not be correctly parsed. Closes
4671 with a single option would not be correctly parsed. Closes
4670 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4672 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4671 introduced in 0.6.0 (on 2004-05-06).
4673 introduced in 0.6.0 (on 2004-05-06).
4672
4674
4673 2004-05-13 *** Released version 0.6.0
4675 2004-05-13 *** Released version 0.6.0
4674
4676
4675 2004-05-13 Fernando Perez <fperez@colorado.edu>
4677 2004-05-13 Fernando Perez <fperez@colorado.edu>
4676
4678
4677 * debian/: Added debian/ directory to CVS, so that debian support
4679 * debian/: Added debian/ directory to CVS, so that debian support
4678 is publicly accessible. The debian package is maintained by Jack
4680 is publicly accessible. The debian package is maintained by Jack
4679 Moffit <jack-AT-xiph.org>.
4681 Moffit <jack-AT-xiph.org>.
4680
4682
4681 * Documentation: included the notes about an ipython-based system
4683 * Documentation: included the notes about an ipython-based system
4682 shell (the hypothetical 'pysh') into the new_design.pdf document,
4684 shell (the hypothetical 'pysh') into the new_design.pdf document,
4683 so that these ideas get distributed to users along with the
4685 so that these ideas get distributed to users along with the
4684 official documentation.
4686 official documentation.
4685
4687
4686 2004-05-10 Fernando Perez <fperez@colorado.edu>
4688 2004-05-10 Fernando Perez <fperez@colorado.edu>
4687
4689
4688 * IPython/Logger.py (Logger.create_log): fix recently introduced
4690 * IPython/Logger.py (Logger.create_log): fix recently introduced
4689 bug (misindented line) where logstart would fail when not given an
4691 bug (misindented line) where logstart would fail when not given an
4690 explicit filename.
4692 explicit filename.
4691
4693
4692 2004-05-09 Fernando Perez <fperez@colorado.edu>
4694 2004-05-09 Fernando Perez <fperez@colorado.edu>
4693
4695
4694 * IPython/Magic.py (Magic.parse_options): skip system call when
4696 * IPython/Magic.py (Magic.parse_options): skip system call when
4695 there are no options to look for. Faster, cleaner for the common
4697 there are no options to look for. Faster, cleaner for the common
4696 case.
4698 case.
4697
4699
4698 * Documentation: many updates to the manual: describing Windows
4700 * Documentation: many updates to the manual: describing Windows
4699 support better, Gnuplot updates, credits, misc small stuff. Also
4701 support better, Gnuplot updates, credits, misc small stuff. Also
4700 updated the new_design doc a bit.
4702 updated the new_design doc a bit.
4701
4703
4702 2004-05-06 *** Released version 0.6.0.rc1
4704 2004-05-06 *** Released version 0.6.0.rc1
4703
4705
4704 2004-05-06 Fernando Perez <fperez@colorado.edu>
4706 2004-05-06 Fernando Perez <fperez@colorado.edu>
4705
4707
4706 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4708 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4707 operations to use the vastly more efficient list/''.join() method.
4709 operations to use the vastly more efficient list/''.join() method.
4708 (FormattedTB.text): Fix
4710 (FormattedTB.text): Fix
4709 http://www.scipy.net/roundup/ipython/issue12 - exception source
4711 http://www.scipy.net/roundup/ipython/issue12 - exception source
4710 extract not updated after reload. Thanks to Mike Salib
4712 extract not updated after reload. Thanks to Mike Salib
4711 <msalib-AT-mit.edu> for pinning the source of the problem.
4713 <msalib-AT-mit.edu> for pinning the source of the problem.
4712 Fortunately, the solution works inside ipython and doesn't require
4714 Fortunately, the solution works inside ipython and doesn't require
4713 any changes to python proper.
4715 any changes to python proper.
4714
4716
4715 * IPython/Magic.py (Magic.parse_options): Improved to process the
4717 * IPython/Magic.py (Magic.parse_options): Improved to process the
4716 argument list as a true shell would (by actually using the
4718 argument list as a true shell would (by actually using the
4717 underlying system shell). This way, all @magics automatically get
4719 underlying system shell). This way, all @magics automatically get
4718 shell expansion for variables. Thanks to a comment by Alex
4720 shell expansion for variables. Thanks to a comment by Alex
4719 Schmolck.
4721 Schmolck.
4720
4722
4721 2004-04-04 Fernando Perez <fperez@colorado.edu>
4723 2004-04-04 Fernando Perez <fperez@colorado.edu>
4722
4724
4723 * IPython/iplib.py (InteractiveShell.interact): Added a special
4725 * IPython/iplib.py (InteractiveShell.interact): Added a special
4724 trap for a debugger quit exception, which is basically impossible
4726 trap for a debugger quit exception, which is basically impossible
4725 to handle by normal mechanisms, given what pdb does to the stack.
4727 to handle by normal mechanisms, given what pdb does to the stack.
4726 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4728 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4727
4729
4728 2004-04-03 Fernando Perez <fperez@colorado.edu>
4730 2004-04-03 Fernando Perez <fperez@colorado.edu>
4729
4731
4730 * IPython/genutils.py (Term): Standardized the names of the Term
4732 * IPython/genutils.py (Term): Standardized the names of the Term
4731 class streams to cin/cout/cerr, following C++ naming conventions
4733 class streams to cin/cout/cerr, following C++ naming conventions
4732 (I can't use in/out/err because 'in' is not a valid attribute
4734 (I can't use in/out/err because 'in' is not a valid attribute
4733 name).
4735 name).
4734
4736
4735 * IPython/iplib.py (InteractiveShell.interact): don't increment
4737 * IPython/iplib.py (InteractiveShell.interact): don't increment
4736 the prompt if there's no user input. By Daniel 'Dang' Griffith
4738 the prompt if there's no user input. By Daniel 'Dang' Griffith
4737 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4739 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4738 Francois Pinard.
4740 Francois Pinard.
4739
4741
4740 2004-04-02 Fernando Perez <fperez@colorado.edu>
4742 2004-04-02 Fernando Perez <fperez@colorado.edu>
4741
4743
4742 * IPython/genutils.py (Stream.__init__): Modified to survive at
4744 * IPython/genutils.py (Stream.__init__): Modified to survive at
4743 least importing in contexts where stdin/out/err aren't true file
4745 least importing in contexts where stdin/out/err aren't true file
4744 objects, such as PyCrust (they lack fileno() and mode). However,
4746 objects, such as PyCrust (they lack fileno() and mode). However,
4745 the recovery facilities which rely on these things existing will
4747 the recovery facilities which rely on these things existing will
4746 not work.
4748 not work.
4747
4749
4748 2004-04-01 Fernando Perez <fperez@colorado.edu>
4750 2004-04-01 Fernando Perez <fperez@colorado.edu>
4749
4751
4750 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4752 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4751 use the new getoutputerror() function, so it properly
4753 use the new getoutputerror() function, so it properly
4752 distinguishes stdout/err.
4754 distinguishes stdout/err.
4753
4755
4754 * IPython/genutils.py (getoutputerror): added a function to
4756 * IPython/genutils.py (getoutputerror): added a function to
4755 capture separately the standard output and error of a command.
4757 capture separately the standard output and error of a command.
4756 After a comment from dang on the mailing lists. This code is
4758 After a comment from dang on the mailing lists. This code is
4757 basically a modified version of commands.getstatusoutput(), from
4759 basically a modified version of commands.getstatusoutput(), from
4758 the standard library.
4760 the standard library.
4759
4761
4760 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4762 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4761 '!!' as a special syntax (shorthand) to access @sx.
4763 '!!' as a special syntax (shorthand) to access @sx.
4762
4764
4763 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4765 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4764 command and return its output as a list split on '\n'.
4766 command and return its output as a list split on '\n'.
4765
4767
4766 2004-03-31 Fernando Perez <fperez@colorado.edu>
4768 2004-03-31 Fernando Perez <fperez@colorado.edu>
4767
4769
4768 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4770 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4769 method to dictionaries used as FakeModule instances if they lack
4771 method to dictionaries used as FakeModule instances if they lack
4770 it. At least pydoc in python2.3 breaks for runtime-defined
4772 it. At least pydoc in python2.3 breaks for runtime-defined
4771 functions without this hack. At some point I need to _really_
4773 functions without this hack. At some point I need to _really_
4772 understand what FakeModule is doing, because it's a gross hack.
4774 understand what FakeModule is doing, because it's a gross hack.
4773 But it solves Arnd's problem for now...
4775 But it solves Arnd's problem for now...
4774
4776
4775 2004-02-27 Fernando Perez <fperez@colorado.edu>
4777 2004-02-27 Fernando Perez <fperez@colorado.edu>
4776
4778
4777 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4779 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4778 mode would behave erratically. Also increased the number of
4780 mode would behave erratically. Also increased the number of
4779 possible logs in rotate mod to 999. Thanks to Rod Holland
4781 possible logs in rotate mod to 999. Thanks to Rod Holland
4780 <rhh@StructureLABS.com> for the report and fixes.
4782 <rhh@StructureLABS.com> for the report and fixes.
4781
4783
4782 2004-02-26 Fernando Perez <fperez@colorado.edu>
4784 2004-02-26 Fernando Perez <fperez@colorado.edu>
4783
4785
4784 * IPython/genutils.py (page): Check that the curses module really
4786 * IPython/genutils.py (page): Check that the curses module really
4785 has the initscr attribute before trying to use it. For some
4787 has the initscr attribute before trying to use it. For some
4786 reason, the Solaris curses module is missing this. I think this
4788 reason, the Solaris curses module is missing this. I think this
4787 should be considered a Solaris python bug, but I'm not sure.
4789 should be considered a Solaris python bug, but I'm not sure.
4788
4790
4789 2004-01-17 Fernando Perez <fperez@colorado.edu>
4791 2004-01-17 Fernando Perez <fperez@colorado.edu>
4790
4792
4791 * IPython/genutils.py (Stream.__init__): Changes to try to make
4793 * IPython/genutils.py (Stream.__init__): Changes to try to make
4792 ipython robust against stdin/out/err being closed by the user.
4794 ipython robust against stdin/out/err being closed by the user.
4793 This is 'user error' (and blocks a normal python session, at least
4795 This is 'user error' (and blocks a normal python session, at least
4794 the stdout case). However, Ipython should be able to survive such
4796 the stdout case). However, Ipython should be able to survive such
4795 instances of abuse as gracefully as possible. To simplify the
4797 instances of abuse as gracefully as possible. To simplify the
4796 coding and maintain compatibility with Gary Bishop's Term
4798 coding and maintain compatibility with Gary Bishop's Term
4797 contributions, I've made use of classmethods for this. I think
4799 contributions, I've made use of classmethods for this. I think
4798 this introduces a dependency on python 2.2.
4800 this introduces a dependency on python 2.2.
4799
4801
4800 2004-01-13 Fernando Perez <fperez@colorado.edu>
4802 2004-01-13 Fernando Perez <fperez@colorado.edu>
4801
4803
4802 * IPython/numutils.py (exp_safe): simplified the code a bit and
4804 * IPython/numutils.py (exp_safe): simplified the code a bit and
4803 removed the need for importing the kinds module altogether.
4805 removed the need for importing the kinds module altogether.
4804
4806
4805 2004-01-06 Fernando Perez <fperez@colorado.edu>
4807 2004-01-06 Fernando Perez <fperez@colorado.edu>
4806
4808
4807 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4809 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4808 a magic function instead, after some community feedback. No
4810 a magic function instead, after some community feedback. No
4809 special syntax will exist for it, but its name is deliberately
4811 special syntax will exist for it, but its name is deliberately
4810 very short.
4812 very short.
4811
4813
4812 2003-12-20 Fernando Perez <fperez@colorado.edu>
4814 2003-12-20 Fernando Perez <fperez@colorado.edu>
4813
4815
4814 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4816 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4815 new functionality, to automagically assign the result of a shell
4817 new functionality, to automagically assign the result of a shell
4816 command to a variable. I'll solicit some community feedback on
4818 command to a variable. I'll solicit some community feedback on
4817 this before making it permanent.
4819 this before making it permanent.
4818
4820
4819 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4821 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4820 requested about callables for which inspect couldn't obtain a
4822 requested about callables for which inspect couldn't obtain a
4821 proper argspec. Thanks to a crash report sent by Etienne
4823 proper argspec. Thanks to a crash report sent by Etienne
4822 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4824 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4823
4825
4824 2003-12-09 Fernando Perez <fperez@colorado.edu>
4826 2003-12-09 Fernando Perez <fperez@colorado.edu>
4825
4827
4826 * IPython/genutils.py (page): patch for the pager to work across
4828 * IPython/genutils.py (page): patch for the pager to work across
4827 various versions of Windows. By Gary Bishop.
4829 various versions of Windows. By Gary Bishop.
4828
4830
4829 2003-12-04 Fernando Perez <fperez@colorado.edu>
4831 2003-12-04 Fernando Perez <fperez@colorado.edu>
4830
4832
4831 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4833 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4832 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4834 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4833 While I tested this and it looks ok, there may still be corner
4835 While I tested this and it looks ok, there may still be corner
4834 cases I've missed.
4836 cases I've missed.
4835
4837
4836 2003-12-01 Fernando Perez <fperez@colorado.edu>
4838 2003-12-01 Fernando Perez <fperez@colorado.edu>
4837
4839
4838 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4840 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4839 where a line like 'p,q=1,2' would fail because the automagic
4841 where a line like 'p,q=1,2' would fail because the automagic
4840 system would be triggered for @p.
4842 system would be triggered for @p.
4841
4843
4842 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4844 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4843 cleanups, code unmodified.
4845 cleanups, code unmodified.
4844
4846
4845 * IPython/genutils.py (Term): added a class for IPython to handle
4847 * IPython/genutils.py (Term): added a class for IPython to handle
4846 output. In most cases it will just be a proxy for stdout/err, but
4848 output. In most cases it will just be a proxy for stdout/err, but
4847 having this allows modifications to be made for some platforms,
4849 having this allows modifications to be made for some platforms,
4848 such as handling color escapes under Windows. All of this code
4850 such as handling color escapes under Windows. All of this code
4849 was contributed by Gary Bishop, with minor modifications by me.
4851 was contributed by Gary Bishop, with minor modifications by me.
4850 The actual changes affect many files.
4852 The actual changes affect many files.
4851
4853
4852 2003-11-30 Fernando Perez <fperez@colorado.edu>
4854 2003-11-30 Fernando Perez <fperez@colorado.edu>
4853
4855
4854 * IPython/iplib.py (file_matches): new completion code, courtesy
4856 * IPython/iplib.py (file_matches): new completion code, courtesy
4855 of Jeff Collins. This enables filename completion again under
4857 of Jeff Collins. This enables filename completion again under
4856 python 2.3, which disabled it at the C level.
4858 python 2.3, which disabled it at the C level.
4857
4859
4858 2003-11-11 Fernando Perez <fperez@colorado.edu>
4860 2003-11-11 Fernando Perez <fperez@colorado.edu>
4859
4861
4860 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4862 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4861 for Numeric.array(map(...)), but often convenient.
4863 for Numeric.array(map(...)), but often convenient.
4862
4864
4863 2003-11-05 Fernando Perez <fperez@colorado.edu>
4865 2003-11-05 Fernando Perez <fperez@colorado.edu>
4864
4866
4865 * IPython/numutils.py (frange): Changed a call from int() to
4867 * IPython/numutils.py (frange): Changed a call from int() to
4866 int(round()) to prevent a problem reported with arange() in the
4868 int(round()) to prevent a problem reported with arange() in the
4867 numpy list.
4869 numpy list.
4868
4870
4869 2003-10-06 Fernando Perez <fperez@colorado.edu>
4871 2003-10-06 Fernando Perez <fperez@colorado.edu>
4870
4872
4871 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4873 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4872 prevent crashes if sys lacks an argv attribute (it happens with
4874 prevent crashes if sys lacks an argv attribute (it happens with
4873 embedded interpreters which build a bare-bones sys module).
4875 embedded interpreters which build a bare-bones sys module).
4874 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4876 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4875
4877
4876 2003-09-24 Fernando Perez <fperez@colorado.edu>
4878 2003-09-24 Fernando Perez <fperez@colorado.edu>
4877
4879
4878 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4880 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4879 to protect against poorly written user objects where __getattr__
4881 to protect against poorly written user objects where __getattr__
4880 raises exceptions other than AttributeError. Thanks to a bug
4882 raises exceptions other than AttributeError. Thanks to a bug
4881 report by Oliver Sander <osander-AT-gmx.de>.
4883 report by Oliver Sander <osander-AT-gmx.de>.
4882
4884
4883 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4885 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4884 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4886 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4885
4887
4886 2003-09-09 Fernando Perez <fperez@colorado.edu>
4888 2003-09-09 Fernando Perez <fperez@colorado.edu>
4887
4889
4888 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4890 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4889 unpacking a list whith a callable as first element would
4891 unpacking a list whith a callable as first element would
4890 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4892 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4891 Collins.
4893 Collins.
4892
4894
4893 2003-08-25 *** Released version 0.5.0
4895 2003-08-25 *** Released version 0.5.0
4894
4896
4895 2003-08-22 Fernando Perez <fperez@colorado.edu>
4897 2003-08-22 Fernando Perez <fperez@colorado.edu>
4896
4898
4897 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4899 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4898 improperly defined user exceptions. Thanks to feedback from Mark
4900 improperly defined user exceptions. Thanks to feedback from Mark
4899 Russell <mrussell-AT-verio.net>.
4901 Russell <mrussell-AT-verio.net>.
4900
4902
4901 2003-08-20 Fernando Perez <fperez@colorado.edu>
4903 2003-08-20 Fernando Perez <fperez@colorado.edu>
4902
4904
4903 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4905 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4904 printing so that it would print multi-line string forms starting
4906 printing so that it would print multi-line string forms starting
4905 with a new line. This way the formatting is better respected for
4907 with a new line. This way the formatting is better respected for
4906 objects which work hard to make nice string forms.
4908 objects which work hard to make nice string forms.
4907
4909
4908 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4910 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4909 autocall would overtake data access for objects with both
4911 autocall would overtake data access for objects with both
4910 __getitem__ and __call__.
4912 __getitem__ and __call__.
4911
4913
4912 2003-08-19 *** Released version 0.5.0-rc1
4914 2003-08-19 *** Released version 0.5.0-rc1
4913
4915
4914 2003-08-19 Fernando Perez <fperez@colorado.edu>
4916 2003-08-19 Fernando Perez <fperez@colorado.edu>
4915
4917
4916 * IPython/deep_reload.py (load_tail): single tiny change here
4918 * IPython/deep_reload.py (load_tail): single tiny change here
4917 seems to fix the long-standing bug of dreload() failing to work
4919 seems to fix the long-standing bug of dreload() failing to work
4918 for dotted names. But this module is pretty tricky, so I may have
4920 for dotted names. But this module is pretty tricky, so I may have
4919 missed some subtlety. Needs more testing!.
4921 missed some subtlety. Needs more testing!.
4920
4922
4921 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4923 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4922 exceptions which have badly implemented __str__ methods.
4924 exceptions which have badly implemented __str__ methods.
4923 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4925 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4924 which I've been getting reports about from Python 2.3 users. I
4926 which I've been getting reports about from Python 2.3 users. I
4925 wish I had a simple test case to reproduce the problem, so I could
4927 wish I had a simple test case to reproduce the problem, so I could
4926 either write a cleaner workaround or file a bug report if
4928 either write a cleaner workaround or file a bug report if
4927 necessary.
4929 necessary.
4928
4930
4929 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4931 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4930 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4932 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4931 a bug report by Tjabo Kloppenburg.
4933 a bug report by Tjabo Kloppenburg.
4932
4934
4933 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4935 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4934 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4936 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4935 seems rather unstable. Thanks to a bug report by Tjabo
4937 seems rather unstable. Thanks to a bug report by Tjabo
4936 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4938 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4937
4939
4938 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4940 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4939 this out soon because of the critical fixes in the inner loop for
4941 this out soon because of the critical fixes in the inner loop for
4940 generators.
4942 generators.
4941
4943
4942 * IPython/Magic.py (Magic.getargspec): removed. This (and
4944 * IPython/Magic.py (Magic.getargspec): removed. This (and
4943 _get_def) have been obsoleted by OInspect for a long time, I
4945 _get_def) have been obsoleted by OInspect for a long time, I
4944 hadn't noticed that they were dead code.
4946 hadn't noticed that they were dead code.
4945 (Magic._ofind): restored _ofind functionality for a few literals
4947 (Magic._ofind): restored _ofind functionality for a few literals
4946 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4948 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4947 for things like "hello".capitalize?, since that would require a
4949 for things like "hello".capitalize?, since that would require a
4948 potentially dangerous eval() again.
4950 potentially dangerous eval() again.
4949
4951
4950 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4952 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4951 logic a bit more to clean up the escapes handling and minimize the
4953 logic a bit more to clean up the escapes handling and minimize the
4952 use of _ofind to only necessary cases. The interactive 'feel' of
4954 use of _ofind to only necessary cases. The interactive 'feel' of
4953 IPython should have improved quite a bit with the changes in
4955 IPython should have improved quite a bit with the changes in
4954 _prefilter and _ofind (besides being far safer than before).
4956 _prefilter and _ofind (besides being far safer than before).
4955
4957
4956 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4958 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4957 obscure, never reported). Edit would fail to find the object to
4959 obscure, never reported). Edit would fail to find the object to
4958 edit under some circumstances.
4960 edit under some circumstances.
4959 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4961 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4960 which were causing double-calling of generators. Those eval calls
4962 which were causing double-calling of generators. Those eval calls
4961 were _very_ dangerous, since code with side effects could be
4963 were _very_ dangerous, since code with side effects could be
4962 triggered. As they say, 'eval is evil'... These were the
4964 triggered. As they say, 'eval is evil'... These were the
4963 nastiest evals in IPython. Besides, _ofind is now far simpler,
4965 nastiest evals in IPython. Besides, _ofind is now far simpler,
4964 and it should also be quite a bit faster. Its use of inspect is
4966 and it should also be quite a bit faster. Its use of inspect is
4965 also safer, so perhaps some of the inspect-related crashes I've
4967 also safer, so perhaps some of the inspect-related crashes I've
4966 seen lately with Python 2.3 might be taken care of. That will
4968 seen lately with Python 2.3 might be taken care of. That will
4967 need more testing.
4969 need more testing.
4968
4970
4969 2003-08-17 Fernando Perez <fperez@colorado.edu>
4971 2003-08-17 Fernando Perez <fperez@colorado.edu>
4970
4972
4971 * IPython/iplib.py (InteractiveShell._prefilter): significant
4973 * IPython/iplib.py (InteractiveShell._prefilter): significant
4972 simplifications to the logic for handling user escapes. Faster
4974 simplifications to the logic for handling user escapes. Faster
4973 and simpler code.
4975 and simpler code.
4974
4976
4975 2003-08-14 Fernando Perez <fperez@colorado.edu>
4977 2003-08-14 Fernando Perez <fperez@colorado.edu>
4976
4978
4977 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4979 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4978 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4980 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4979 but it should be quite a bit faster. And the recursive version
4981 but it should be quite a bit faster. And the recursive version
4980 generated O(log N) intermediate storage for all rank>1 arrays,
4982 generated O(log N) intermediate storage for all rank>1 arrays,
4981 even if they were contiguous.
4983 even if they were contiguous.
4982 (l1norm): Added this function.
4984 (l1norm): Added this function.
4983 (norm): Added this function for arbitrary norms (including
4985 (norm): Added this function for arbitrary norms (including
4984 l-infinity). l1 and l2 are still special cases for convenience
4986 l-infinity). l1 and l2 are still special cases for convenience
4985 and speed.
4987 and speed.
4986
4988
4987 2003-08-03 Fernando Perez <fperez@colorado.edu>
4989 2003-08-03 Fernando Perez <fperez@colorado.edu>
4988
4990
4989 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4991 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4990 exceptions, which now raise PendingDeprecationWarnings in Python
4992 exceptions, which now raise PendingDeprecationWarnings in Python
4991 2.3. There were some in Magic and some in Gnuplot2.
4993 2.3. There were some in Magic and some in Gnuplot2.
4992
4994
4993 2003-06-30 Fernando Perez <fperez@colorado.edu>
4995 2003-06-30 Fernando Perez <fperez@colorado.edu>
4994
4996
4995 * IPython/genutils.py (page): modified to call curses only for
4997 * IPython/genutils.py (page): modified to call curses only for
4996 terminals where TERM=='xterm'. After problems under many other
4998 terminals where TERM=='xterm'. After problems under many other
4997 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4999 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4998
5000
4999 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
5001 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
5000 would be triggered when readline was absent. This was just an old
5002 would be triggered when readline was absent. This was just an old
5001 debugging statement I'd forgotten to take out.
5003 debugging statement I'd forgotten to take out.
5002
5004
5003 2003-06-20 Fernando Perez <fperez@colorado.edu>
5005 2003-06-20 Fernando Perez <fperez@colorado.edu>
5004
5006
5005 * IPython/genutils.py (clock): modified to return only user time
5007 * IPython/genutils.py (clock): modified to return only user time
5006 (not counting system time), after a discussion on scipy. While
5008 (not counting system time), after a discussion on scipy. While
5007 system time may be a useful quantity occasionally, it may much
5009 system time may be a useful quantity occasionally, it may much
5008 more easily be skewed by occasional swapping or other similar
5010 more easily be skewed by occasional swapping or other similar
5009 activity.
5011 activity.
5010
5012
5011 2003-06-05 Fernando Perez <fperez@colorado.edu>
5013 2003-06-05 Fernando Perez <fperez@colorado.edu>
5012
5014
5013 * IPython/numutils.py (identity): new function, for building
5015 * IPython/numutils.py (identity): new function, for building
5014 arbitrary rank Kronecker deltas (mostly backwards compatible with
5016 arbitrary rank Kronecker deltas (mostly backwards compatible with
5015 Numeric.identity)
5017 Numeric.identity)
5016
5018
5017 2003-06-03 Fernando Perez <fperez@colorado.edu>
5019 2003-06-03 Fernando Perez <fperez@colorado.edu>
5018
5020
5019 * IPython/iplib.py (InteractiveShell.handle_magic): protect
5021 * IPython/iplib.py (InteractiveShell.handle_magic): protect
5020 arguments passed to magics with spaces, to allow trailing '\' to
5022 arguments passed to magics with spaces, to allow trailing '\' to
5021 work normally (mainly for Windows users).
5023 work normally (mainly for Windows users).
5022
5024
5023 2003-05-29 Fernando Perez <fperez@colorado.edu>
5025 2003-05-29 Fernando Perez <fperez@colorado.edu>
5024
5026
5025 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
5027 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
5026 instead of pydoc.help. This fixes a bizarre behavior where
5028 instead of pydoc.help. This fixes a bizarre behavior where
5027 printing '%s' % locals() would trigger the help system. Now
5029 printing '%s' % locals() would trigger the help system. Now
5028 ipython behaves like normal python does.
5030 ipython behaves like normal python does.
5029
5031
5030 Note that if one does 'from pydoc import help', the bizarre
5032 Note that if one does 'from pydoc import help', the bizarre
5031 behavior returns, but this will also happen in normal python, so
5033 behavior returns, but this will also happen in normal python, so
5032 it's not an ipython bug anymore (it has to do with how pydoc.help
5034 it's not an ipython bug anymore (it has to do with how pydoc.help
5033 is implemented).
5035 is implemented).
5034
5036
5035 2003-05-22 Fernando Perez <fperez@colorado.edu>
5037 2003-05-22 Fernando Perez <fperez@colorado.edu>
5036
5038
5037 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
5039 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
5038 return [] instead of None when nothing matches, also match to end
5040 return [] instead of None when nothing matches, also match to end
5039 of line. Patch by Gary Bishop.
5041 of line. Patch by Gary Bishop.
5040
5042
5041 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
5043 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
5042 protection as before, for files passed on the command line. This
5044 protection as before, for files passed on the command line. This
5043 prevents the CrashHandler from kicking in if user files call into
5045 prevents the CrashHandler from kicking in if user files call into
5044 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
5046 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
5045 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
5047 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
5046
5048
5047 2003-05-20 *** Released version 0.4.0
5049 2003-05-20 *** Released version 0.4.0
5048
5050
5049 2003-05-20 Fernando Perez <fperez@colorado.edu>
5051 2003-05-20 Fernando Perez <fperez@colorado.edu>
5050
5052
5051 * setup.py: added support for manpages. It's a bit hackish b/c of
5053 * setup.py: added support for manpages. It's a bit hackish b/c of
5052 a bug in the way the bdist_rpm distutils target handles gzipped
5054 a bug in the way the bdist_rpm distutils target handles gzipped
5053 manpages, but it works. After a patch by Jack.
5055 manpages, but it works. After a patch by Jack.
5054
5056
5055 2003-05-19 Fernando Perez <fperez@colorado.edu>
5057 2003-05-19 Fernando Perez <fperez@colorado.edu>
5056
5058
5057 * IPython/numutils.py: added a mockup of the kinds module, since
5059 * IPython/numutils.py: added a mockup of the kinds module, since
5058 it was recently removed from Numeric. This way, numutils will
5060 it was recently removed from Numeric. This way, numutils will
5059 work for all users even if they are missing kinds.
5061 work for all users even if they are missing kinds.
5060
5062
5061 * IPython/Magic.py (Magic._ofind): Harden against an inspect
5063 * IPython/Magic.py (Magic._ofind): Harden against an inspect
5062 failure, which can occur with SWIG-wrapped extensions. After a
5064 failure, which can occur with SWIG-wrapped extensions. After a
5063 crash report from Prabhu.
5065 crash report from Prabhu.
5064
5066
5065 2003-05-16 Fernando Perez <fperez@colorado.edu>
5067 2003-05-16 Fernando Perez <fperez@colorado.edu>
5066
5068
5067 * IPython/iplib.py (InteractiveShell.excepthook): New method to
5069 * IPython/iplib.py (InteractiveShell.excepthook): New method to
5068 protect ipython from user code which may call directly
5070 protect ipython from user code which may call directly
5069 sys.excepthook (this looks like an ipython crash to the user, even
5071 sys.excepthook (this looks like an ipython crash to the user, even
5070 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5072 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5071 This is especially important to help users of WxWindows, but may
5073 This is especially important to help users of WxWindows, but may
5072 also be useful in other cases.
5074 also be useful in other cases.
5073
5075
5074 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
5076 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
5075 an optional tb_offset to be specified, and to preserve exception
5077 an optional tb_offset to be specified, and to preserve exception
5076 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5078 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5077
5079
5078 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
5080 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
5079
5081
5080 2003-05-15 Fernando Perez <fperez@colorado.edu>
5082 2003-05-15 Fernando Perez <fperez@colorado.edu>
5081
5083
5082 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
5084 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
5083 installing for a new user under Windows.
5085 installing for a new user under Windows.
5084
5086
5085 2003-05-12 Fernando Perez <fperez@colorado.edu>
5087 2003-05-12 Fernando Perez <fperez@colorado.edu>
5086
5088
5087 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
5089 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
5088 handler for Emacs comint-based lines. Currently it doesn't do
5090 handler for Emacs comint-based lines. Currently it doesn't do
5089 much (but importantly, it doesn't update the history cache). In
5091 much (but importantly, it doesn't update the history cache). In
5090 the future it may be expanded if Alex needs more functionality
5092 the future it may be expanded if Alex needs more functionality
5091 there.
5093 there.
5092
5094
5093 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
5095 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
5094 info to crash reports.
5096 info to crash reports.
5095
5097
5096 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
5098 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
5097 just like Python's -c. Also fixed crash with invalid -color
5099 just like Python's -c. Also fixed crash with invalid -color
5098 option value at startup. Thanks to Will French
5100 option value at startup. Thanks to Will French
5099 <wfrench-AT-bestweb.net> for the bug report.
5101 <wfrench-AT-bestweb.net> for the bug report.
5100
5102
5101 2003-05-09 Fernando Perez <fperez@colorado.edu>
5103 2003-05-09 Fernando Perez <fperez@colorado.edu>
5102
5104
5103 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
5105 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
5104 to EvalDict (it's a mapping, after all) and simplified its code
5106 to EvalDict (it's a mapping, after all) and simplified its code
5105 quite a bit, after a nice discussion on c.l.py where Gustavo
5107 quite a bit, after a nice discussion on c.l.py where Gustavo
5106 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
5108 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
5107
5109
5108 2003-04-30 Fernando Perez <fperez@colorado.edu>
5110 2003-04-30 Fernando Perez <fperez@colorado.edu>
5109
5111
5110 * IPython/genutils.py (timings_out): modified it to reduce its
5112 * IPython/genutils.py (timings_out): modified it to reduce its
5111 overhead in the common reps==1 case.
5113 overhead in the common reps==1 case.
5112
5114
5113 2003-04-29 Fernando Perez <fperez@colorado.edu>
5115 2003-04-29 Fernando Perez <fperez@colorado.edu>
5114
5116
5115 * IPython/genutils.py (timings_out): Modified to use the resource
5117 * IPython/genutils.py (timings_out): Modified to use the resource
5116 module, which avoids the wraparound problems of time.clock().
5118 module, which avoids the wraparound problems of time.clock().
5117
5119
5118 2003-04-17 *** Released version 0.2.15pre4
5120 2003-04-17 *** Released version 0.2.15pre4
5119
5121
5120 2003-04-17 Fernando Perez <fperez@colorado.edu>
5122 2003-04-17 Fernando Perez <fperez@colorado.edu>
5121
5123
5122 * setup.py (scriptfiles): Split windows-specific stuff over to a
5124 * setup.py (scriptfiles): Split windows-specific stuff over to a
5123 separate file, in an attempt to have a Windows GUI installer.
5125 separate file, in an attempt to have a Windows GUI installer.
5124 That didn't work, but part of the groundwork is done.
5126 That didn't work, but part of the groundwork is done.
5125
5127
5126 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
5128 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
5127 indent/unindent with 4 spaces. Particularly useful in combination
5129 indent/unindent with 4 spaces. Particularly useful in combination
5128 with the new auto-indent option.
5130 with the new auto-indent option.
5129
5131
5130 2003-04-16 Fernando Perez <fperez@colorado.edu>
5132 2003-04-16 Fernando Perez <fperez@colorado.edu>
5131
5133
5132 * IPython/Magic.py: various replacements of self.rc for
5134 * IPython/Magic.py: various replacements of self.rc for
5133 self.shell.rc. A lot more remains to be done to fully disentangle
5135 self.shell.rc. A lot more remains to be done to fully disentangle
5134 this class from the main Shell class.
5136 this class from the main Shell class.
5135
5137
5136 * IPython/GnuplotRuntime.py: added checks for mouse support so
5138 * IPython/GnuplotRuntime.py: added checks for mouse support so
5137 that we don't try to enable it if the current gnuplot doesn't
5139 that we don't try to enable it if the current gnuplot doesn't
5138 really support it. Also added checks so that we don't try to
5140 really support it. Also added checks so that we don't try to
5139 enable persist under Windows (where Gnuplot doesn't recognize the
5141 enable persist under Windows (where Gnuplot doesn't recognize the
5140 option).
5142 option).
5141
5143
5142 * IPython/iplib.py (InteractiveShell.interact): Added optional
5144 * IPython/iplib.py (InteractiveShell.interact): Added optional
5143 auto-indenting code, after a patch by King C. Shu
5145 auto-indenting code, after a patch by King C. Shu
5144 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
5146 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
5145 get along well with pasting indented code. If I ever figure out
5147 get along well with pasting indented code. If I ever figure out
5146 how to make that part go well, it will become on by default.
5148 how to make that part go well, it will become on by default.
5147
5149
5148 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5150 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5149 crash ipython if there was an unmatched '%' in the user's prompt
5151 crash ipython if there was an unmatched '%' in the user's prompt
5150 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5152 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5151
5153
5152 * IPython/iplib.py (InteractiveShell.interact): removed the
5154 * IPython/iplib.py (InteractiveShell.interact): removed the
5153 ability to ask the user whether he wants to crash or not at the
5155 ability to ask the user whether he wants to crash or not at the
5154 'last line' exception handler. Calling functions at that point
5156 'last line' exception handler. Calling functions at that point
5155 changes the stack, and the error reports would have incorrect
5157 changes the stack, and the error reports would have incorrect
5156 tracebacks.
5158 tracebacks.
5157
5159
5158 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5160 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5159 pass through a peger a pretty-printed form of any object. After a
5161 pass through a peger a pretty-printed form of any object. After a
5160 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5162 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5161
5163
5162 2003-04-14 Fernando Perez <fperez@colorado.edu>
5164 2003-04-14 Fernando Perez <fperez@colorado.edu>
5163
5165
5164 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5166 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5165 all files in ~ would be modified at first install (instead of
5167 all files in ~ would be modified at first install (instead of
5166 ~/.ipython). This could be potentially disastrous, as the
5168 ~/.ipython). This could be potentially disastrous, as the
5167 modification (make line-endings native) could damage binary files.
5169 modification (make line-endings native) could damage binary files.
5168
5170
5169 2003-04-10 Fernando Perez <fperez@colorado.edu>
5171 2003-04-10 Fernando Perez <fperez@colorado.edu>
5170
5172
5171 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5173 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5172 handle only lines which are invalid python. This now means that
5174 handle only lines which are invalid python. This now means that
5173 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5175 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5174 for the bug report.
5176 for the bug report.
5175
5177
5176 2003-04-01 Fernando Perez <fperez@colorado.edu>
5178 2003-04-01 Fernando Perez <fperez@colorado.edu>
5177
5179
5178 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5180 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5179 where failing to set sys.last_traceback would crash pdb.pm().
5181 where failing to set sys.last_traceback would crash pdb.pm().
5180 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5182 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5181 report.
5183 report.
5182
5184
5183 2003-03-25 Fernando Perez <fperez@colorado.edu>
5185 2003-03-25 Fernando Perez <fperez@colorado.edu>
5184
5186
5185 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5187 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5186 before printing it (it had a lot of spurious blank lines at the
5188 before printing it (it had a lot of spurious blank lines at the
5187 end).
5189 end).
5188
5190
5189 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5191 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5190 output would be sent 21 times! Obviously people don't use this
5192 output would be sent 21 times! Obviously people don't use this
5191 too often, or I would have heard about it.
5193 too often, or I would have heard about it.
5192
5194
5193 2003-03-24 Fernando Perez <fperez@colorado.edu>
5195 2003-03-24 Fernando Perez <fperez@colorado.edu>
5194
5196
5195 * setup.py (scriptfiles): renamed the data_files parameter from
5197 * setup.py (scriptfiles): renamed the data_files parameter from
5196 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5198 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5197 for the patch.
5199 for the patch.
5198
5200
5199 2003-03-20 Fernando Perez <fperez@colorado.edu>
5201 2003-03-20 Fernando Perez <fperez@colorado.edu>
5200
5202
5201 * IPython/genutils.py (error): added error() and fatal()
5203 * IPython/genutils.py (error): added error() and fatal()
5202 functions.
5204 functions.
5203
5205
5204 2003-03-18 *** Released version 0.2.15pre3
5206 2003-03-18 *** Released version 0.2.15pre3
5205
5207
5206 2003-03-18 Fernando Perez <fperez@colorado.edu>
5208 2003-03-18 Fernando Perez <fperez@colorado.edu>
5207
5209
5208 * setupext/install_data_ext.py
5210 * setupext/install_data_ext.py
5209 (install_data_ext.initialize_options): Class contributed by Jack
5211 (install_data_ext.initialize_options): Class contributed by Jack
5210 Moffit for fixing the old distutils hack. He is sending this to
5212 Moffit for fixing the old distutils hack. He is sending this to
5211 the distutils folks so in the future we may not need it as a
5213 the distutils folks so in the future we may not need it as a
5212 private fix.
5214 private fix.
5213
5215
5214 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5216 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5215 changes for Debian packaging. See his patch for full details.
5217 changes for Debian packaging. See his patch for full details.
5216 The old distutils hack of making the ipythonrc* files carry a
5218 The old distutils hack of making the ipythonrc* files carry a
5217 bogus .py extension is gone, at last. Examples were moved to a
5219 bogus .py extension is gone, at last. Examples were moved to a
5218 separate subdir under doc/, and the separate executable scripts
5220 separate subdir under doc/, and the separate executable scripts
5219 now live in their own directory. Overall a great cleanup. The
5221 now live in their own directory. Overall a great cleanup. The
5220 manual was updated to use the new files, and setup.py has been
5222 manual was updated to use the new files, and setup.py has been
5221 fixed for this setup.
5223 fixed for this setup.
5222
5224
5223 * IPython/PyColorize.py (Parser.usage): made non-executable and
5225 * IPython/PyColorize.py (Parser.usage): made non-executable and
5224 created a pycolor wrapper around it to be included as a script.
5226 created a pycolor wrapper around it to be included as a script.
5225
5227
5226 2003-03-12 *** Released version 0.2.15pre2
5228 2003-03-12 *** Released version 0.2.15pre2
5227
5229
5228 2003-03-12 Fernando Perez <fperez@colorado.edu>
5230 2003-03-12 Fernando Perez <fperez@colorado.edu>
5229
5231
5230 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5232 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5231 long-standing problem with garbage characters in some terminals.
5233 long-standing problem with garbage characters in some terminals.
5232 The issue was really that the \001 and \002 escapes must _only_ be
5234 The issue was really that the \001 and \002 escapes must _only_ be
5233 passed to input prompts (which call readline), but _never_ to
5235 passed to input prompts (which call readline), but _never_ to
5234 normal text to be printed on screen. I changed ColorANSI to have
5236 normal text to be printed on screen. I changed ColorANSI to have
5235 two classes: TermColors and InputTermColors, each with the
5237 two classes: TermColors and InputTermColors, each with the
5236 appropriate escapes for input prompts or normal text. The code in
5238 appropriate escapes for input prompts or normal text. The code in
5237 Prompts.py got slightly more complicated, but this very old and
5239 Prompts.py got slightly more complicated, but this very old and
5238 annoying bug is finally fixed.
5240 annoying bug is finally fixed.
5239
5241
5240 All the credit for nailing down the real origin of this problem
5242 All the credit for nailing down the real origin of this problem
5241 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5243 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5242 *Many* thanks to him for spending quite a bit of effort on this.
5244 *Many* thanks to him for spending quite a bit of effort on this.
5243
5245
5244 2003-03-05 *** Released version 0.2.15pre1
5246 2003-03-05 *** Released version 0.2.15pre1
5245
5247
5246 2003-03-03 Fernando Perez <fperez@colorado.edu>
5248 2003-03-03 Fernando Perez <fperez@colorado.edu>
5247
5249
5248 * IPython/FakeModule.py: Moved the former _FakeModule to a
5250 * IPython/FakeModule.py: Moved the former _FakeModule to a
5249 separate file, because it's also needed by Magic (to fix a similar
5251 separate file, because it's also needed by Magic (to fix a similar
5250 pickle-related issue in @run).
5252 pickle-related issue in @run).
5251
5253
5252 2003-03-02 Fernando Perez <fperez@colorado.edu>
5254 2003-03-02 Fernando Perez <fperez@colorado.edu>
5253
5255
5254 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5256 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5255 the autocall option at runtime.
5257 the autocall option at runtime.
5256 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5258 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5257 across Magic.py to start separating Magic from InteractiveShell.
5259 across Magic.py to start separating Magic from InteractiveShell.
5258 (Magic._ofind): Fixed to return proper namespace for dotted
5260 (Magic._ofind): Fixed to return proper namespace for dotted
5259 names. Before, a dotted name would always return 'not currently
5261 names. Before, a dotted name would always return 'not currently
5260 defined', because it would find the 'parent'. s.x would be found,
5262 defined', because it would find the 'parent'. s.x would be found,
5261 but since 'x' isn't defined by itself, it would get confused.
5263 but since 'x' isn't defined by itself, it would get confused.
5262 (Magic.magic_run): Fixed pickling problems reported by Ralf
5264 (Magic.magic_run): Fixed pickling problems reported by Ralf
5263 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5265 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5264 that I'd used when Mike Heeter reported similar issues at the
5266 that I'd used when Mike Heeter reported similar issues at the
5265 top-level, but now for @run. It boils down to injecting the
5267 top-level, but now for @run. It boils down to injecting the
5266 namespace where code is being executed with something that looks
5268 namespace where code is being executed with something that looks
5267 enough like a module to fool pickle.dump(). Since a pickle stores
5269 enough like a module to fool pickle.dump(). Since a pickle stores
5268 a named reference to the importing module, we need this for
5270 a named reference to the importing module, we need this for
5269 pickles to save something sensible.
5271 pickles to save something sensible.
5270
5272
5271 * IPython/ipmaker.py (make_IPython): added an autocall option.
5273 * IPython/ipmaker.py (make_IPython): added an autocall option.
5272
5274
5273 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5275 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5274 the auto-eval code. Now autocalling is an option, and the code is
5276 the auto-eval code. Now autocalling is an option, and the code is
5275 also vastly safer. There is no more eval() involved at all.
5277 also vastly safer. There is no more eval() involved at all.
5276
5278
5277 2003-03-01 Fernando Perez <fperez@colorado.edu>
5279 2003-03-01 Fernando Perez <fperez@colorado.edu>
5278
5280
5279 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5281 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5280 dict with named keys instead of a tuple.
5282 dict with named keys instead of a tuple.
5281
5283
5282 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5284 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5283
5285
5284 * setup.py (make_shortcut): Fixed message about directories
5286 * setup.py (make_shortcut): Fixed message about directories
5285 created during Windows installation (the directories were ok, just
5287 created during Windows installation (the directories were ok, just
5286 the printed message was misleading). Thanks to Chris Liechti
5288 the printed message was misleading). Thanks to Chris Liechti
5287 <cliechti-AT-gmx.net> for the heads up.
5289 <cliechti-AT-gmx.net> for the heads up.
5288
5290
5289 2003-02-21 Fernando Perez <fperez@colorado.edu>
5291 2003-02-21 Fernando Perez <fperez@colorado.edu>
5290
5292
5291 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5293 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5292 of ValueError exception when checking for auto-execution. This
5294 of ValueError exception when checking for auto-execution. This
5293 one is raised by things like Numeric arrays arr.flat when the
5295 one is raised by things like Numeric arrays arr.flat when the
5294 array is non-contiguous.
5296 array is non-contiguous.
5295
5297
5296 2003-01-31 Fernando Perez <fperez@colorado.edu>
5298 2003-01-31 Fernando Perez <fperez@colorado.edu>
5297
5299
5298 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5300 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5299 not return any value at all (even though the command would get
5301 not return any value at all (even though the command would get
5300 executed).
5302 executed).
5301 (xsys): Flush stdout right after printing the command to ensure
5303 (xsys): Flush stdout right after printing the command to ensure
5302 proper ordering of commands and command output in the total
5304 proper ordering of commands and command output in the total
5303 output.
5305 output.
5304 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5306 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5305 system/getoutput as defaults. The old ones are kept for
5307 system/getoutput as defaults. The old ones are kept for
5306 compatibility reasons, so no code which uses this library needs
5308 compatibility reasons, so no code which uses this library needs
5307 changing.
5309 changing.
5308
5310
5309 2003-01-27 *** Released version 0.2.14
5311 2003-01-27 *** Released version 0.2.14
5310
5312
5311 2003-01-25 Fernando Perez <fperez@colorado.edu>
5313 2003-01-25 Fernando Perez <fperez@colorado.edu>
5312
5314
5313 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5315 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5314 functions defined in previous edit sessions could not be re-edited
5316 functions defined in previous edit sessions could not be re-edited
5315 (because the temp files were immediately removed). Now temp files
5317 (because the temp files were immediately removed). Now temp files
5316 are removed only at IPython's exit.
5318 are removed only at IPython's exit.
5317 (Magic.magic_run): Improved @run to perform shell-like expansions
5319 (Magic.magic_run): Improved @run to perform shell-like expansions
5318 on its arguments (~users and $VARS). With this, @run becomes more
5320 on its arguments (~users and $VARS). With this, @run becomes more
5319 like a normal command-line.
5321 like a normal command-line.
5320
5322
5321 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5323 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5322 bugs related to embedding and cleaned up that code. A fairly
5324 bugs related to embedding and cleaned up that code. A fairly
5323 important one was the impossibility to access the global namespace
5325 important one was the impossibility to access the global namespace
5324 through the embedded IPython (only local variables were visible).
5326 through the embedded IPython (only local variables were visible).
5325
5327
5326 2003-01-14 Fernando Perez <fperez@colorado.edu>
5328 2003-01-14 Fernando Perez <fperez@colorado.edu>
5327
5329
5328 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5330 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5329 auto-calling to be a bit more conservative. Now it doesn't get
5331 auto-calling to be a bit more conservative. Now it doesn't get
5330 triggered if any of '!=()<>' are in the rest of the input line, to
5332 triggered if any of '!=()<>' are in the rest of the input line, to
5331 allow comparing callables. Thanks to Alex for the heads up.
5333 allow comparing callables. Thanks to Alex for the heads up.
5332
5334
5333 2003-01-07 Fernando Perez <fperez@colorado.edu>
5335 2003-01-07 Fernando Perez <fperez@colorado.edu>
5334
5336
5335 * IPython/genutils.py (page): fixed estimation of the number of
5337 * IPython/genutils.py (page): fixed estimation of the number of
5336 lines in a string to be paged to simply count newlines. This
5338 lines in a string to be paged to simply count newlines. This
5337 prevents over-guessing due to embedded escape sequences. A better
5339 prevents over-guessing due to embedded escape sequences. A better
5338 long-term solution would involve stripping out the control chars
5340 long-term solution would involve stripping out the control chars
5339 for the count, but it's potentially so expensive I just don't
5341 for the count, but it's potentially so expensive I just don't
5340 think it's worth doing.
5342 think it's worth doing.
5341
5343
5342 2002-12-19 *** Released version 0.2.14pre50
5344 2002-12-19 *** Released version 0.2.14pre50
5343
5345
5344 2002-12-19 Fernando Perez <fperez@colorado.edu>
5346 2002-12-19 Fernando Perez <fperez@colorado.edu>
5345
5347
5346 * tools/release (version): Changed release scripts to inform
5348 * tools/release (version): Changed release scripts to inform
5347 Andrea and build a NEWS file with a list of recent changes.
5349 Andrea and build a NEWS file with a list of recent changes.
5348
5350
5349 * IPython/ColorANSI.py (__all__): changed terminal detection
5351 * IPython/ColorANSI.py (__all__): changed terminal detection
5350 code. Seems to work better for xterms without breaking
5352 code. Seems to work better for xterms without breaking
5351 konsole. Will need more testing to determine if WinXP and Mac OSX
5353 konsole. Will need more testing to determine if WinXP and Mac OSX
5352 also work ok.
5354 also work ok.
5353
5355
5354 2002-12-18 *** Released version 0.2.14pre49
5356 2002-12-18 *** Released version 0.2.14pre49
5355
5357
5356 2002-12-18 Fernando Perez <fperez@colorado.edu>
5358 2002-12-18 Fernando Perez <fperez@colorado.edu>
5357
5359
5358 * Docs: added new info about Mac OSX, from Andrea.
5360 * Docs: added new info about Mac OSX, from Andrea.
5359
5361
5360 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5362 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5361 allow direct plotting of python strings whose format is the same
5363 allow direct plotting of python strings whose format is the same
5362 of gnuplot data files.
5364 of gnuplot data files.
5363
5365
5364 2002-12-16 Fernando Perez <fperez@colorado.edu>
5366 2002-12-16 Fernando Perez <fperez@colorado.edu>
5365
5367
5366 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5368 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5367 value of exit question to be acknowledged.
5369 value of exit question to be acknowledged.
5368
5370
5369 2002-12-03 Fernando Perez <fperez@colorado.edu>
5371 2002-12-03 Fernando Perez <fperez@colorado.edu>
5370
5372
5371 * IPython/ipmaker.py: removed generators, which had been added
5373 * IPython/ipmaker.py: removed generators, which had been added
5372 by mistake in an earlier debugging run. This was causing trouble
5374 by mistake in an earlier debugging run. This was causing trouble
5373 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5375 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5374 for pointing this out.
5376 for pointing this out.
5375
5377
5376 2002-11-17 Fernando Perez <fperez@colorado.edu>
5378 2002-11-17 Fernando Perez <fperez@colorado.edu>
5377
5379
5378 * Manual: updated the Gnuplot section.
5380 * Manual: updated the Gnuplot section.
5379
5381
5380 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5382 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5381 a much better split of what goes in Runtime and what goes in
5383 a much better split of what goes in Runtime and what goes in
5382 Interactive.
5384 Interactive.
5383
5385
5384 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5386 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5385 being imported from iplib.
5387 being imported from iplib.
5386
5388
5387 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5389 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5388 for command-passing. Now the global Gnuplot instance is called
5390 for command-passing. Now the global Gnuplot instance is called
5389 'gp' instead of 'g', which was really a far too fragile and
5391 'gp' instead of 'g', which was really a far too fragile and
5390 common name.
5392 common name.
5391
5393
5392 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5394 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5393 bounding boxes generated by Gnuplot for square plots.
5395 bounding boxes generated by Gnuplot for square plots.
5394
5396
5395 * IPython/genutils.py (popkey): new function added. I should
5397 * IPython/genutils.py (popkey): new function added. I should
5396 suggest this on c.l.py as a dict method, it seems useful.
5398 suggest this on c.l.py as a dict method, it seems useful.
5397
5399
5398 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5400 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5399 to transparently handle PostScript generation. MUCH better than
5401 to transparently handle PostScript generation. MUCH better than
5400 the previous plot_eps/replot_eps (which I removed now). The code
5402 the previous plot_eps/replot_eps (which I removed now). The code
5401 is also fairly clean and well documented now (including
5403 is also fairly clean and well documented now (including
5402 docstrings).
5404 docstrings).
5403
5405
5404 2002-11-13 Fernando Perez <fperez@colorado.edu>
5406 2002-11-13 Fernando Perez <fperez@colorado.edu>
5405
5407
5406 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5408 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5407 (inconsistent with options).
5409 (inconsistent with options).
5408
5410
5409 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5411 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5410 manually disabled, I don't know why. Fixed it.
5412 manually disabled, I don't know why. Fixed it.
5411 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5413 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5412 eps output.
5414 eps output.
5413
5415
5414 2002-11-12 Fernando Perez <fperez@colorado.edu>
5416 2002-11-12 Fernando Perez <fperez@colorado.edu>
5415
5417
5416 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5418 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5417 don't propagate up to caller. Fixes crash reported by François
5419 don't propagate up to caller. Fixes crash reported by François
5418 Pinard.
5420 Pinard.
5419
5421
5420 2002-11-09 Fernando Perez <fperez@colorado.edu>
5422 2002-11-09 Fernando Perez <fperez@colorado.edu>
5421
5423
5422 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5424 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5423 history file for new users.
5425 history file for new users.
5424 (make_IPython): fixed bug where initial install would leave the
5426 (make_IPython): fixed bug where initial install would leave the
5425 user running in the .ipython dir.
5427 user running in the .ipython dir.
5426 (make_IPython): fixed bug where config dir .ipython would be
5428 (make_IPython): fixed bug where config dir .ipython would be
5427 created regardless of the given -ipythondir option. Thanks to Cory
5429 created regardless of the given -ipythondir option. Thanks to Cory
5428 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5430 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5429
5431
5430 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5432 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5431 type confirmations. Will need to use it in all of IPython's code
5433 type confirmations. Will need to use it in all of IPython's code
5432 consistently.
5434 consistently.
5433
5435
5434 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5436 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5435 context to print 31 lines instead of the default 5. This will make
5437 context to print 31 lines instead of the default 5. This will make
5436 the crash reports extremely detailed in case the problem is in
5438 the crash reports extremely detailed in case the problem is in
5437 libraries I don't have access to.
5439 libraries I don't have access to.
5438
5440
5439 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5441 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5440 line of defense' code to still crash, but giving users fair
5442 line of defense' code to still crash, but giving users fair
5441 warning. I don't want internal errors to go unreported: if there's
5443 warning. I don't want internal errors to go unreported: if there's
5442 an internal problem, IPython should crash and generate a full
5444 an internal problem, IPython should crash and generate a full
5443 report.
5445 report.
5444
5446
5445 2002-11-08 Fernando Perez <fperez@colorado.edu>
5447 2002-11-08 Fernando Perez <fperez@colorado.edu>
5446
5448
5447 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5449 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5448 otherwise uncaught exceptions which can appear if people set
5450 otherwise uncaught exceptions which can appear if people set
5449 sys.stdout to something badly broken. Thanks to a crash report
5451 sys.stdout to something badly broken. Thanks to a crash report
5450 from henni-AT-mail.brainbot.com.
5452 from henni-AT-mail.brainbot.com.
5451
5453
5452 2002-11-04 Fernando Perez <fperez@colorado.edu>
5454 2002-11-04 Fernando Perez <fperez@colorado.edu>
5453
5455
5454 * IPython/iplib.py (InteractiveShell.interact): added
5456 * IPython/iplib.py (InteractiveShell.interact): added
5455 __IPYTHON__active to the builtins. It's a flag which goes on when
5457 __IPYTHON__active to the builtins. It's a flag which goes on when
5456 the interaction starts and goes off again when it stops. This
5458 the interaction starts and goes off again when it stops. This
5457 allows embedding code to detect being inside IPython. Before this
5459 allows embedding code to detect being inside IPython. Before this
5458 was done via __IPYTHON__, but that only shows that an IPython
5460 was done via __IPYTHON__, but that only shows that an IPython
5459 instance has been created.
5461 instance has been created.
5460
5462
5461 * IPython/Magic.py (Magic.magic_env): I realized that in a
5463 * IPython/Magic.py (Magic.magic_env): I realized that in a
5462 UserDict, instance.data holds the data as a normal dict. So I
5464 UserDict, instance.data holds the data as a normal dict. So I
5463 modified @env to return os.environ.data instead of rebuilding a
5465 modified @env to return os.environ.data instead of rebuilding a
5464 dict by hand.
5466 dict by hand.
5465
5467
5466 2002-11-02 Fernando Perez <fperez@colorado.edu>
5468 2002-11-02 Fernando Perez <fperez@colorado.edu>
5467
5469
5468 * IPython/genutils.py (warn): changed so that level 1 prints no
5470 * IPython/genutils.py (warn): changed so that level 1 prints no
5469 header. Level 2 is now the default (with 'WARNING' header, as
5471 header. Level 2 is now the default (with 'WARNING' header, as
5470 before). I think I tracked all places where changes were needed in
5472 before). I think I tracked all places where changes were needed in
5471 IPython, but outside code using the old level numbering may have
5473 IPython, but outside code using the old level numbering may have
5472 broken.
5474 broken.
5473
5475
5474 * IPython/iplib.py (InteractiveShell.runcode): added this to
5476 * IPython/iplib.py (InteractiveShell.runcode): added this to
5475 handle the tracebacks in SystemExit traps correctly. The previous
5477 handle the tracebacks in SystemExit traps correctly. The previous
5476 code (through interact) was printing more of the stack than
5478 code (through interact) was printing more of the stack than
5477 necessary, showing IPython internal code to the user.
5479 necessary, showing IPython internal code to the user.
5478
5480
5479 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5481 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5480 default. Now that the default at the confirmation prompt is yes,
5482 default. Now that the default at the confirmation prompt is yes,
5481 it's not so intrusive. François' argument that ipython sessions
5483 it's not so intrusive. François' argument that ipython sessions
5482 tend to be complex enough not to lose them from an accidental C-d,
5484 tend to be complex enough not to lose them from an accidental C-d,
5483 is a valid one.
5485 is a valid one.
5484
5486
5485 * IPython/iplib.py (InteractiveShell.interact): added a
5487 * IPython/iplib.py (InteractiveShell.interact): added a
5486 showtraceback() call to the SystemExit trap, and modified the exit
5488 showtraceback() call to the SystemExit trap, and modified the exit
5487 confirmation to have yes as the default.
5489 confirmation to have yes as the default.
5488
5490
5489 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5491 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5490 this file. It's been gone from the code for a long time, this was
5492 this file. It's been gone from the code for a long time, this was
5491 simply leftover junk.
5493 simply leftover junk.
5492
5494
5493 2002-11-01 Fernando Perez <fperez@colorado.edu>
5495 2002-11-01 Fernando Perez <fperez@colorado.edu>
5494
5496
5495 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5497 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5496 added. If set, IPython now traps EOF and asks for
5498 added. If set, IPython now traps EOF and asks for
5497 confirmation. After a request by François Pinard.
5499 confirmation. After a request by François Pinard.
5498
5500
5499 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5501 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5500 of @abort, and with a new (better) mechanism for handling the
5502 of @abort, and with a new (better) mechanism for handling the
5501 exceptions.
5503 exceptions.
5502
5504
5503 2002-10-27 Fernando Perez <fperez@colorado.edu>
5505 2002-10-27 Fernando Perez <fperez@colorado.edu>
5504
5506
5505 * IPython/usage.py (__doc__): updated the --help information and
5507 * IPython/usage.py (__doc__): updated the --help information and
5506 the ipythonrc file to indicate that -log generates
5508 the ipythonrc file to indicate that -log generates
5507 ./ipython.log. Also fixed the corresponding info in @logstart.
5509 ./ipython.log. Also fixed the corresponding info in @logstart.
5508 This and several other fixes in the manuals thanks to reports by
5510 This and several other fixes in the manuals thanks to reports by
5509 François Pinard <pinard-AT-iro.umontreal.ca>.
5511 François Pinard <pinard-AT-iro.umontreal.ca>.
5510
5512
5511 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5513 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5512 refer to @logstart (instead of @log, which doesn't exist).
5514 refer to @logstart (instead of @log, which doesn't exist).
5513
5515
5514 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5516 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5515 AttributeError crash. Thanks to Christopher Armstrong
5517 AttributeError crash. Thanks to Christopher Armstrong
5516 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5518 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5517 introduced recently (in 0.2.14pre37) with the fix to the eval
5519 introduced recently (in 0.2.14pre37) with the fix to the eval
5518 problem mentioned below.
5520 problem mentioned below.
5519
5521
5520 2002-10-17 Fernando Perez <fperez@colorado.edu>
5522 2002-10-17 Fernando Perez <fperez@colorado.edu>
5521
5523
5522 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5524 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5523 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5525 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5524
5526
5525 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5527 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5526 this function to fix a problem reported by Alex Schmolck. He saw
5528 this function to fix a problem reported by Alex Schmolck. He saw
5527 it with list comprehensions and generators, which were getting
5529 it with list comprehensions and generators, which were getting
5528 called twice. The real problem was an 'eval' call in testing for
5530 called twice. The real problem was an 'eval' call in testing for
5529 automagic which was evaluating the input line silently.
5531 automagic which was evaluating the input line silently.
5530
5532
5531 This is a potentially very nasty bug, if the input has side
5533 This is a potentially very nasty bug, if the input has side
5532 effects which must not be repeated. The code is much cleaner now,
5534 effects which must not be repeated. The code is much cleaner now,
5533 without any blanket 'except' left and with a regexp test for
5535 without any blanket 'except' left and with a regexp test for
5534 actual function names.
5536 actual function names.
5535
5537
5536 But an eval remains, which I'm not fully comfortable with. I just
5538 But an eval remains, which I'm not fully comfortable with. I just
5537 don't know how to find out if an expression could be a callable in
5539 don't know how to find out if an expression could be a callable in
5538 the user's namespace without doing an eval on the string. However
5540 the user's namespace without doing an eval on the string. However
5539 that string is now much more strictly checked so that no code
5541 that string is now much more strictly checked so that no code
5540 slips by, so the eval should only happen for things that can
5542 slips by, so the eval should only happen for things that can
5541 really be only function/method names.
5543 really be only function/method names.
5542
5544
5543 2002-10-15 Fernando Perez <fperez@colorado.edu>
5545 2002-10-15 Fernando Perez <fperez@colorado.edu>
5544
5546
5545 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5547 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5546 OSX information to main manual, removed README_Mac_OSX file from
5548 OSX information to main manual, removed README_Mac_OSX file from
5547 distribution. Also updated credits for recent additions.
5549 distribution. Also updated credits for recent additions.
5548
5550
5549 2002-10-10 Fernando Perez <fperez@colorado.edu>
5551 2002-10-10 Fernando Perez <fperez@colorado.edu>
5550
5552
5551 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5553 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5552 terminal-related issues. Many thanks to Andrea Riciputi
5554 terminal-related issues. Many thanks to Andrea Riciputi
5553 <andrea.riciputi-AT-libero.it> for writing it.
5555 <andrea.riciputi-AT-libero.it> for writing it.
5554
5556
5555 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5557 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5556 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5558 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5557
5559
5558 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5560 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5559 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5561 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5560 <syver-en-AT-online.no> who both submitted patches for this problem.
5562 <syver-en-AT-online.no> who both submitted patches for this problem.
5561
5563
5562 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5564 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5563 global embedding to make sure that things don't overwrite user
5565 global embedding to make sure that things don't overwrite user
5564 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5566 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5565
5567
5566 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5568 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5567 compatibility. Thanks to Hayden Callow
5569 compatibility. Thanks to Hayden Callow
5568 <h.callow-AT-elec.canterbury.ac.nz>
5570 <h.callow-AT-elec.canterbury.ac.nz>
5569
5571
5570 2002-10-04 Fernando Perez <fperez@colorado.edu>
5572 2002-10-04 Fernando Perez <fperez@colorado.edu>
5571
5573
5572 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5574 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5573 Gnuplot.File objects.
5575 Gnuplot.File objects.
5574
5576
5575 2002-07-23 Fernando Perez <fperez@colorado.edu>
5577 2002-07-23 Fernando Perez <fperez@colorado.edu>
5576
5578
5577 * IPython/genutils.py (timing): Added timings() and timing() for
5579 * IPython/genutils.py (timing): Added timings() and timing() for
5578 quick access to the most commonly needed data, the execution
5580 quick access to the most commonly needed data, the execution
5579 times. Old timing() renamed to timings_out().
5581 times. Old timing() renamed to timings_out().
5580
5582
5581 2002-07-18 Fernando Perez <fperez@colorado.edu>
5583 2002-07-18 Fernando Perez <fperez@colorado.edu>
5582
5584
5583 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5585 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5584 bug with nested instances disrupting the parent's tab completion.
5586 bug with nested instances disrupting the parent's tab completion.
5585
5587
5586 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5588 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5587 all_completions code to begin the emacs integration.
5589 all_completions code to begin the emacs integration.
5588
5590
5589 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5591 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5590 argument to allow titling individual arrays when plotting.
5592 argument to allow titling individual arrays when plotting.
5591
5593
5592 2002-07-15 Fernando Perez <fperez@colorado.edu>
5594 2002-07-15 Fernando Perez <fperez@colorado.edu>
5593
5595
5594 * setup.py (make_shortcut): changed to retrieve the value of
5596 * setup.py (make_shortcut): changed to retrieve the value of
5595 'Program Files' directory from the registry (this value changes in
5597 'Program Files' directory from the registry (this value changes in
5596 non-english versions of Windows). Thanks to Thomas Fanslau
5598 non-english versions of Windows). Thanks to Thomas Fanslau
5597 <tfanslau-AT-gmx.de> for the report.
5599 <tfanslau-AT-gmx.de> for the report.
5598
5600
5599 2002-07-10 Fernando Perez <fperez@colorado.edu>
5601 2002-07-10 Fernando Perez <fperez@colorado.edu>
5600
5602
5601 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5603 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5602 a bug in pdb, which crashes if a line with only whitespace is
5604 a bug in pdb, which crashes if a line with only whitespace is
5603 entered. Bug report submitted to sourceforge.
5605 entered. Bug report submitted to sourceforge.
5604
5606
5605 2002-07-09 Fernando Perez <fperez@colorado.edu>
5607 2002-07-09 Fernando Perez <fperez@colorado.edu>
5606
5608
5607 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5609 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5608 reporting exceptions (it's a bug in inspect.py, I just set a
5610 reporting exceptions (it's a bug in inspect.py, I just set a
5609 workaround).
5611 workaround).
5610
5612
5611 2002-07-08 Fernando Perez <fperez@colorado.edu>
5613 2002-07-08 Fernando Perez <fperez@colorado.edu>
5612
5614
5613 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5615 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5614 __IPYTHON__ in __builtins__ to show up in user_ns.
5616 __IPYTHON__ in __builtins__ to show up in user_ns.
5615
5617
5616 2002-07-03 Fernando Perez <fperez@colorado.edu>
5618 2002-07-03 Fernando Perez <fperez@colorado.edu>
5617
5619
5618 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5620 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5619 name from @gp_set_instance to @gp_set_default.
5621 name from @gp_set_instance to @gp_set_default.
5620
5622
5621 * IPython/ipmaker.py (make_IPython): default editor value set to
5623 * IPython/ipmaker.py (make_IPython): default editor value set to
5622 '0' (a string), to match the rc file. Otherwise will crash when
5624 '0' (a string), to match the rc file. Otherwise will crash when
5623 .strip() is called on it.
5625 .strip() is called on it.
5624
5626
5625
5627
5626 2002-06-28 Fernando Perez <fperez@colorado.edu>
5628 2002-06-28 Fernando Perez <fperez@colorado.edu>
5627
5629
5628 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5630 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5629 of files in current directory when a file is executed via
5631 of files in current directory when a file is executed via
5630 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5632 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5631
5633
5632 * setup.py (manfiles): fix for rpm builds, submitted by RA
5634 * setup.py (manfiles): fix for rpm builds, submitted by RA
5633 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5635 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5634
5636
5635 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5637 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5636 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5638 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5637 string!). A. Schmolck caught this one.
5639 string!). A. Schmolck caught this one.
5638
5640
5639 2002-06-27 Fernando Perez <fperez@colorado.edu>
5641 2002-06-27 Fernando Perez <fperez@colorado.edu>
5640
5642
5641 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5643 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5642 defined files at the cmd line. __name__ wasn't being set to
5644 defined files at the cmd line. __name__ wasn't being set to
5643 __main__.
5645 __main__.
5644
5646
5645 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5647 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5646 regular lists and tuples besides Numeric arrays.
5648 regular lists and tuples besides Numeric arrays.
5647
5649
5648 * IPython/Prompts.py (CachedOutput.__call__): Added output
5650 * IPython/Prompts.py (CachedOutput.__call__): Added output
5649 supression for input ending with ';'. Similar to Mathematica and
5651 supression for input ending with ';'. Similar to Mathematica and
5650 Matlab. The _* vars and Out[] list are still updated, just like
5652 Matlab. The _* vars and Out[] list are still updated, just like
5651 Mathematica behaves.
5653 Mathematica behaves.
5652
5654
5653 2002-06-25 Fernando Perez <fperez@colorado.edu>
5655 2002-06-25 Fernando Perez <fperez@colorado.edu>
5654
5656
5655 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5657 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5656 .ini extensions for profiels under Windows.
5658 .ini extensions for profiels under Windows.
5657
5659
5658 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5660 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5659 string form. Fix contributed by Alexander Schmolck
5661 string form. Fix contributed by Alexander Schmolck
5660 <a.schmolck-AT-gmx.net>
5662 <a.schmolck-AT-gmx.net>
5661
5663
5662 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5664 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5663 pre-configured Gnuplot instance.
5665 pre-configured Gnuplot instance.
5664
5666
5665 2002-06-21 Fernando Perez <fperez@colorado.edu>
5667 2002-06-21 Fernando Perez <fperez@colorado.edu>
5666
5668
5667 * IPython/numutils.py (exp_safe): new function, works around the
5669 * IPython/numutils.py (exp_safe): new function, works around the
5668 underflow problems in Numeric.
5670 underflow problems in Numeric.
5669 (log2): New fn. Safe log in base 2: returns exact integer answer
5671 (log2): New fn. Safe log in base 2: returns exact integer answer
5670 for exact integer powers of 2.
5672 for exact integer powers of 2.
5671
5673
5672 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5674 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5673 properly.
5675 properly.
5674
5676
5675 2002-06-20 Fernando Perez <fperez@colorado.edu>
5677 2002-06-20 Fernando Perez <fperez@colorado.edu>
5676
5678
5677 * IPython/genutils.py (timing): new function like
5679 * IPython/genutils.py (timing): new function like
5678 Mathematica's. Similar to time_test, but returns more info.
5680 Mathematica's. Similar to time_test, but returns more info.
5679
5681
5680 2002-06-18 Fernando Perez <fperez@colorado.edu>
5682 2002-06-18 Fernando Perez <fperez@colorado.edu>
5681
5683
5682 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5684 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5683 according to Mike Heeter's suggestions.
5685 according to Mike Heeter's suggestions.
5684
5686
5685 2002-06-16 Fernando Perez <fperez@colorado.edu>
5687 2002-06-16 Fernando Perez <fperez@colorado.edu>
5686
5688
5687 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5689 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5688 system. GnuplotMagic is gone as a user-directory option. New files
5690 system. GnuplotMagic is gone as a user-directory option. New files
5689 make it easier to use all the gnuplot stuff both from external
5691 make it easier to use all the gnuplot stuff both from external
5690 programs as well as from IPython. Had to rewrite part of
5692 programs as well as from IPython. Had to rewrite part of
5691 hardcopy() b/c of a strange bug: often the ps files simply don't
5693 hardcopy() b/c of a strange bug: often the ps files simply don't
5692 get created, and require a repeat of the command (often several
5694 get created, and require a repeat of the command (often several
5693 times).
5695 times).
5694
5696
5695 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5697 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5696 resolve output channel at call time, so that if sys.stderr has
5698 resolve output channel at call time, so that if sys.stderr has
5697 been redirected by user this gets honored.
5699 been redirected by user this gets honored.
5698
5700
5699 2002-06-13 Fernando Perez <fperez@colorado.edu>
5701 2002-06-13 Fernando Perez <fperez@colorado.edu>
5700
5702
5701 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5703 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5702 IPShell. Kept a copy with the old names to avoid breaking people's
5704 IPShell. Kept a copy with the old names to avoid breaking people's
5703 embedded code.
5705 embedded code.
5704
5706
5705 * IPython/ipython: simplified it to the bare minimum after
5707 * IPython/ipython: simplified it to the bare minimum after
5706 Holger's suggestions. Added info about how to use it in
5708 Holger's suggestions. Added info about how to use it in
5707 PYTHONSTARTUP.
5709 PYTHONSTARTUP.
5708
5710
5709 * IPython/Shell.py (IPythonShell): changed the options passing
5711 * IPython/Shell.py (IPythonShell): changed the options passing
5710 from a string with funky %s replacements to a straight list. Maybe
5712 from a string with funky %s replacements to a straight list. Maybe
5711 a bit more typing, but it follows sys.argv conventions, so there's
5713 a bit more typing, but it follows sys.argv conventions, so there's
5712 less special-casing to remember.
5714 less special-casing to remember.
5713
5715
5714 2002-06-12 Fernando Perez <fperez@colorado.edu>
5716 2002-06-12 Fernando Perez <fperez@colorado.edu>
5715
5717
5716 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5718 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5717 command. Thanks to a suggestion by Mike Heeter.
5719 command. Thanks to a suggestion by Mike Heeter.
5718 (Magic.magic_pfile): added behavior to look at filenames if given
5720 (Magic.magic_pfile): added behavior to look at filenames if given
5719 arg is not a defined object.
5721 arg is not a defined object.
5720 (Magic.magic_save): New @save function to save code snippets. Also
5722 (Magic.magic_save): New @save function to save code snippets. Also
5721 a Mike Heeter idea.
5723 a Mike Heeter idea.
5722
5724
5723 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5725 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5724 plot() and replot(). Much more convenient now, especially for
5726 plot() and replot(). Much more convenient now, especially for
5725 interactive use.
5727 interactive use.
5726
5728
5727 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5729 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5728 filenames.
5730 filenames.
5729
5731
5730 2002-06-02 Fernando Perez <fperez@colorado.edu>
5732 2002-06-02 Fernando Perez <fperez@colorado.edu>
5731
5733
5732 * IPython/Struct.py (Struct.__init__): modified to admit
5734 * IPython/Struct.py (Struct.__init__): modified to admit
5733 initialization via another struct.
5735 initialization via another struct.
5734
5736
5735 * IPython/genutils.py (SystemExec.__init__): New stateful
5737 * IPython/genutils.py (SystemExec.__init__): New stateful
5736 interface to xsys and bq. Useful for writing system scripts.
5738 interface to xsys and bq. Useful for writing system scripts.
5737
5739
5738 2002-05-30 Fernando Perez <fperez@colorado.edu>
5740 2002-05-30 Fernando Perez <fperez@colorado.edu>
5739
5741
5740 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5742 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5741 documents. This will make the user download smaller (it's getting
5743 documents. This will make the user download smaller (it's getting
5742 too big).
5744 too big).
5743
5745
5744 2002-05-29 Fernando Perez <fperez@colorado.edu>
5746 2002-05-29 Fernando Perez <fperez@colorado.edu>
5745
5747
5746 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5748 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5747 fix problems with shelve and pickle. Seems to work, but I don't
5749 fix problems with shelve and pickle. Seems to work, but I don't
5748 know if corner cases break it. Thanks to Mike Heeter
5750 know if corner cases break it. Thanks to Mike Heeter
5749 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5751 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5750
5752
5751 2002-05-24 Fernando Perez <fperez@colorado.edu>
5753 2002-05-24 Fernando Perez <fperez@colorado.edu>
5752
5754
5753 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5755 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5754 macros having broken.
5756 macros having broken.
5755
5757
5756 2002-05-21 Fernando Perez <fperez@colorado.edu>
5758 2002-05-21 Fernando Perez <fperez@colorado.edu>
5757
5759
5758 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5760 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5759 introduced logging bug: all history before logging started was
5761 introduced logging bug: all history before logging started was
5760 being written one character per line! This came from the redesign
5762 being written one character per line! This came from the redesign
5761 of the input history as a special list which slices to strings,
5763 of the input history as a special list which slices to strings,
5762 not to lists.
5764 not to lists.
5763
5765
5764 2002-05-20 Fernando Perez <fperez@colorado.edu>
5766 2002-05-20 Fernando Perez <fperez@colorado.edu>
5765
5767
5766 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5768 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5767 be an attribute of all classes in this module. The design of these
5769 be an attribute of all classes in this module. The design of these
5768 classes needs some serious overhauling.
5770 classes needs some serious overhauling.
5769
5771
5770 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5772 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5771 which was ignoring '_' in option names.
5773 which was ignoring '_' in option names.
5772
5774
5773 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5775 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5774 'Verbose_novars' to 'Context' and made it the new default. It's a
5776 'Verbose_novars' to 'Context' and made it the new default. It's a
5775 bit more readable and also safer than verbose.
5777 bit more readable and also safer than verbose.
5776
5778
5777 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5779 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5778 triple-quoted strings.
5780 triple-quoted strings.
5779
5781
5780 * IPython/OInspect.py (__all__): new module exposing the object
5782 * IPython/OInspect.py (__all__): new module exposing the object
5781 introspection facilities. Now the corresponding magics are dummy
5783 introspection facilities. Now the corresponding magics are dummy
5782 wrappers around this. Having this module will make it much easier
5784 wrappers around this. Having this module will make it much easier
5783 to put these functions into our modified pdb.
5785 to put these functions into our modified pdb.
5784 This new object inspector system uses the new colorizing module,
5786 This new object inspector system uses the new colorizing module,
5785 so source code and other things are nicely syntax highlighted.
5787 so source code and other things are nicely syntax highlighted.
5786
5788
5787 2002-05-18 Fernando Perez <fperez@colorado.edu>
5789 2002-05-18 Fernando Perez <fperez@colorado.edu>
5788
5790
5789 * IPython/ColorANSI.py: Split the coloring tools into a separate
5791 * IPython/ColorANSI.py: Split the coloring tools into a separate
5790 module so I can use them in other code easier (they were part of
5792 module so I can use them in other code easier (they were part of
5791 ultraTB).
5793 ultraTB).
5792
5794
5793 2002-05-17 Fernando Perez <fperez@colorado.edu>
5795 2002-05-17 Fernando Perez <fperez@colorado.edu>
5794
5796
5795 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5797 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5796 fixed it to set the global 'g' also to the called instance, as
5798 fixed it to set the global 'g' also to the called instance, as
5797 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5799 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5798 user's 'g' variables).
5800 user's 'g' variables).
5799
5801
5800 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5802 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5801 global variables (aliases to _ih,_oh) so that users which expect
5803 global variables (aliases to _ih,_oh) so that users which expect
5802 In[5] or Out[7] to work aren't unpleasantly surprised.
5804 In[5] or Out[7] to work aren't unpleasantly surprised.
5803 (InputList.__getslice__): new class to allow executing slices of
5805 (InputList.__getslice__): new class to allow executing slices of
5804 input history directly. Very simple class, complements the use of
5806 input history directly. Very simple class, complements the use of
5805 macros.
5807 macros.
5806
5808
5807 2002-05-16 Fernando Perez <fperez@colorado.edu>
5809 2002-05-16 Fernando Perez <fperez@colorado.edu>
5808
5810
5809 * setup.py (docdirbase): make doc directory be just doc/IPython
5811 * setup.py (docdirbase): make doc directory be just doc/IPython
5810 without version numbers, it will reduce clutter for users.
5812 without version numbers, it will reduce clutter for users.
5811
5813
5812 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5814 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5813 execfile call to prevent possible memory leak. See for details:
5815 execfile call to prevent possible memory leak. See for details:
5814 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5816 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5815
5817
5816 2002-05-15 Fernando Perez <fperez@colorado.edu>
5818 2002-05-15 Fernando Perez <fperez@colorado.edu>
5817
5819
5818 * IPython/Magic.py (Magic.magic_psource): made the object
5820 * IPython/Magic.py (Magic.magic_psource): made the object
5819 introspection names be more standard: pdoc, pdef, pfile and
5821 introspection names be more standard: pdoc, pdef, pfile and
5820 psource. They all print/page their output, and it makes
5822 psource. They all print/page their output, and it makes
5821 remembering them easier. Kept old names for compatibility as
5823 remembering them easier. Kept old names for compatibility as
5822 aliases.
5824 aliases.
5823
5825
5824 2002-05-14 Fernando Perez <fperez@colorado.edu>
5826 2002-05-14 Fernando Perez <fperez@colorado.edu>
5825
5827
5826 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5828 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5827 what the mouse problem was. The trick is to use gnuplot with temp
5829 what the mouse problem was. The trick is to use gnuplot with temp
5828 files and NOT with pipes (for data communication), because having
5830 files and NOT with pipes (for data communication), because having
5829 both pipes and the mouse on is bad news.
5831 both pipes and the mouse on is bad news.
5830
5832
5831 2002-05-13 Fernando Perez <fperez@colorado.edu>
5833 2002-05-13 Fernando Perez <fperez@colorado.edu>
5832
5834
5833 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5835 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5834 bug. Information would be reported about builtins even when
5836 bug. Information would be reported about builtins even when
5835 user-defined functions overrode them.
5837 user-defined functions overrode them.
5836
5838
5837 2002-05-11 Fernando Perez <fperez@colorado.edu>
5839 2002-05-11 Fernando Perez <fperez@colorado.edu>
5838
5840
5839 * IPython/__init__.py (__all__): removed FlexCompleter from
5841 * IPython/__init__.py (__all__): removed FlexCompleter from
5840 __all__ so that things don't fail in platforms without readline.
5842 __all__ so that things don't fail in platforms without readline.
5841
5843
5842 2002-05-10 Fernando Perez <fperez@colorado.edu>
5844 2002-05-10 Fernando Perez <fperez@colorado.edu>
5843
5845
5844 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5846 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5845 it requires Numeric, effectively making Numeric a dependency for
5847 it requires Numeric, effectively making Numeric a dependency for
5846 IPython.
5848 IPython.
5847
5849
5848 * Released 0.2.13
5850 * Released 0.2.13
5849
5851
5850 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5852 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5851 profiler interface. Now all the major options from the profiler
5853 profiler interface. Now all the major options from the profiler
5852 module are directly supported in IPython, both for single
5854 module are directly supported in IPython, both for single
5853 expressions (@prun) and for full programs (@run -p).
5855 expressions (@prun) and for full programs (@run -p).
5854
5856
5855 2002-05-09 Fernando Perez <fperez@colorado.edu>
5857 2002-05-09 Fernando Perez <fperez@colorado.edu>
5856
5858
5857 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5859 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5858 magic properly formatted for screen.
5860 magic properly formatted for screen.
5859
5861
5860 * setup.py (make_shortcut): Changed things to put pdf version in
5862 * setup.py (make_shortcut): Changed things to put pdf version in
5861 doc/ instead of doc/manual (had to change lyxport a bit).
5863 doc/ instead of doc/manual (had to change lyxport a bit).
5862
5864
5863 * IPython/Magic.py (Profile.string_stats): made profile runs go
5865 * IPython/Magic.py (Profile.string_stats): made profile runs go
5864 through pager (they are long and a pager allows searching, saving,
5866 through pager (they are long and a pager allows searching, saving,
5865 etc.)
5867 etc.)
5866
5868
5867 2002-05-08 Fernando Perez <fperez@colorado.edu>
5869 2002-05-08 Fernando Perez <fperez@colorado.edu>
5868
5870
5869 * Released 0.2.12
5871 * Released 0.2.12
5870
5872
5871 2002-05-06 Fernando Perez <fperez@colorado.edu>
5873 2002-05-06 Fernando Perez <fperez@colorado.edu>
5872
5874
5873 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5875 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5874 introduced); 'hist n1 n2' was broken.
5876 introduced); 'hist n1 n2' was broken.
5875 (Magic.magic_pdb): added optional on/off arguments to @pdb
5877 (Magic.magic_pdb): added optional on/off arguments to @pdb
5876 (Magic.magic_run): added option -i to @run, which executes code in
5878 (Magic.magic_run): added option -i to @run, which executes code in
5877 the IPython namespace instead of a clean one. Also added @irun as
5879 the IPython namespace instead of a clean one. Also added @irun as
5878 an alias to @run -i.
5880 an alias to @run -i.
5879
5881
5880 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5882 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5881 fixed (it didn't really do anything, the namespaces were wrong).
5883 fixed (it didn't really do anything, the namespaces were wrong).
5882
5884
5883 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5885 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5884
5886
5885 * IPython/__init__.py (__all__): Fixed package namespace, now
5887 * IPython/__init__.py (__all__): Fixed package namespace, now
5886 'import IPython' does give access to IPython.<all> as
5888 'import IPython' does give access to IPython.<all> as
5887 expected. Also renamed __release__ to Release.
5889 expected. Also renamed __release__ to Release.
5888
5890
5889 * IPython/Debugger.py (__license__): created new Pdb class which
5891 * IPython/Debugger.py (__license__): created new Pdb class which
5890 functions like a drop-in for the normal pdb.Pdb but does NOT
5892 functions like a drop-in for the normal pdb.Pdb but does NOT
5891 import readline by default. This way it doesn't muck up IPython's
5893 import readline by default. This way it doesn't muck up IPython's
5892 readline handling, and now tab-completion finally works in the
5894 readline handling, and now tab-completion finally works in the
5893 debugger -- sort of. It completes things globally visible, but the
5895 debugger -- sort of. It completes things globally visible, but the
5894 completer doesn't track the stack as pdb walks it. That's a bit
5896 completer doesn't track the stack as pdb walks it. That's a bit
5895 tricky, and I'll have to implement it later.
5897 tricky, and I'll have to implement it later.
5896
5898
5897 2002-05-05 Fernando Perez <fperez@colorado.edu>
5899 2002-05-05 Fernando Perez <fperez@colorado.edu>
5898
5900
5899 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5901 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5900 magic docstrings when printed via ? (explicit \'s were being
5902 magic docstrings when printed via ? (explicit \'s were being
5901 printed).
5903 printed).
5902
5904
5903 * IPython/ipmaker.py (make_IPython): fixed namespace
5905 * IPython/ipmaker.py (make_IPython): fixed namespace
5904 identification bug. Now variables loaded via logs or command-line
5906 identification bug. Now variables loaded via logs or command-line
5905 files are recognized in the interactive namespace by @who.
5907 files are recognized in the interactive namespace by @who.
5906
5908
5907 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5909 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5908 log replay system stemming from the string form of Structs.
5910 log replay system stemming from the string form of Structs.
5909
5911
5910 * IPython/Magic.py (Macro.__init__): improved macros to properly
5912 * IPython/Magic.py (Macro.__init__): improved macros to properly
5911 handle magic commands in them.
5913 handle magic commands in them.
5912 (Magic.magic_logstart): usernames are now expanded so 'logstart
5914 (Magic.magic_logstart): usernames are now expanded so 'logstart
5913 ~/mylog' now works.
5915 ~/mylog' now works.
5914
5916
5915 * IPython/iplib.py (complete): fixed bug where paths starting with
5917 * IPython/iplib.py (complete): fixed bug where paths starting with
5916 '/' would be completed as magic names.
5918 '/' would be completed as magic names.
5917
5919
5918 2002-05-04 Fernando Perez <fperez@colorado.edu>
5920 2002-05-04 Fernando Perez <fperez@colorado.edu>
5919
5921
5920 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5922 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5921 allow running full programs under the profiler's control.
5923 allow running full programs under the profiler's control.
5922
5924
5923 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5925 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5924 mode to report exceptions verbosely but without formatting
5926 mode to report exceptions verbosely but without formatting
5925 variables. This addresses the issue of ipython 'freezing' (it's
5927 variables. This addresses the issue of ipython 'freezing' (it's
5926 not frozen, but caught in an expensive formatting loop) when huge
5928 not frozen, but caught in an expensive formatting loop) when huge
5927 variables are in the context of an exception.
5929 variables are in the context of an exception.
5928 (VerboseTB.text): Added '--->' markers at line where exception was
5930 (VerboseTB.text): Added '--->' markers at line where exception was
5929 triggered. Much clearer to read, especially in NoColor modes.
5931 triggered. Much clearer to read, especially in NoColor modes.
5930
5932
5931 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5933 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5932 implemented in reverse when changing to the new parse_options().
5934 implemented in reverse when changing to the new parse_options().
5933
5935
5934 2002-05-03 Fernando Perez <fperez@colorado.edu>
5936 2002-05-03 Fernando Perez <fperez@colorado.edu>
5935
5937
5936 * IPython/Magic.py (Magic.parse_options): new function so that
5938 * IPython/Magic.py (Magic.parse_options): new function so that
5937 magics can parse options easier.
5939 magics can parse options easier.
5938 (Magic.magic_prun): new function similar to profile.run(),
5940 (Magic.magic_prun): new function similar to profile.run(),
5939 suggested by Chris Hart.
5941 suggested by Chris Hart.
5940 (Magic.magic_cd): fixed behavior so that it only changes if
5942 (Magic.magic_cd): fixed behavior so that it only changes if
5941 directory actually is in history.
5943 directory actually is in history.
5942
5944
5943 * IPython/usage.py (__doc__): added information about potential
5945 * IPython/usage.py (__doc__): added information about potential
5944 slowness of Verbose exception mode when there are huge data
5946 slowness of Verbose exception mode when there are huge data
5945 structures to be formatted (thanks to Archie Paulson).
5947 structures to be formatted (thanks to Archie Paulson).
5946
5948
5947 * IPython/ipmaker.py (make_IPython): Changed default logging
5949 * IPython/ipmaker.py (make_IPython): Changed default logging
5948 (when simply called with -log) to use curr_dir/ipython.log in
5950 (when simply called with -log) to use curr_dir/ipython.log in
5949 rotate mode. Fixed crash which was occuring with -log before
5951 rotate mode. Fixed crash which was occuring with -log before
5950 (thanks to Jim Boyle).
5952 (thanks to Jim Boyle).
5951
5953
5952 2002-05-01 Fernando Perez <fperez@colorado.edu>
5954 2002-05-01 Fernando Perez <fperez@colorado.edu>
5953
5955
5954 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5956 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5955 was nasty -- though somewhat of a corner case).
5957 was nasty -- though somewhat of a corner case).
5956
5958
5957 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5959 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5958 text (was a bug).
5960 text (was a bug).
5959
5961
5960 2002-04-30 Fernando Perez <fperez@colorado.edu>
5962 2002-04-30 Fernando Perez <fperez@colorado.edu>
5961
5963
5962 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5964 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5963 a print after ^D or ^C from the user so that the In[] prompt
5965 a print after ^D or ^C from the user so that the In[] prompt
5964 doesn't over-run the gnuplot one.
5966 doesn't over-run the gnuplot one.
5965
5967
5966 2002-04-29 Fernando Perez <fperez@colorado.edu>
5968 2002-04-29 Fernando Perez <fperez@colorado.edu>
5967
5969
5968 * Released 0.2.10
5970 * Released 0.2.10
5969
5971
5970 * IPython/__release__.py (version): get date dynamically.
5972 * IPython/__release__.py (version): get date dynamically.
5971
5973
5972 * Misc. documentation updates thanks to Arnd's comments. Also ran
5974 * Misc. documentation updates thanks to Arnd's comments. Also ran
5973 a full spellcheck on the manual (hadn't been done in a while).
5975 a full spellcheck on the manual (hadn't been done in a while).
5974
5976
5975 2002-04-27 Fernando Perez <fperez@colorado.edu>
5977 2002-04-27 Fernando Perez <fperez@colorado.edu>
5976
5978
5977 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5979 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5978 starting a log in mid-session would reset the input history list.
5980 starting a log in mid-session would reset the input history list.
5979
5981
5980 2002-04-26 Fernando Perez <fperez@colorado.edu>
5982 2002-04-26 Fernando Perez <fperez@colorado.edu>
5981
5983
5982 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5984 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5983 all files were being included in an update. Now anything in
5985 all files were being included in an update. Now anything in
5984 UserConfig that matches [A-Za-z]*.py will go (this excludes
5986 UserConfig that matches [A-Za-z]*.py will go (this excludes
5985 __init__.py)
5987 __init__.py)
5986
5988
5987 2002-04-25 Fernando Perez <fperez@colorado.edu>
5989 2002-04-25 Fernando Perez <fperez@colorado.edu>
5988
5990
5989 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5991 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5990 to __builtins__ so that any form of embedded or imported code can
5992 to __builtins__ so that any form of embedded or imported code can
5991 test for being inside IPython.
5993 test for being inside IPython.
5992
5994
5993 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5995 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5994 changed to GnuplotMagic because it's now an importable module,
5996 changed to GnuplotMagic because it's now an importable module,
5995 this makes the name follow that of the standard Gnuplot module.
5997 this makes the name follow that of the standard Gnuplot module.
5996 GnuplotMagic can now be loaded at any time in mid-session.
5998 GnuplotMagic can now be loaded at any time in mid-session.
5997
5999
5998 2002-04-24 Fernando Perez <fperez@colorado.edu>
6000 2002-04-24 Fernando Perez <fperez@colorado.edu>
5999
6001
6000 * IPython/numutils.py: removed SIUnits. It doesn't properly set
6002 * IPython/numutils.py: removed SIUnits. It doesn't properly set
6001 the globals (IPython has its own namespace) and the
6003 the globals (IPython has its own namespace) and the
6002 PhysicalQuantity stuff is much better anyway.
6004 PhysicalQuantity stuff is much better anyway.
6003
6005
6004 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
6006 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
6005 embedding example to standard user directory for
6007 embedding example to standard user directory for
6006 distribution. Also put it in the manual.
6008 distribution. Also put it in the manual.
6007
6009
6008 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
6010 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
6009 instance as first argument (so it doesn't rely on some obscure
6011 instance as first argument (so it doesn't rely on some obscure
6010 hidden global).
6012 hidden global).
6011
6013
6012 * IPython/UserConfig/ipythonrc.py: put () back in accepted
6014 * IPython/UserConfig/ipythonrc.py: put () back in accepted
6013 delimiters. While it prevents ().TAB from working, it allows
6015 delimiters. While it prevents ().TAB from working, it allows
6014 completions in open (... expressions. This is by far a more common
6016 completions in open (... expressions. This is by far a more common
6015 case.
6017 case.
6016
6018
6017 2002-04-23 Fernando Perez <fperez@colorado.edu>
6019 2002-04-23 Fernando Perez <fperez@colorado.edu>
6018
6020
6019 * IPython/Extensions/InterpreterPasteInput.py: new
6021 * IPython/Extensions/InterpreterPasteInput.py: new
6020 syntax-processing module for pasting lines with >>> or ... at the
6022 syntax-processing module for pasting lines with >>> or ... at the
6021 start.
6023 start.
6022
6024
6023 * IPython/Extensions/PhysicalQ_Interactive.py
6025 * IPython/Extensions/PhysicalQ_Interactive.py
6024 (PhysicalQuantityInteractive.__int__): fixed to work with either
6026 (PhysicalQuantityInteractive.__int__): fixed to work with either
6025 Numeric or math.
6027 Numeric or math.
6026
6028
6027 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
6029 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
6028 provided profiles. Now we have:
6030 provided profiles. Now we have:
6029 -math -> math module as * and cmath with its own namespace.
6031 -math -> math module as * and cmath with its own namespace.
6030 -numeric -> Numeric as *, plus gnuplot & grace
6032 -numeric -> Numeric as *, plus gnuplot & grace
6031 -physics -> same as before
6033 -physics -> same as before
6032
6034
6033 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
6035 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
6034 user-defined magics wouldn't be found by @magic if they were
6036 user-defined magics wouldn't be found by @magic if they were
6035 defined as class methods. Also cleaned up the namespace search
6037 defined as class methods. Also cleaned up the namespace search
6036 logic and the string building (to use %s instead of many repeated
6038 logic and the string building (to use %s instead of many repeated
6037 string adds).
6039 string adds).
6038
6040
6039 * IPython/UserConfig/example-magic.py (magic_foo): updated example
6041 * IPython/UserConfig/example-magic.py (magic_foo): updated example
6040 of user-defined magics to operate with class methods (cleaner, in
6042 of user-defined magics to operate with class methods (cleaner, in
6041 line with the gnuplot code).
6043 line with the gnuplot code).
6042
6044
6043 2002-04-22 Fernando Perez <fperez@colorado.edu>
6045 2002-04-22 Fernando Perez <fperez@colorado.edu>
6044
6046
6045 * setup.py: updated dependency list so that manual is updated when
6047 * setup.py: updated dependency list so that manual is updated when
6046 all included files change.
6048 all included files change.
6047
6049
6048 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
6050 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
6049 the delimiter removal option (the fix is ugly right now).
6051 the delimiter removal option (the fix is ugly right now).
6050
6052
6051 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
6053 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
6052 all of the math profile (quicker loading, no conflict between
6054 all of the math profile (quicker loading, no conflict between
6053 g-9.8 and g-gnuplot).
6055 g-9.8 and g-gnuplot).
6054
6056
6055 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
6057 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
6056 name of post-mortem files to IPython_crash_report.txt.
6058 name of post-mortem files to IPython_crash_report.txt.
6057
6059
6058 * Cleanup/update of the docs. Added all the new readline info and
6060 * Cleanup/update of the docs. Added all the new readline info and
6059 formatted all lists as 'real lists'.
6061 formatted all lists as 'real lists'.
6060
6062
6061 * IPython/ipmaker.py (make_IPython): removed now-obsolete
6063 * IPython/ipmaker.py (make_IPython): removed now-obsolete
6062 tab-completion options, since the full readline parse_and_bind is
6064 tab-completion options, since the full readline parse_and_bind is
6063 now accessible.
6065 now accessible.
6064
6066
6065 * IPython/iplib.py (InteractiveShell.init_readline): Changed
6067 * IPython/iplib.py (InteractiveShell.init_readline): Changed
6066 handling of readline options. Now users can specify any string to
6068 handling of readline options. Now users can specify any string to
6067 be passed to parse_and_bind(), as well as the delimiters to be
6069 be passed to parse_and_bind(), as well as the delimiters to be
6068 removed.
6070 removed.
6069 (InteractiveShell.__init__): Added __name__ to the global
6071 (InteractiveShell.__init__): Added __name__ to the global
6070 namespace so that things like Itpl which rely on its existence
6072 namespace so that things like Itpl which rely on its existence
6071 don't crash.
6073 don't crash.
6072 (InteractiveShell._prefilter): Defined the default with a _ so
6074 (InteractiveShell._prefilter): Defined the default with a _ so
6073 that prefilter() is easier to override, while the default one
6075 that prefilter() is easier to override, while the default one
6074 remains available.
6076 remains available.
6075
6077
6076 2002-04-18 Fernando Perez <fperez@colorado.edu>
6078 2002-04-18 Fernando Perez <fperez@colorado.edu>
6077
6079
6078 * Added information about pdb in the docs.
6080 * Added information about pdb in the docs.
6079
6081
6080 2002-04-17 Fernando Perez <fperez@colorado.edu>
6082 2002-04-17 Fernando Perez <fperez@colorado.edu>
6081
6083
6082 * IPython/ipmaker.py (make_IPython): added rc_override option to
6084 * IPython/ipmaker.py (make_IPython): added rc_override option to
6083 allow passing config options at creation time which may override
6085 allow passing config options at creation time which may override
6084 anything set in the config files or command line. This is
6086 anything set in the config files or command line. This is
6085 particularly useful for configuring embedded instances.
6087 particularly useful for configuring embedded instances.
6086
6088
6087 2002-04-15 Fernando Perez <fperez@colorado.edu>
6089 2002-04-15 Fernando Perez <fperez@colorado.edu>
6088
6090
6089 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
6091 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
6090 crash embedded instances because of the input cache falling out of
6092 crash embedded instances because of the input cache falling out of
6091 sync with the output counter.
6093 sync with the output counter.
6092
6094
6093 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
6095 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
6094 mode which calls pdb after an uncaught exception in IPython itself.
6096 mode which calls pdb after an uncaught exception in IPython itself.
6095
6097
6096 2002-04-14 Fernando Perez <fperez@colorado.edu>
6098 2002-04-14 Fernando Perez <fperez@colorado.edu>
6097
6099
6098 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
6100 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
6099 readline, fix it back after each call.
6101 readline, fix it back after each call.
6100
6102
6101 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
6103 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
6102 method to force all access via __call__(), which guarantees that
6104 method to force all access via __call__(), which guarantees that
6103 traceback references are properly deleted.
6105 traceback references are properly deleted.
6104
6106
6105 * IPython/Prompts.py (CachedOutput._display): minor fixes to
6107 * IPython/Prompts.py (CachedOutput._display): minor fixes to
6106 improve printing when pprint is in use.
6108 improve printing when pprint is in use.
6107
6109
6108 2002-04-13 Fernando Perez <fperez@colorado.edu>
6110 2002-04-13 Fernando Perez <fperez@colorado.edu>
6109
6111
6110 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
6112 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
6111 exceptions aren't caught anymore. If the user triggers one, he
6113 exceptions aren't caught anymore. If the user triggers one, he
6112 should know why he's doing it and it should go all the way up,
6114 should know why he's doing it and it should go all the way up,
6113 just like any other exception. So now @abort will fully kill the
6115 just like any other exception. So now @abort will fully kill the
6114 embedded interpreter and the embedding code (unless that happens
6116 embedded interpreter and the embedding code (unless that happens
6115 to catch SystemExit).
6117 to catch SystemExit).
6116
6118
6117 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
6119 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
6118 and a debugger() method to invoke the interactive pdb debugger
6120 and a debugger() method to invoke the interactive pdb debugger
6119 after printing exception information. Also added the corresponding
6121 after printing exception information. Also added the corresponding
6120 -pdb option and @pdb magic to control this feature, and updated
6122 -pdb option and @pdb magic to control this feature, and updated
6121 the docs. After a suggestion from Christopher Hart
6123 the docs. After a suggestion from Christopher Hart
6122 (hart-AT-caltech.edu).
6124 (hart-AT-caltech.edu).
6123
6125
6124 2002-04-12 Fernando Perez <fperez@colorado.edu>
6126 2002-04-12 Fernando Perez <fperez@colorado.edu>
6125
6127
6126 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
6128 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
6127 the exception handlers defined by the user (not the CrashHandler)
6129 the exception handlers defined by the user (not the CrashHandler)
6128 so that user exceptions don't trigger an ipython bug report.
6130 so that user exceptions don't trigger an ipython bug report.
6129
6131
6130 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
6132 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
6131 configurable (it should have always been so).
6133 configurable (it should have always been so).
6132
6134
6133 2002-03-26 Fernando Perez <fperez@colorado.edu>
6135 2002-03-26 Fernando Perez <fperez@colorado.edu>
6134
6136
6135 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
6137 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
6136 and there to fix embedding namespace issues. This should all be
6138 and there to fix embedding namespace issues. This should all be
6137 done in a more elegant way.
6139 done in a more elegant way.
6138
6140
6139 2002-03-25 Fernando Perez <fperez@colorado.edu>
6141 2002-03-25 Fernando Perez <fperez@colorado.edu>
6140
6142
6141 * IPython/genutils.py (get_home_dir): Try to make it work under
6143 * IPython/genutils.py (get_home_dir): Try to make it work under
6142 win9x also.
6144 win9x also.
6143
6145
6144 2002-03-20 Fernando Perez <fperez@colorado.edu>
6146 2002-03-20 Fernando Perez <fperez@colorado.edu>
6145
6147
6146 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
6148 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
6147 sys.displayhook untouched upon __init__.
6149 sys.displayhook untouched upon __init__.
6148
6150
6149 2002-03-19 Fernando Perez <fperez@colorado.edu>
6151 2002-03-19 Fernando Perez <fperez@colorado.edu>
6150
6152
6151 * Released 0.2.9 (for embedding bug, basically).
6153 * Released 0.2.9 (for embedding bug, basically).
6152
6154
6153 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6155 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6154 exceptions so that enclosing shell's state can be restored.
6156 exceptions so that enclosing shell's state can be restored.
6155
6157
6156 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6158 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6157 naming conventions in the .ipython/ dir.
6159 naming conventions in the .ipython/ dir.
6158
6160
6159 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6161 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6160 from delimiters list so filenames with - in them get expanded.
6162 from delimiters list so filenames with - in them get expanded.
6161
6163
6162 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6164 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6163 sys.displayhook not being properly restored after an embedded call.
6165 sys.displayhook not being properly restored after an embedded call.
6164
6166
6165 2002-03-18 Fernando Perez <fperez@colorado.edu>
6167 2002-03-18 Fernando Perez <fperez@colorado.edu>
6166
6168
6167 * Released 0.2.8
6169 * Released 0.2.8
6168
6170
6169 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6171 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6170 some files weren't being included in a -upgrade.
6172 some files weren't being included in a -upgrade.
6171 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6173 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6172 on' so that the first tab completes.
6174 on' so that the first tab completes.
6173 (InteractiveShell.handle_magic): fixed bug with spaces around
6175 (InteractiveShell.handle_magic): fixed bug with spaces around
6174 quotes breaking many magic commands.
6176 quotes breaking many magic commands.
6175
6177
6176 * setup.py: added note about ignoring the syntax error messages at
6178 * setup.py: added note about ignoring the syntax error messages at
6177 installation.
6179 installation.
6178
6180
6179 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6181 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6180 streamlining the gnuplot interface, now there's only one magic @gp.
6182 streamlining the gnuplot interface, now there's only one magic @gp.
6181
6183
6182 2002-03-17 Fernando Perez <fperez@colorado.edu>
6184 2002-03-17 Fernando Perez <fperez@colorado.edu>
6183
6185
6184 * IPython/UserConfig/magic_gnuplot.py: new name for the
6186 * IPython/UserConfig/magic_gnuplot.py: new name for the
6185 example-magic_pm.py file. Much enhanced system, now with a shell
6187 example-magic_pm.py file. Much enhanced system, now with a shell
6186 for communicating directly with gnuplot, one command at a time.
6188 for communicating directly with gnuplot, one command at a time.
6187
6189
6188 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6190 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6189 setting __name__=='__main__'.
6191 setting __name__=='__main__'.
6190
6192
6191 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6193 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6192 mini-shell for accessing gnuplot from inside ipython. Should
6194 mini-shell for accessing gnuplot from inside ipython. Should
6193 extend it later for grace access too. Inspired by Arnd's
6195 extend it later for grace access too. Inspired by Arnd's
6194 suggestion.
6196 suggestion.
6195
6197
6196 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6198 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6197 calling magic functions with () in their arguments. Thanks to Arnd
6199 calling magic functions with () in their arguments. Thanks to Arnd
6198 Baecker for pointing this to me.
6200 Baecker for pointing this to me.
6199
6201
6200 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6202 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6201 infinitely for integer or complex arrays (only worked with floats).
6203 infinitely for integer or complex arrays (only worked with floats).
6202
6204
6203 2002-03-16 Fernando Perez <fperez@colorado.edu>
6205 2002-03-16 Fernando Perez <fperez@colorado.edu>
6204
6206
6205 * setup.py: Merged setup and setup_windows into a single script
6207 * setup.py: Merged setup and setup_windows into a single script
6206 which properly handles things for windows users.
6208 which properly handles things for windows users.
6207
6209
6208 2002-03-15 Fernando Perez <fperez@colorado.edu>
6210 2002-03-15 Fernando Perez <fperez@colorado.edu>
6209
6211
6210 * Big change to the manual: now the magics are all automatically
6212 * Big change to the manual: now the magics are all automatically
6211 documented. This information is generated from their docstrings
6213 documented. This information is generated from their docstrings
6212 and put in a latex file included by the manual lyx file. This way
6214 and put in a latex file included by the manual lyx file. This way
6213 we get always up to date information for the magics. The manual
6215 we get always up to date information for the magics. The manual
6214 now also has proper version information, also auto-synced.
6216 now also has proper version information, also auto-synced.
6215
6217
6216 For this to work, an undocumented --magic_docstrings option was added.
6218 For this to work, an undocumented --magic_docstrings option was added.
6217
6219
6218 2002-03-13 Fernando Perez <fperez@colorado.edu>
6220 2002-03-13 Fernando Perez <fperez@colorado.edu>
6219
6221
6220 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6222 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6221 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6223 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6222
6224
6223 2002-03-12 Fernando Perez <fperez@colorado.edu>
6225 2002-03-12 Fernando Perez <fperez@colorado.edu>
6224
6226
6225 * IPython/ultraTB.py (TermColors): changed color escapes again to
6227 * IPython/ultraTB.py (TermColors): changed color escapes again to
6226 fix the (old, reintroduced) line-wrapping bug. Basically, if
6228 fix the (old, reintroduced) line-wrapping bug. Basically, if
6227 \001..\002 aren't given in the color escapes, lines get wrapped
6229 \001..\002 aren't given in the color escapes, lines get wrapped
6228 weirdly. But giving those screws up old xterms and emacs terms. So
6230 weirdly. But giving those screws up old xterms and emacs terms. So
6229 I added some logic for emacs terms to be ok, but I can't identify old
6231 I added some logic for emacs terms to be ok, but I can't identify old
6230 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6232 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6231
6233
6232 2002-03-10 Fernando Perez <fperez@colorado.edu>
6234 2002-03-10 Fernando Perez <fperez@colorado.edu>
6233
6235
6234 * IPython/usage.py (__doc__): Various documentation cleanups and
6236 * IPython/usage.py (__doc__): Various documentation cleanups and
6235 updates, both in usage docstrings and in the manual.
6237 updates, both in usage docstrings and in the manual.
6236
6238
6237 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6239 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6238 handling of caching. Set minimum acceptabe value for having a
6240 handling of caching. Set minimum acceptabe value for having a
6239 cache at 20 values.
6241 cache at 20 values.
6240
6242
6241 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6243 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6242 install_first_time function to a method, renamed it and added an
6244 install_first_time function to a method, renamed it and added an
6243 'upgrade' mode. Now people can update their config directory with
6245 'upgrade' mode. Now people can update their config directory with
6244 a simple command line switch (-upgrade, also new).
6246 a simple command line switch (-upgrade, also new).
6245
6247
6246 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6248 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6247 @file (convenient for automagic users under Python >= 2.2).
6249 @file (convenient for automagic users under Python >= 2.2).
6248 Removed @files (it seemed more like a plural than an abbrev. of
6250 Removed @files (it seemed more like a plural than an abbrev. of
6249 'file show').
6251 'file show').
6250
6252
6251 * IPython/iplib.py (install_first_time): Fixed crash if there were
6253 * IPython/iplib.py (install_first_time): Fixed crash if there were
6252 backup files ('~') in .ipython/ install directory.
6254 backup files ('~') in .ipython/ install directory.
6253
6255
6254 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6256 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6255 system. Things look fine, but these changes are fairly
6257 system. Things look fine, but these changes are fairly
6256 intrusive. Test them for a few days.
6258 intrusive. Test them for a few days.
6257
6259
6258 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6260 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6259 the prompts system. Now all in/out prompt strings are user
6261 the prompts system. Now all in/out prompt strings are user
6260 controllable. This is particularly useful for embedding, as one
6262 controllable. This is particularly useful for embedding, as one
6261 can tag embedded instances with particular prompts.
6263 can tag embedded instances with particular prompts.
6262
6264
6263 Also removed global use of sys.ps1/2, which now allows nested
6265 Also removed global use of sys.ps1/2, which now allows nested
6264 embeddings without any problems. Added command-line options for
6266 embeddings without any problems. Added command-line options for
6265 the prompt strings.
6267 the prompt strings.
6266
6268
6267 2002-03-08 Fernando Perez <fperez@colorado.edu>
6269 2002-03-08 Fernando Perez <fperez@colorado.edu>
6268
6270
6269 * IPython/UserConfig/example-embed-short.py (ipshell): added
6271 * IPython/UserConfig/example-embed-short.py (ipshell): added
6270 example file with the bare minimum code for embedding.
6272 example file with the bare minimum code for embedding.
6271
6273
6272 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6274 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6273 functionality for the embeddable shell to be activated/deactivated
6275 functionality for the embeddable shell to be activated/deactivated
6274 either globally or at each call.
6276 either globally or at each call.
6275
6277
6276 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6278 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6277 rewriting the prompt with '--->' for auto-inputs with proper
6279 rewriting the prompt with '--->' for auto-inputs with proper
6278 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6280 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6279 this is handled by the prompts class itself, as it should.
6281 this is handled by the prompts class itself, as it should.
6280
6282
6281 2002-03-05 Fernando Perez <fperez@colorado.edu>
6283 2002-03-05 Fernando Perez <fperez@colorado.edu>
6282
6284
6283 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6285 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6284 @logstart to avoid name clashes with the math log function.
6286 @logstart to avoid name clashes with the math log function.
6285
6287
6286 * Big updates to X/Emacs section of the manual.
6288 * Big updates to X/Emacs section of the manual.
6287
6289
6288 * Removed ipython_emacs. Milan explained to me how to pass
6290 * Removed ipython_emacs. Milan explained to me how to pass
6289 arguments to ipython through Emacs. Some day I'm going to end up
6291 arguments to ipython through Emacs. Some day I'm going to end up
6290 learning some lisp...
6292 learning some lisp...
6291
6293
6292 2002-03-04 Fernando Perez <fperez@colorado.edu>
6294 2002-03-04 Fernando Perez <fperez@colorado.edu>
6293
6295
6294 * IPython/ipython_emacs: Created script to be used as the
6296 * IPython/ipython_emacs: Created script to be used as the
6295 py-python-command Emacs variable so we can pass IPython
6297 py-python-command Emacs variable so we can pass IPython
6296 parameters. I can't figure out how to tell Emacs directly to pass
6298 parameters. I can't figure out how to tell Emacs directly to pass
6297 parameters to IPython, so a dummy shell script will do it.
6299 parameters to IPython, so a dummy shell script will do it.
6298
6300
6299 Other enhancements made for things to work better under Emacs'
6301 Other enhancements made for things to work better under Emacs'
6300 various types of terminals. Many thanks to Milan Zamazal
6302 various types of terminals. Many thanks to Milan Zamazal
6301 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6303 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6302
6304
6303 2002-03-01 Fernando Perez <fperez@colorado.edu>
6305 2002-03-01 Fernando Perez <fperez@colorado.edu>
6304
6306
6305 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6307 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6306 that loading of readline is now optional. This gives better
6308 that loading of readline is now optional. This gives better
6307 control to emacs users.
6309 control to emacs users.
6308
6310
6309 * IPython/ultraTB.py (__date__): Modified color escape sequences
6311 * IPython/ultraTB.py (__date__): Modified color escape sequences
6310 and now things work fine under xterm and in Emacs' term buffers
6312 and now things work fine under xterm and in Emacs' term buffers
6311 (though not shell ones). Well, in emacs you get colors, but all
6313 (though not shell ones). Well, in emacs you get colors, but all
6312 seem to be 'light' colors (no difference between dark and light
6314 seem to be 'light' colors (no difference between dark and light
6313 ones). But the garbage chars are gone, and also in xterms. It
6315 ones). But the garbage chars are gone, and also in xterms. It
6314 seems that now I'm using 'cleaner' ansi sequences.
6316 seems that now I'm using 'cleaner' ansi sequences.
6315
6317
6316 2002-02-21 Fernando Perez <fperez@colorado.edu>
6318 2002-02-21 Fernando Perez <fperez@colorado.edu>
6317
6319
6318 * Released 0.2.7 (mainly to publish the scoping fix).
6320 * Released 0.2.7 (mainly to publish the scoping fix).
6319
6321
6320 * IPython/Logger.py (Logger.logstate): added. A corresponding
6322 * IPython/Logger.py (Logger.logstate): added. A corresponding
6321 @logstate magic was created.
6323 @logstate magic was created.
6322
6324
6323 * IPython/Magic.py: fixed nested scoping problem under Python
6325 * IPython/Magic.py: fixed nested scoping problem under Python
6324 2.1.x (automagic wasn't working).
6326 2.1.x (automagic wasn't working).
6325
6327
6326 2002-02-20 Fernando Perez <fperez@colorado.edu>
6328 2002-02-20 Fernando Perez <fperez@colorado.edu>
6327
6329
6328 * Released 0.2.6.
6330 * Released 0.2.6.
6329
6331
6330 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6332 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6331 option so that logs can come out without any headers at all.
6333 option so that logs can come out without any headers at all.
6332
6334
6333 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6335 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6334 SciPy.
6336 SciPy.
6335
6337
6336 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6338 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6337 that embedded IPython calls don't require vars() to be explicitly
6339 that embedded IPython calls don't require vars() to be explicitly
6338 passed. Now they are extracted from the caller's frame (code
6340 passed. Now they are extracted from the caller's frame (code
6339 snatched from Eric Jones' weave). Added better documentation to
6341 snatched from Eric Jones' weave). Added better documentation to
6340 the section on embedding and the example file.
6342 the section on embedding and the example file.
6341
6343
6342 * IPython/genutils.py (page): Changed so that under emacs, it just
6344 * IPython/genutils.py (page): Changed so that under emacs, it just
6343 prints the string. You can then page up and down in the emacs
6345 prints the string. You can then page up and down in the emacs
6344 buffer itself. This is how the builtin help() works.
6346 buffer itself. This is how the builtin help() works.
6345
6347
6346 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6348 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6347 macro scoping: macros need to be executed in the user's namespace
6349 macro scoping: macros need to be executed in the user's namespace
6348 to work as if they had been typed by the user.
6350 to work as if they had been typed by the user.
6349
6351
6350 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6352 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6351 execute automatically (no need to type 'exec...'). They then
6353 execute automatically (no need to type 'exec...'). They then
6352 behave like 'true macros'. The printing system was also modified
6354 behave like 'true macros'. The printing system was also modified
6353 for this to work.
6355 for this to work.
6354
6356
6355 2002-02-19 Fernando Perez <fperez@colorado.edu>
6357 2002-02-19 Fernando Perez <fperez@colorado.edu>
6356
6358
6357 * IPython/genutils.py (page_file): new function for paging files
6359 * IPython/genutils.py (page_file): new function for paging files
6358 in an OS-independent way. Also necessary for file viewing to work
6360 in an OS-independent way. Also necessary for file viewing to work
6359 well inside Emacs buffers.
6361 well inside Emacs buffers.
6360 (page): Added checks for being in an emacs buffer.
6362 (page): Added checks for being in an emacs buffer.
6361 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6363 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6362 same bug in iplib.
6364 same bug in iplib.
6363
6365
6364 2002-02-18 Fernando Perez <fperez@colorado.edu>
6366 2002-02-18 Fernando Perez <fperez@colorado.edu>
6365
6367
6366 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6368 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6367 of readline so that IPython can work inside an Emacs buffer.
6369 of readline so that IPython can work inside an Emacs buffer.
6368
6370
6369 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6371 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6370 method signatures (they weren't really bugs, but it looks cleaner
6372 method signatures (they weren't really bugs, but it looks cleaner
6371 and keeps PyChecker happy).
6373 and keeps PyChecker happy).
6372
6374
6373 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6375 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6374 for implementing various user-defined hooks. Currently only
6376 for implementing various user-defined hooks. Currently only
6375 display is done.
6377 display is done.
6376
6378
6377 * IPython/Prompts.py (CachedOutput._display): changed display
6379 * IPython/Prompts.py (CachedOutput._display): changed display
6378 functions so that they can be dynamically changed by users easily.
6380 functions so that they can be dynamically changed by users easily.
6379
6381
6380 * IPython/Extensions/numeric_formats.py (num_display): added an
6382 * IPython/Extensions/numeric_formats.py (num_display): added an
6381 extension for printing NumPy arrays in flexible manners. It
6383 extension for printing NumPy arrays in flexible manners. It
6382 doesn't do anything yet, but all the structure is in
6384 doesn't do anything yet, but all the structure is in
6383 place. Ultimately the plan is to implement output format control
6385 place. Ultimately the plan is to implement output format control
6384 like in Octave.
6386 like in Octave.
6385
6387
6386 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6388 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6387 methods are found at run-time by all the automatic machinery.
6389 methods are found at run-time by all the automatic machinery.
6388
6390
6389 2002-02-17 Fernando Perez <fperez@colorado.edu>
6391 2002-02-17 Fernando Perez <fperez@colorado.edu>
6390
6392
6391 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6393 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6392 whole file a little.
6394 whole file a little.
6393
6395
6394 * ToDo: closed this document. Now there's a new_design.lyx
6396 * ToDo: closed this document. Now there's a new_design.lyx
6395 document for all new ideas. Added making a pdf of it for the
6397 document for all new ideas. Added making a pdf of it for the
6396 end-user distro.
6398 end-user distro.
6397
6399
6398 * IPython/Logger.py (Logger.switch_log): Created this to replace
6400 * IPython/Logger.py (Logger.switch_log): Created this to replace
6399 logon() and logoff(). It also fixes a nasty crash reported by
6401 logon() and logoff(). It also fixes a nasty crash reported by
6400 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6402 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6401
6403
6402 * IPython/iplib.py (complete): got auto-completion to work with
6404 * IPython/iplib.py (complete): got auto-completion to work with
6403 automagic (I had wanted this for a long time).
6405 automagic (I had wanted this for a long time).
6404
6406
6405 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6407 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6406 to @file, since file() is now a builtin and clashes with automagic
6408 to @file, since file() is now a builtin and clashes with automagic
6407 for @file.
6409 for @file.
6408
6410
6409 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6411 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6410 of this was previously in iplib, which had grown to more than 2000
6412 of this was previously in iplib, which had grown to more than 2000
6411 lines, way too long. No new functionality, but it makes managing
6413 lines, way too long. No new functionality, but it makes managing
6412 the code a bit easier.
6414 the code a bit easier.
6413
6415
6414 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6416 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6415 information to crash reports.
6417 information to crash reports.
6416
6418
6417 2002-02-12 Fernando Perez <fperez@colorado.edu>
6419 2002-02-12 Fernando Perez <fperez@colorado.edu>
6418
6420
6419 * Released 0.2.5.
6421 * Released 0.2.5.
6420
6422
6421 2002-02-11 Fernando Perez <fperez@colorado.edu>
6423 2002-02-11 Fernando Perez <fperez@colorado.edu>
6422
6424
6423 * Wrote a relatively complete Windows installer. It puts
6425 * Wrote a relatively complete Windows installer. It puts
6424 everything in place, creates Start Menu entries and fixes the
6426 everything in place, creates Start Menu entries and fixes the
6425 color issues. Nothing fancy, but it works.
6427 color issues. Nothing fancy, but it works.
6426
6428
6427 2002-02-10 Fernando Perez <fperez@colorado.edu>
6429 2002-02-10 Fernando Perez <fperez@colorado.edu>
6428
6430
6429 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6431 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6430 os.path.expanduser() call so that we can type @run ~/myfile.py and
6432 os.path.expanduser() call so that we can type @run ~/myfile.py and
6431 have thigs work as expected.
6433 have thigs work as expected.
6432
6434
6433 * IPython/genutils.py (page): fixed exception handling so things
6435 * IPython/genutils.py (page): fixed exception handling so things
6434 work both in Unix and Windows correctly. Quitting a pager triggers
6436 work both in Unix and Windows correctly. Quitting a pager triggers
6435 an IOError/broken pipe in Unix, and in windows not finding a pager
6437 an IOError/broken pipe in Unix, and in windows not finding a pager
6436 is also an IOError, so I had to actually look at the return value
6438 is also an IOError, so I had to actually look at the return value
6437 of the exception, not just the exception itself. Should be ok now.
6439 of the exception, not just the exception itself. Should be ok now.
6438
6440
6439 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6441 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6440 modified to allow case-insensitive color scheme changes.
6442 modified to allow case-insensitive color scheme changes.
6441
6443
6442 2002-02-09 Fernando Perez <fperez@colorado.edu>
6444 2002-02-09 Fernando Perez <fperez@colorado.edu>
6443
6445
6444 * IPython/genutils.py (native_line_ends): new function to leave
6446 * IPython/genutils.py (native_line_ends): new function to leave
6445 user config files with os-native line-endings.
6447 user config files with os-native line-endings.
6446
6448
6447 * README and manual updates.
6449 * README and manual updates.
6448
6450
6449 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6451 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6450 instead of StringType to catch Unicode strings.
6452 instead of StringType to catch Unicode strings.
6451
6453
6452 * IPython/genutils.py (filefind): fixed bug for paths with
6454 * IPython/genutils.py (filefind): fixed bug for paths with
6453 embedded spaces (very common in Windows).
6455 embedded spaces (very common in Windows).
6454
6456
6455 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6457 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6456 files under Windows, so that they get automatically associated
6458 files under Windows, so that they get automatically associated
6457 with a text editor. Windows makes it a pain to handle
6459 with a text editor. Windows makes it a pain to handle
6458 extension-less files.
6460 extension-less files.
6459
6461
6460 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6462 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6461 warning about readline only occur for Posix. In Windows there's no
6463 warning about readline only occur for Posix. In Windows there's no
6462 way to get readline, so why bother with the warning.
6464 way to get readline, so why bother with the warning.
6463
6465
6464 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6466 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6465 for __str__ instead of dir(self), since dir() changed in 2.2.
6467 for __str__ instead of dir(self), since dir() changed in 2.2.
6466
6468
6467 * Ported to Windows! Tested on XP, I suspect it should work fine
6469 * Ported to Windows! Tested on XP, I suspect it should work fine
6468 on NT/2000, but I don't think it will work on 98 et al. That
6470 on NT/2000, but I don't think it will work on 98 et al. That
6469 series of Windows is such a piece of junk anyway that I won't try
6471 series of Windows is such a piece of junk anyway that I won't try
6470 porting it there. The XP port was straightforward, showed a few
6472 porting it there. The XP port was straightforward, showed a few
6471 bugs here and there (fixed all), in particular some string
6473 bugs here and there (fixed all), in particular some string
6472 handling stuff which required considering Unicode strings (which
6474 handling stuff which required considering Unicode strings (which
6473 Windows uses). This is good, but hasn't been too tested :) No
6475 Windows uses). This is good, but hasn't been too tested :) No
6474 fancy installer yet, I'll put a note in the manual so people at
6476 fancy installer yet, I'll put a note in the manual so people at
6475 least make manually a shortcut.
6477 least make manually a shortcut.
6476
6478
6477 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6479 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6478 into a single one, "colors". This now controls both prompt and
6480 into a single one, "colors". This now controls both prompt and
6479 exception color schemes, and can be changed both at startup
6481 exception color schemes, and can be changed both at startup
6480 (either via command-line switches or via ipythonrc files) and at
6482 (either via command-line switches or via ipythonrc files) and at
6481 runtime, with @colors.
6483 runtime, with @colors.
6482 (Magic.magic_run): renamed @prun to @run and removed the old
6484 (Magic.magic_run): renamed @prun to @run and removed the old
6483 @run. The two were too similar to warrant keeping both.
6485 @run. The two were too similar to warrant keeping both.
6484
6486
6485 2002-02-03 Fernando Perez <fperez@colorado.edu>
6487 2002-02-03 Fernando Perez <fperez@colorado.edu>
6486
6488
6487 * IPython/iplib.py (install_first_time): Added comment on how to
6489 * IPython/iplib.py (install_first_time): Added comment on how to
6488 configure the color options for first-time users. Put a <return>
6490 configure the color options for first-time users. Put a <return>
6489 request at the end so that small-terminal users get a chance to
6491 request at the end so that small-terminal users get a chance to
6490 read the startup info.
6492 read the startup info.
6491
6493
6492 2002-01-23 Fernando Perez <fperez@colorado.edu>
6494 2002-01-23 Fernando Perez <fperez@colorado.edu>
6493
6495
6494 * IPython/iplib.py (CachedOutput.update): Changed output memory
6496 * IPython/iplib.py (CachedOutput.update): Changed output memory
6495 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6497 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6496 input history we still use _i. Did this b/c these variable are
6498 input history we still use _i. Did this b/c these variable are
6497 very commonly used in interactive work, so the less we need to
6499 very commonly used in interactive work, so the less we need to
6498 type the better off we are.
6500 type the better off we are.
6499 (Magic.magic_prun): updated @prun to better handle the namespaces
6501 (Magic.magic_prun): updated @prun to better handle the namespaces
6500 the file will run in, including a fix for __name__ not being set
6502 the file will run in, including a fix for __name__ not being set
6501 before.
6503 before.
6502
6504
6503 2002-01-20 Fernando Perez <fperez@colorado.edu>
6505 2002-01-20 Fernando Perez <fperez@colorado.edu>
6504
6506
6505 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6507 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6506 extra garbage for Python 2.2. Need to look more carefully into
6508 extra garbage for Python 2.2. Need to look more carefully into
6507 this later.
6509 this later.
6508
6510
6509 2002-01-19 Fernando Perez <fperez@colorado.edu>
6511 2002-01-19 Fernando Perez <fperez@colorado.edu>
6510
6512
6511 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6513 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6512 display SyntaxError exceptions properly formatted when they occur
6514 display SyntaxError exceptions properly formatted when they occur
6513 (they can be triggered by imported code).
6515 (they can be triggered by imported code).
6514
6516
6515 2002-01-18 Fernando Perez <fperez@colorado.edu>
6517 2002-01-18 Fernando Perez <fperez@colorado.edu>
6516
6518
6517 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6519 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6518 SyntaxError exceptions are reported nicely formatted, instead of
6520 SyntaxError exceptions are reported nicely formatted, instead of
6519 spitting out only offset information as before.
6521 spitting out only offset information as before.
6520 (Magic.magic_prun): Added the @prun function for executing
6522 (Magic.magic_prun): Added the @prun function for executing
6521 programs with command line args inside IPython.
6523 programs with command line args inside IPython.
6522
6524
6523 2002-01-16 Fernando Perez <fperez@colorado.edu>
6525 2002-01-16 Fernando Perez <fperez@colorado.edu>
6524
6526
6525 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6527 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6526 to *not* include the last item given in a range. This brings their
6528 to *not* include the last item given in a range. This brings their
6527 behavior in line with Python's slicing:
6529 behavior in line with Python's slicing:
6528 a[n1:n2] -> a[n1]...a[n2-1]
6530 a[n1:n2] -> a[n1]...a[n2-1]
6529 It may be a bit less convenient, but I prefer to stick to Python's
6531 It may be a bit less convenient, but I prefer to stick to Python's
6530 conventions *everywhere*, so users never have to wonder.
6532 conventions *everywhere*, so users never have to wonder.
6531 (Magic.magic_macro): Added @macro function to ease the creation of
6533 (Magic.magic_macro): Added @macro function to ease the creation of
6532 macros.
6534 macros.
6533
6535
6534 2002-01-05 Fernando Perez <fperez@colorado.edu>
6536 2002-01-05 Fernando Perez <fperez@colorado.edu>
6535
6537
6536 * Released 0.2.4.
6538 * Released 0.2.4.
6537
6539
6538 * IPython/iplib.py (Magic.magic_pdef):
6540 * IPython/iplib.py (Magic.magic_pdef):
6539 (InteractiveShell.safe_execfile): report magic lines and error
6541 (InteractiveShell.safe_execfile): report magic lines and error
6540 lines without line numbers so one can easily copy/paste them for
6542 lines without line numbers so one can easily copy/paste them for
6541 re-execution.
6543 re-execution.
6542
6544
6543 * Updated manual with recent changes.
6545 * Updated manual with recent changes.
6544
6546
6545 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6547 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6546 docstring printing when class? is called. Very handy for knowing
6548 docstring printing when class? is called. Very handy for knowing
6547 how to create class instances (as long as __init__ is well
6549 how to create class instances (as long as __init__ is well
6548 documented, of course :)
6550 documented, of course :)
6549 (Magic.magic_doc): print both class and constructor docstrings.
6551 (Magic.magic_doc): print both class and constructor docstrings.
6550 (Magic.magic_pdef): give constructor info if passed a class and
6552 (Magic.magic_pdef): give constructor info if passed a class and
6551 __call__ info for callable object instances.
6553 __call__ info for callable object instances.
6552
6554
6553 2002-01-04 Fernando Perez <fperez@colorado.edu>
6555 2002-01-04 Fernando Perez <fperez@colorado.edu>
6554
6556
6555 * Made deep_reload() off by default. It doesn't always work
6557 * Made deep_reload() off by default. It doesn't always work
6556 exactly as intended, so it's probably safer to have it off. It's
6558 exactly as intended, so it's probably safer to have it off. It's
6557 still available as dreload() anyway, so nothing is lost.
6559 still available as dreload() anyway, so nothing is lost.
6558
6560
6559 2002-01-02 Fernando Perez <fperez@colorado.edu>
6561 2002-01-02 Fernando Perez <fperez@colorado.edu>
6560
6562
6561 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6563 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6562 so I wanted an updated release).
6564 so I wanted an updated release).
6563
6565
6564 2001-12-27 Fernando Perez <fperez@colorado.edu>
6566 2001-12-27 Fernando Perez <fperez@colorado.edu>
6565
6567
6566 * IPython/iplib.py (InteractiveShell.interact): Added the original
6568 * IPython/iplib.py (InteractiveShell.interact): Added the original
6567 code from 'code.py' for this module in order to change the
6569 code from 'code.py' for this module in order to change the
6568 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6570 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6569 the history cache would break when the user hit Ctrl-C, and
6571 the history cache would break when the user hit Ctrl-C, and
6570 interact() offers no way to add any hooks to it.
6572 interact() offers no way to add any hooks to it.
6571
6573
6572 2001-12-23 Fernando Perez <fperez@colorado.edu>
6574 2001-12-23 Fernando Perez <fperez@colorado.edu>
6573
6575
6574 * setup.py: added check for 'MANIFEST' before trying to remove
6576 * setup.py: added check for 'MANIFEST' before trying to remove
6575 it. Thanks to Sean Reifschneider.
6577 it. Thanks to Sean Reifschneider.
6576
6578
6577 2001-12-22 Fernando Perez <fperez@colorado.edu>
6579 2001-12-22 Fernando Perez <fperez@colorado.edu>
6578
6580
6579 * Released 0.2.2.
6581 * Released 0.2.2.
6580
6582
6581 * Finished (reasonably) writing the manual. Later will add the
6583 * Finished (reasonably) writing the manual. Later will add the
6582 python-standard navigation stylesheets, but for the time being
6584 python-standard navigation stylesheets, but for the time being
6583 it's fairly complete. Distribution will include html and pdf
6585 it's fairly complete. Distribution will include html and pdf
6584 versions.
6586 versions.
6585
6587
6586 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6588 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6587 (MayaVi author).
6589 (MayaVi author).
6588
6590
6589 2001-12-21 Fernando Perez <fperez@colorado.edu>
6591 2001-12-21 Fernando Perez <fperez@colorado.edu>
6590
6592
6591 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6593 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6592 good public release, I think (with the manual and the distutils
6594 good public release, I think (with the manual and the distutils
6593 installer). The manual can use some work, but that can go
6595 installer). The manual can use some work, but that can go
6594 slowly. Otherwise I think it's quite nice for end users. Next
6596 slowly. Otherwise I think it's quite nice for end users. Next
6595 summer, rewrite the guts of it...
6597 summer, rewrite the guts of it...
6596
6598
6597 * Changed format of ipythonrc files to use whitespace as the
6599 * Changed format of ipythonrc files to use whitespace as the
6598 separator instead of an explicit '='. Cleaner.
6600 separator instead of an explicit '='. Cleaner.
6599
6601
6600 2001-12-20 Fernando Perez <fperez@colorado.edu>
6602 2001-12-20 Fernando Perez <fperez@colorado.edu>
6601
6603
6602 * Started a manual in LyX. For now it's just a quick merge of the
6604 * Started a manual in LyX. For now it's just a quick merge of the
6603 various internal docstrings and READMEs. Later it may grow into a
6605 various internal docstrings and READMEs. Later it may grow into a
6604 nice, full-blown manual.
6606 nice, full-blown manual.
6605
6607
6606 * Set up a distutils based installer. Installation should now be
6608 * Set up a distutils based installer. Installation should now be
6607 trivially simple for end-users.
6609 trivially simple for end-users.
6608
6610
6609 2001-12-11 Fernando Perez <fperez@colorado.edu>
6611 2001-12-11 Fernando Perez <fperez@colorado.edu>
6610
6612
6611 * Released 0.2.0. First public release, announced it at
6613 * Released 0.2.0. First public release, announced it at
6612 comp.lang.python. From now on, just bugfixes...
6614 comp.lang.python. From now on, just bugfixes...
6613
6615
6614 * Went through all the files, set copyright/license notices and
6616 * Went through all the files, set copyright/license notices and
6615 cleaned up things. Ready for release.
6617 cleaned up things. Ready for release.
6616
6618
6617 2001-12-10 Fernando Perez <fperez@colorado.edu>
6619 2001-12-10 Fernando Perez <fperez@colorado.edu>
6618
6620
6619 * Changed the first-time installer not to use tarfiles. It's more
6621 * Changed the first-time installer not to use tarfiles. It's more
6620 robust now and less unix-dependent. Also makes it easier for
6622 robust now and less unix-dependent. Also makes it easier for
6621 people to later upgrade versions.
6623 people to later upgrade versions.
6622
6624
6623 * Changed @exit to @abort to reflect the fact that it's pretty
6625 * Changed @exit to @abort to reflect the fact that it's pretty
6624 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6626 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6625 becomes significant only when IPyhton is embedded: in that case,
6627 becomes significant only when IPyhton is embedded: in that case,
6626 C-D closes IPython only, but @abort kills the enclosing program
6628 C-D closes IPython only, but @abort kills the enclosing program
6627 too (unless it had called IPython inside a try catching
6629 too (unless it had called IPython inside a try catching
6628 SystemExit).
6630 SystemExit).
6629
6631
6630 * Created Shell module which exposes the actuall IPython Shell
6632 * Created Shell module which exposes the actuall IPython Shell
6631 classes, currently the normal and the embeddable one. This at
6633 classes, currently the normal and the embeddable one. This at
6632 least offers a stable interface we won't need to change when
6634 least offers a stable interface we won't need to change when
6633 (later) the internals are rewritten. That rewrite will be confined
6635 (later) the internals are rewritten. That rewrite will be confined
6634 to iplib and ipmaker, but the Shell interface should remain as is.
6636 to iplib and ipmaker, but the Shell interface should remain as is.
6635
6637
6636 * Added embed module which offers an embeddable IPShell object,
6638 * Added embed module which offers an embeddable IPShell object,
6637 useful to fire up IPython *inside* a running program. Great for
6639 useful to fire up IPython *inside* a running program. Great for
6638 debugging or dynamical data analysis.
6640 debugging or dynamical data analysis.
6639
6641
6640 2001-12-08 Fernando Perez <fperez@colorado.edu>
6642 2001-12-08 Fernando Perez <fperez@colorado.edu>
6641
6643
6642 * Fixed small bug preventing seeing info from methods of defined
6644 * Fixed small bug preventing seeing info from methods of defined
6643 objects (incorrect namespace in _ofind()).
6645 objects (incorrect namespace in _ofind()).
6644
6646
6645 * Documentation cleanup. Moved the main usage docstrings to a
6647 * Documentation cleanup. Moved the main usage docstrings to a
6646 separate file, usage.py (cleaner to maintain, and hopefully in the
6648 separate file, usage.py (cleaner to maintain, and hopefully in the
6647 future some perlpod-like way of producing interactive, man and
6649 future some perlpod-like way of producing interactive, man and
6648 html docs out of it will be found).
6650 html docs out of it will be found).
6649
6651
6650 * Added @profile to see your profile at any time.
6652 * Added @profile to see your profile at any time.
6651
6653
6652 * Added @p as an alias for 'print'. It's especially convenient if
6654 * Added @p as an alias for 'print'. It's especially convenient if
6653 using automagic ('p x' prints x).
6655 using automagic ('p x' prints x).
6654
6656
6655 * Small cleanups and fixes after a pychecker run.
6657 * Small cleanups and fixes after a pychecker run.
6656
6658
6657 * Changed the @cd command to handle @cd - and @cd -<n> for
6659 * Changed the @cd command to handle @cd - and @cd -<n> for
6658 visiting any directory in _dh.
6660 visiting any directory in _dh.
6659
6661
6660 * Introduced _dh, a history of visited directories. @dhist prints
6662 * Introduced _dh, a history of visited directories. @dhist prints
6661 it out with numbers.
6663 it out with numbers.
6662
6664
6663 2001-12-07 Fernando Perez <fperez@colorado.edu>
6665 2001-12-07 Fernando Perez <fperez@colorado.edu>
6664
6666
6665 * Released 0.1.22
6667 * Released 0.1.22
6666
6668
6667 * Made initialization a bit more robust against invalid color
6669 * Made initialization a bit more robust against invalid color
6668 options in user input (exit, not traceback-crash).
6670 options in user input (exit, not traceback-crash).
6669
6671
6670 * Changed the bug crash reporter to write the report only in the
6672 * Changed the bug crash reporter to write the report only in the
6671 user's .ipython directory. That way IPython won't litter people's
6673 user's .ipython directory. That way IPython won't litter people's
6672 hard disks with crash files all over the place. Also print on
6674 hard disks with crash files all over the place. Also print on
6673 screen the necessary mail command.
6675 screen the necessary mail command.
6674
6676
6675 * With the new ultraTB, implemented LightBG color scheme for light
6677 * With the new ultraTB, implemented LightBG color scheme for light
6676 background terminals. A lot of people like white backgrounds, so I
6678 background terminals. A lot of people like white backgrounds, so I
6677 guess we should at least give them something readable.
6679 guess we should at least give them something readable.
6678
6680
6679 2001-12-06 Fernando Perez <fperez@colorado.edu>
6681 2001-12-06 Fernando Perez <fperez@colorado.edu>
6680
6682
6681 * Modified the structure of ultraTB. Now there's a proper class
6683 * Modified the structure of ultraTB. Now there's a proper class
6682 for tables of color schemes which allow adding schemes easily and
6684 for tables of color schemes which allow adding schemes easily and
6683 switching the active scheme without creating a new instance every
6685 switching the active scheme without creating a new instance every
6684 time (which was ridiculous). The syntax for creating new schemes
6686 time (which was ridiculous). The syntax for creating new schemes
6685 is also cleaner. I think ultraTB is finally done, with a clean
6687 is also cleaner. I think ultraTB is finally done, with a clean
6686 class structure. Names are also much cleaner (now there's proper
6688 class structure. Names are also much cleaner (now there's proper
6687 color tables, no need for every variable to also have 'color' in
6689 color tables, no need for every variable to also have 'color' in
6688 its name).
6690 its name).
6689
6691
6690 * Broke down genutils into separate files. Now genutils only
6692 * Broke down genutils into separate files. Now genutils only
6691 contains utility functions, and classes have been moved to their
6693 contains utility functions, and classes have been moved to their
6692 own files (they had enough independent functionality to warrant
6694 own files (they had enough independent functionality to warrant
6693 it): ConfigLoader, OutputTrap, Struct.
6695 it): ConfigLoader, OutputTrap, Struct.
6694
6696
6695 2001-12-05 Fernando Perez <fperez@colorado.edu>
6697 2001-12-05 Fernando Perez <fperez@colorado.edu>
6696
6698
6697 * IPython turns 21! Released version 0.1.21, as a candidate for
6699 * IPython turns 21! Released version 0.1.21, as a candidate for
6698 public consumption. If all goes well, release in a few days.
6700 public consumption. If all goes well, release in a few days.
6699
6701
6700 * Fixed path bug (files in Extensions/ directory wouldn't be found
6702 * Fixed path bug (files in Extensions/ directory wouldn't be found
6701 unless IPython/ was explicitly in sys.path).
6703 unless IPython/ was explicitly in sys.path).
6702
6704
6703 * Extended the FlexCompleter class as MagicCompleter to allow
6705 * Extended the FlexCompleter class as MagicCompleter to allow
6704 completion of @-starting lines.
6706 completion of @-starting lines.
6705
6707
6706 * Created __release__.py file as a central repository for release
6708 * Created __release__.py file as a central repository for release
6707 info that other files can read from.
6709 info that other files can read from.
6708
6710
6709 * Fixed small bug in logging: when logging was turned on in
6711 * Fixed small bug in logging: when logging was turned on in
6710 mid-session, old lines with special meanings (!@?) were being
6712 mid-session, old lines with special meanings (!@?) were being
6711 logged without the prepended comment, which is necessary since
6713 logged without the prepended comment, which is necessary since
6712 they are not truly valid python syntax. This should make session
6714 they are not truly valid python syntax. This should make session
6713 restores produce less errors.
6715 restores produce less errors.
6714
6716
6715 * The namespace cleanup forced me to make a FlexCompleter class
6717 * The namespace cleanup forced me to make a FlexCompleter class
6716 which is nothing but a ripoff of rlcompleter, but with selectable
6718 which is nothing but a ripoff of rlcompleter, but with selectable
6717 namespace (rlcompleter only works in __main__.__dict__). I'll try
6719 namespace (rlcompleter only works in __main__.__dict__). I'll try
6718 to submit a note to the authors to see if this change can be
6720 to submit a note to the authors to see if this change can be
6719 incorporated in future rlcompleter releases (Dec.6: done)
6721 incorporated in future rlcompleter releases (Dec.6: done)
6720
6722
6721 * More fixes to namespace handling. It was a mess! Now all
6723 * More fixes to namespace handling. It was a mess! Now all
6722 explicit references to __main__.__dict__ are gone (except when
6724 explicit references to __main__.__dict__ are gone (except when
6723 really needed) and everything is handled through the namespace
6725 really needed) and everything is handled through the namespace
6724 dicts in the IPython instance. We seem to be getting somewhere
6726 dicts in the IPython instance. We seem to be getting somewhere
6725 with this, finally...
6727 with this, finally...
6726
6728
6727 * Small documentation updates.
6729 * Small documentation updates.
6728
6730
6729 * Created the Extensions directory under IPython (with an
6731 * Created the Extensions directory under IPython (with an
6730 __init__.py). Put the PhysicalQ stuff there. This directory should
6732 __init__.py). Put the PhysicalQ stuff there. This directory should
6731 be used for all special-purpose extensions.
6733 be used for all special-purpose extensions.
6732
6734
6733 * File renaming:
6735 * File renaming:
6734 ipythonlib --> ipmaker
6736 ipythonlib --> ipmaker
6735 ipplib --> iplib
6737 ipplib --> iplib
6736 This makes a bit more sense in terms of what these files actually do.
6738 This makes a bit more sense in terms of what these files actually do.
6737
6739
6738 * Moved all the classes and functions in ipythonlib to ipplib, so
6740 * Moved all the classes and functions in ipythonlib to ipplib, so
6739 now ipythonlib only has make_IPython(). This will ease up its
6741 now ipythonlib only has make_IPython(). This will ease up its
6740 splitting in smaller functional chunks later.
6742 splitting in smaller functional chunks later.
6741
6743
6742 * Cleaned up (done, I think) output of @whos. Better column
6744 * Cleaned up (done, I think) output of @whos. Better column
6743 formatting, and now shows str(var) for as much as it can, which is
6745 formatting, and now shows str(var) for as much as it can, which is
6744 typically what one gets with a 'print var'.
6746 typically what one gets with a 'print var'.
6745
6747
6746 2001-12-04 Fernando Perez <fperez@colorado.edu>
6748 2001-12-04 Fernando Perez <fperez@colorado.edu>
6747
6749
6748 * Fixed namespace problems. Now builtin/IPyhton/user names get
6750 * Fixed namespace problems. Now builtin/IPyhton/user names get
6749 properly reported in their namespace. Internal namespace handling
6751 properly reported in their namespace. Internal namespace handling
6750 is finally getting decent (not perfect yet, but much better than
6752 is finally getting decent (not perfect yet, but much better than
6751 the ad-hoc mess we had).
6753 the ad-hoc mess we had).
6752
6754
6753 * Removed -exit option. If people just want to run a python
6755 * Removed -exit option. If people just want to run a python
6754 script, that's what the normal interpreter is for. Less
6756 script, that's what the normal interpreter is for. Less
6755 unnecessary options, less chances for bugs.
6757 unnecessary options, less chances for bugs.
6756
6758
6757 * Added a crash handler which generates a complete post-mortem if
6759 * Added a crash handler which generates a complete post-mortem if
6758 IPython crashes. This will help a lot in tracking bugs down the
6760 IPython crashes. This will help a lot in tracking bugs down the
6759 road.
6761 road.
6760
6762
6761 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6763 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6762 which were boud to functions being reassigned would bypass the
6764 which were boud to functions being reassigned would bypass the
6763 logger, breaking the sync of _il with the prompt counter. This
6765 logger, breaking the sync of _il with the prompt counter. This
6764 would then crash IPython later when a new line was logged.
6766 would then crash IPython later when a new line was logged.
6765
6767
6766 2001-12-02 Fernando Perez <fperez@colorado.edu>
6768 2001-12-02 Fernando Perez <fperez@colorado.edu>
6767
6769
6768 * Made IPython a package. This means people don't have to clutter
6770 * Made IPython a package. This means people don't have to clutter
6769 their sys.path with yet another directory. Changed the INSTALL
6771 their sys.path with yet another directory. Changed the INSTALL
6770 file accordingly.
6772 file accordingly.
6771
6773
6772 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6774 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6773 sorts its output (so @who shows it sorted) and @whos formats the
6775 sorts its output (so @who shows it sorted) and @whos formats the
6774 table according to the width of the first column. Nicer, easier to
6776 table according to the width of the first column. Nicer, easier to
6775 read. Todo: write a generic table_format() which takes a list of
6777 read. Todo: write a generic table_format() which takes a list of
6776 lists and prints it nicely formatted, with optional row/column
6778 lists and prints it nicely formatted, with optional row/column
6777 separators and proper padding and justification.
6779 separators and proper padding and justification.
6778
6780
6779 * Released 0.1.20
6781 * Released 0.1.20
6780
6782
6781 * Fixed bug in @log which would reverse the inputcache list (a
6783 * Fixed bug in @log which would reverse the inputcache list (a
6782 copy operation was missing).
6784 copy operation was missing).
6783
6785
6784 * Code cleanup. @config was changed to use page(). Better, since
6786 * Code cleanup. @config was changed to use page(). Better, since
6785 its output is always quite long.
6787 its output is always quite long.
6786
6788
6787 * Itpl is back as a dependency. I was having too many problems
6789 * Itpl is back as a dependency. I was having too many problems
6788 getting the parametric aliases to work reliably, and it's just
6790 getting the parametric aliases to work reliably, and it's just
6789 easier to code weird string operations with it than playing %()s
6791 easier to code weird string operations with it than playing %()s
6790 games. It's only ~6k, so I don't think it's too big a deal.
6792 games. It's only ~6k, so I don't think it's too big a deal.
6791
6793
6792 * Found (and fixed) a very nasty bug with history. !lines weren't
6794 * Found (and fixed) a very nasty bug with history. !lines weren't
6793 getting cached, and the out of sync caches would crash
6795 getting cached, and the out of sync caches would crash
6794 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6796 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6795 division of labor a bit better. Bug fixed, cleaner structure.
6797 division of labor a bit better. Bug fixed, cleaner structure.
6796
6798
6797 2001-12-01 Fernando Perez <fperez@colorado.edu>
6799 2001-12-01 Fernando Perez <fperez@colorado.edu>
6798
6800
6799 * Released 0.1.19
6801 * Released 0.1.19
6800
6802
6801 * Added option -n to @hist to prevent line number printing. Much
6803 * Added option -n to @hist to prevent line number printing. Much
6802 easier to copy/paste code this way.
6804 easier to copy/paste code this way.
6803
6805
6804 * Created global _il to hold the input list. Allows easy
6806 * Created global _il to hold the input list. Allows easy
6805 re-execution of blocks of code by slicing it (inspired by Janko's
6807 re-execution of blocks of code by slicing it (inspired by Janko's
6806 comment on 'macros').
6808 comment on 'macros').
6807
6809
6808 * Small fixes and doc updates.
6810 * Small fixes and doc updates.
6809
6811
6810 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6812 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6811 much too fragile with automagic. Handles properly multi-line
6813 much too fragile with automagic. Handles properly multi-line
6812 statements and takes parameters.
6814 statements and takes parameters.
6813
6815
6814 2001-11-30 Fernando Perez <fperez@colorado.edu>
6816 2001-11-30 Fernando Perez <fperez@colorado.edu>
6815
6817
6816 * Version 0.1.18 released.
6818 * Version 0.1.18 released.
6817
6819
6818 * Fixed nasty namespace bug in initial module imports.
6820 * Fixed nasty namespace bug in initial module imports.
6819
6821
6820 * Added copyright/license notes to all code files (except
6822 * Added copyright/license notes to all code files (except
6821 DPyGetOpt). For the time being, LGPL. That could change.
6823 DPyGetOpt). For the time being, LGPL. That could change.
6822
6824
6823 * Rewrote a much nicer README, updated INSTALL, cleaned up
6825 * Rewrote a much nicer README, updated INSTALL, cleaned up
6824 ipythonrc-* samples.
6826 ipythonrc-* samples.
6825
6827
6826 * Overall code/documentation cleanup. Basically ready for
6828 * Overall code/documentation cleanup. Basically ready for
6827 release. Only remaining thing: licence decision (LGPL?).
6829 release. Only remaining thing: licence decision (LGPL?).
6828
6830
6829 * Converted load_config to a class, ConfigLoader. Now recursion
6831 * Converted load_config to a class, ConfigLoader. Now recursion
6830 control is better organized. Doesn't include the same file twice.
6832 control is better organized. Doesn't include the same file twice.
6831
6833
6832 2001-11-29 Fernando Perez <fperez@colorado.edu>
6834 2001-11-29 Fernando Perez <fperez@colorado.edu>
6833
6835
6834 * Got input history working. Changed output history variables from
6836 * Got input history working. Changed output history variables from
6835 _p to _o so that _i is for input and _o for output. Just cleaner
6837 _p to _o so that _i is for input and _o for output. Just cleaner
6836 convention.
6838 convention.
6837
6839
6838 * Implemented parametric aliases. This pretty much allows the
6840 * Implemented parametric aliases. This pretty much allows the
6839 alias system to offer full-blown shell convenience, I think.
6841 alias system to offer full-blown shell convenience, I think.
6840
6842
6841 * Version 0.1.17 released, 0.1.18 opened.
6843 * Version 0.1.17 released, 0.1.18 opened.
6842
6844
6843 * dot_ipython/ipythonrc (alias): added documentation.
6845 * dot_ipython/ipythonrc (alias): added documentation.
6844 (xcolor): Fixed small bug (xcolors -> xcolor)
6846 (xcolor): Fixed small bug (xcolors -> xcolor)
6845
6847
6846 * Changed the alias system. Now alias is a magic command to define
6848 * Changed the alias system. Now alias is a magic command to define
6847 aliases just like the shell. Rationale: the builtin magics should
6849 aliases just like the shell. Rationale: the builtin magics should
6848 be there for things deeply connected to IPython's
6850 be there for things deeply connected to IPython's
6849 architecture. And this is a much lighter system for what I think
6851 architecture. And this is a much lighter system for what I think
6850 is the really important feature: allowing users to define quickly
6852 is the really important feature: allowing users to define quickly
6851 magics that will do shell things for them, so they can customize
6853 magics that will do shell things for them, so they can customize
6852 IPython easily to match their work habits. If someone is really
6854 IPython easily to match their work habits. If someone is really
6853 desperate to have another name for a builtin alias, they can
6855 desperate to have another name for a builtin alias, they can
6854 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6856 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6855 works.
6857 works.
6856
6858
6857 2001-11-28 Fernando Perez <fperez@colorado.edu>
6859 2001-11-28 Fernando Perez <fperez@colorado.edu>
6858
6860
6859 * Changed @file so that it opens the source file at the proper
6861 * Changed @file so that it opens the source file at the proper
6860 line. Since it uses less, if your EDITOR environment is
6862 line. Since it uses less, if your EDITOR environment is
6861 configured, typing v will immediately open your editor of choice
6863 configured, typing v will immediately open your editor of choice
6862 right at the line where the object is defined. Not as quick as
6864 right at the line where the object is defined. Not as quick as
6863 having a direct @edit command, but for all intents and purposes it
6865 having a direct @edit command, but for all intents and purposes it
6864 works. And I don't have to worry about writing @edit to deal with
6866 works. And I don't have to worry about writing @edit to deal with
6865 all the editors, less does that.
6867 all the editors, less does that.
6866
6868
6867 * Version 0.1.16 released, 0.1.17 opened.
6869 * Version 0.1.16 released, 0.1.17 opened.
6868
6870
6869 * Fixed some nasty bugs in the page/page_dumb combo that could
6871 * Fixed some nasty bugs in the page/page_dumb combo that could
6870 crash IPython.
6872 crash IPython.
6871
6873
6872 2001-11-27 Fernando Perez <fperez@colorado.edu>
6874 2001-11-27 Fernando Perez <fperez@colorado.edu>
6873
6875
6874 * Version 0.1.15 released, 0.1.16 opened.
6876 * Version 0.1.15 released, 0.1.16 opened.
6875
6877
6876 * Finally got ? and ?? to work for undefined things: now it's
6878 * Finally got ? and ?? to work for undefined things: now it's
6877 possible to type {}.get? and get information about the get method
6879 possible to type {}.get? and get information about the get method
6878 of dicts, or os.path? even if only os is defined (so technically
6880 of dicts, or os.path? even if only os is defined (so technically
6879 os.path isn't). Works at any level. For example, after import os,
6881 os.path isn't). Works at any level. For example, after import os,
6880 os?, os.path?, os.path.abspath? all work. This is great, took some
6882 os?, os.path?, os.path.abspath? all work. This is great, took some
6881 work in _ofind.
6883 work in _ofind.
6882
6884
6883 * Fixed more bugs with logging. The sanest way to do it was to add
6885 * Fixed more bugs with logging. The sanest way to do it was to add
6884 to @log a 'mode' parameter. Killed two in one shot (this mode
6886 to @log a 'mode' parameter. Killed two in one shot (this mode
6885 option was a request of Janko's). I think it's finally clean
6887 option was a request of Janko's). I think it's finally clean
6886 (famous last words).
6888 (famous last words).
6887
6889
6888 * Added a page_dumb() pager which does a decent job of paging on
6890 * Added a page_dumb() pager which does a decent job of paging on
6889 screen, if better things (like less) aren't available. One less
6891 screen, if better things (like less) aren't available. One less
6890 unix dependency (someday maybe somebody will port this to
6892 unix dependency (someday maybe somebody will port this to
6891 windows).
6893 windows).
6892
6894
6893 * Fixed problem in magic_log: would lock of logging out if log
6895 * Fixed problem in magic_log: would lock of logging out if log
6894 creation failed (because it would still think it had succeeded).
6896 creation failed (because it would still think it had succeeded).
6895
6897
6896 * Improved the page() function using curses to auto-detect screen
6898 * Improved the page() function using curses to auto-detect screen
6897 size. Now it can make a much better decision on whether to print
6899 size. Now it can make a much better decision on whether to print
6898 or page a string. Option screen_length was modified: a value 0
6900 or page a string. Option screen_length was modified: a value 0
6899 means auto-detect, and that's the default now.
6901 means auto-detect, and that's the default now.
6900
6902
6901 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6903 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6902 go out. I'll test it for a few days, then talk to Janko about
6904 go out. I'll test it for a few days, then talk to Janko about
6903 licences and announce it.
6905 licences and announce it.
6904
6906
6905 * Fixed the length of the auto-generated ---> prompt which appears
6907 * Fixed the length of the auto-generated ---> prompt which appears
6906 for auto-parens and auto-quotes. Getting this right isn't trivial,
6908 for auto-parens and auto-quotes. Getting this right isn't trivial,
6907 with all the color escapes, different prompt types and optional
6909 with all the color escapes, different prompt types and optional
6908 separators. But it seems to be working in all the combinations.
6910 separators. But it seems to be working in all the combinations.
6909
6911
6910 2001-11-26 Fernando Perez <fperez@colorado.edu>
6912 2001-11-26 Fernando Perez <fperez@colorado.edu>
6911
6913
6912 * Wrote a regexp filter to get option types from the option names
6914 * Wrote a regexp filter to get option types from the option names
6913 string. This eliminates the need to manually keep two duplicate
6915 string. This eliminates the need to manually keep two duplicate
6914 lists.
6916 lists.
6915
6917
6916 * Removed the unneeded check_option_names. Now options are handled
6918 * Removed the unneeded check_option_names. Now options are handled
6917 in a much saner manner and it's easy to visually check that things
6919 in a much saner manner and it's easy to visually check that things
6918 are ok.
6920 are ok.
6919
6921
6920 * Updated version numbers on all files I modified to carry a
6922 * Updated version numbers on all files I modified to carry a
6921 notice so Janko and Nathan have clear version markers.
6923 notice so Janko and Nathan have clear version markers.
6922
6924
6923 * Updated docstring for ultraTB with my changes. I should send
6925 * Updated docstring for ultraTB with my changes. I should send
6924 this to Nathan.
6926 this to Nathan.
6925
6927
6926 * Lots of small fixes. Ran everything through pychecker again.
6928 * Lots of small fixes. Ran everything through pychecker again.
6927
6929
6928 * Made loading of deep_reload an cmd line option. If it's not too
6930 * Made loading of deep_reload an cmd line option. If it's not too
6929 kosher, now people can just disable it. With -nodeep_reload it's
6931 kosher, now people can just disable it. With -nodeep_reload it's
6930 still available as dreload(), it just won't overwrite reload().
6932 still available as dreload(), it just won't overwrite reload().
6931
6933
6932 * Moved many options to the no| form (-opt and -noopt
6934 * Moved many options to the no| form (-opt and -noopt
6933 accepted). Cleaner.
6935 accepted). Cleaner.
6934
6936
6935 * Changed magic_log so that if called with no parameters, it uses
6937 * Changed magic_log so that if called with no parameters, it uses
6936 'rotate' mode. That way auto-generated logs aren't automatically
6938 'rotate' mode. That way auto-generated logs aren't automatically
6937 over-written. For normal logs, now a backup is made if it exists
6939 over-written. For normal logs, now a backup is made if it exists
6938 (only 1 level of backups). A new 'backup' mode was added to the
6940 (only 1 level of backups). A new 'backup' mode was added to the
6939 Logger class to support this. This was a request by Janko.
6941 Logger class to support this. This was a request by Janko.
6940
6942
6941 * Added @logoff/@logon to stop/restart an active log.
6943 * Added @logoff/@logon to stop/restart an active log.
6942
6944
6943 * Fixed a lot of bugs in log saving/replay. It was pretty
6945 * Fixed a lot of bugs in log saving/replay. It was pretty
6944 broken. Now special lines (!@,/) appear properly in the command
6946 broken. Now special lines (!@,/) appear properly in the command
6945 history after a log replay.
6947 history after a log replay.
6946
6948
6947 * Tried and failed to implement full session saving via pickle. My
6949 * Tried and failed to implement full session saving via pickle. My
6948 idea was to pickle __main__.__dict__, but modules can't be
6950 idea was to pickle __main__.__dict__, but modules can't be
6949 pickled. This would be a better alternative to replaying logs, but
6951 pickled. This would be a better alternative to replaying logs, but
6950 seems quite tricky to get to work. Changed -session to be called
6952 seems quite tricky to get to work. Changed -session to be called
6951 -logplay, which more accurately reflects what it does. And if we
6953 -logplay, which more accurately reflects what it does. And if we
6952 ever get real session saving working, -session is now available.
6954 ever get real session saving working, -session is now available.
6953
6955
6954 * Implemented color schemes for prompts also. As for tracebacks,
6956 * Implemented color schemes for prompts also. As for tracebacks,
6955 currently only NoColor and Linux are supported. But now the
6957 currently only NoColor and Linux are supported. But now the
6956 infrastructure is in place, based on a generic ColorScheme
6958 infrastructure is in place, based on a generic ColorScheme
6957 class. So writing and activating new schemes both for the prompts
6959 class. So writing and activating new schemes both for the prompts
6958 and the tracebacks should be straightforward.
6960 and the tracebacks should be straightforward.
6959
6961
6960 * Version 0.1.13 released, 0.1.14 opened.
6962 * Version 0.1.13 released, 0.1.14 opened.
6961
6963
6962 * Changed handling of options for output cache. Now counter is
6964 * Changed handling of options for output cache. Now counter is
6963 hardwired starting at 1 and one specifies the maximum number of
6965 hardwired starting at 1 and one specifies the maximum number of
6964 entries *in the outcache* (not the max prompt counter). This is
6966 entries *in the outcache* (not the max prompt counter). This is
6965 much better, since many statements won't increase the cache
6967 much better, since many statements won't increase the cache
6966 count. It also eliminated some confusing options, now there's only
6968 count. It also eliminated some confusing options, now there's only
6967 one: cache_size.
6969 one: cache_size.
6968
6970
6969 * Added 'alias' magic function and magic_alias option in the
6971 * Added 'alias' magic function and magic_alias option in the
6970 ipythonrc file. Now the user can easily define whatever names he
6972 ipythonrc file. Now the user can easily define whatever names he
6971 wants for the magic functions without having to play weird
6973 wants for the magic functions without having to play weird
6972 namespace games. This gives IPython a real shell-like feel.
6974 namespace games. This gives IPython a real shell-like feel.
6973
6975
6974 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6976 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6975 @ or not).
6977 @ or not).
6976
6978
6977 This was one of the last remaining 'visible' bugs (that I know
6979 This was one of the last remaining 'visible' bugs (that I know
6978 of). I think if I can clean up the session loading so it works
6980 of). I think if I can clean up the session loading so it works
6979 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6981 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6980 about licensing).
6982 about licensing).
6981
6983
6982 2001-11-25 Fernando Perez <fperez@colorado.edu>
6984 2001-11-25 Fernando Perez <fperez@colorado.edu>
6983
6985
6984 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6986 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6985 there's a cleaner distinction between what ? and ?? show.
6987 there's a cleaner distinction between what ? and ?? show.
6986
6988
6987 * Added screen_length option. Now the user can define his own
6989 * Added screen_length option. Now the user can define his own
6988 screen size for page() operations.
6990 screen size for page() operations.
6989
6991
6990 * Implemented magic shell-like functions with automatic code
6992 * Implemented magic shell-like functions with automatic code
6991 generation. Now adding another function is just a matter of adding
6993 generation. Now adding another function is just a matter of adding
6992 an entry to a dict, and the function is dynamically generated at
6994 an entry to a dict, and the function is dynamically generated at
6993 run-time. Python has some really cool features!
6995 run-time. Python has some really cool features!
6994
6996
6995 * Renamed many options to cleanup conventions a little. Now all
6997 * Renamed many options to cleanup conventions a little. Now all
6996 are lowercase, and only underscores where needed. Also in the code
6998 are lowercase, and only underscores where needed. Also in the code
6997 option name tables are clearer.
6999 option name tables are clearer.
6998
7000
6999 * Changed prompts a little. Now input is 'In [n]:' instead of
7001 * Changed prompts a little. Now input is 'In [n]:' instead of
7000 'In[n]:='. This allows it the numbers to be aligned with the
7002 'In[n]:='. This allows it the numbers to be aligned with the
7001 Out[n] numbers, and removes usage of ':=' which doesn't exist in
7003 Out[n] numbers, and removes usage of ':=' which doesn't exist in
7002 Python (it was a Mathematica thing). The '...' continuation prompt
7004 Python (it was a Mathematica thing). The '...' continuation prompt
7003 was also changed a little to align better.
7005 was also changed a little to align better.
7004
7006
7005 * Fixed bug when flushing output cache. Not all _p<n> variables
7007 * Fixed bug when flushing output cache. Not all _p<n> variables
7006 exist, so their deletion needs to be wrapped in a try:
7008 exist, so their deletion needs to be wrapped in a try:
7007
7009
7008 * Figured out how to properly use inspect.formatargspec() (it
7010 * Figured out how to properly use inspect.formatargspec() (it
7009 requires the args preceded by *). So I removed all the code from
7011 requires the args preceded by *). So I removed all the code from
7010 _get_pdef in Magic, which was just replicating that.
7012 _get_pdef in Magic, which was just replicating that.
7011
7013
7012 * Added test to prefilter to allow redefining magic function names
7014 * Added test to prefilter to allow redefining magic function names
7013 as variables. This is ok, since the @ form is always available,
7015 as variables. This is ok, since the @ form is always available,
7014 but whe should allow the user to define a variable called 'ls' if
7016 but whe should allow the user to define a variable called 'ls' if
7015 he needs it.
7017 he needs it.
7016
7018
7017 * Moved the ToDo information from README into a separate ToDo.
7019 * Moved the ToDo information from README into a separate ToDo.
7018
7020
7019 * General code cleanup and small bugfixes. I think it's close to a
7021 * General code cleanup and small bugfixes. I think it's close to a
7020 state where it can be released, obviously with a big 'beta'
7022 state where it can be released, obviously with a big 'beta'
7021 warning on it.
7023 warning on it.
7022
7024
7023 * Got the magic function split to work. Now all magics are defined
7025 * Got the magic function split to work. Now all magics are defined
7024 in a separate class. It just organizes things a bit, and now
7026 in a separate class. It just organizes things a bit, and now
7025 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
7027 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
7026 was too long).
7028 was too long).
7027
7029
7028 * Changed @clear to @reset to avoid potential confusions with
7030 * Changed @clear to @reset to avoid potential confusions with
7029 the shell command clear. Also renamed @cl to @clear, which does
7031 the shell command clear. Also renamed @cl to @clear, which does
7030 exactly what people expect it to from their shell experience.
7032 exactly what people expect it to from their shell experience.
7031
7033
7032 Added a check to the @reset command (since it's so
7034 Added a check to the @reset command (since it's so
7033 destructive, it's probably a good idea to ask for confirmation).
7035 destructive, it's probably a good idea to ask for confirmation).
7034 But now reset only works for full namespace resetting. Since the
7036 But now reset only works for full namespace resetting. Since the
7035 del keyword is already there for deleting a few specific
7037 del keyword is already there for deleting a few specific
7036 variables, I don't see the point of having a redundant magic
7038 variables, I don't see the point of having a redundant magic
7037 function for the same task.
7039 function for the same task.
7038
7040
7039 2001-11-24 Fernando Perez <fperez@colorado.edu>
7041 2001-11-24 Fernando Perez <fperez@colorado.edu>
7040
7042
7041 * Updated the builtin docs (esp. the ? ones).
7043 * Updated the builtin docs (esp. the ? ones).
7042
7044
7043 * Ran all the code through pychecker. Not terribly impressed with
7045 * Ran all the code through pychecker. Not terribly impressed with
7044 it: lots of spurious warnings and didn't really find anything of
7046 it: lots of spurious warnings and didn't really find anything of
7045 substance (just a few modules being imported and not used).
7047 substance (just a few modules being imported and not used).
7046
7048
7047 * Implemented the new ultraTB functionality into IPython. New
7049 * Implemented the new ultraTB functionality into IPython. New
7048 option: xcolors. This chooses color scheme. xmode now only selects
7050 option: xcolors. This chooses color scheme. xmode now only selects
7049 between Plain and Verbose. Better orthogonality.
7051 between Plain and Verbose. Better orthogonality.
7050
7052
7051 * Large rewrite of ultraTB. Much cleaner now, with a separation of
7053 * Large rewrite of ultraTB. Much cleaner now, with a separation of
7052 mode and color scheme for the exception handlers. Now it's
7054 mode and color scheme for the exception handlers. Now it's
7053 possible to have the verbose traceback with no coloring.
7055 possible to have the verbose traceback with no coloring.
7054
7056
7055 2001-11-23 Fernando Perez <fperez@colorado.edu>
7057 2001-11-23 Fernando Perez <fperez@colorado.edu>
7056
7058
7057 * Version 0.1.12 released, 0.1.13 opened.
7059 * Version 0.1.12 released, 0.1.13 opened.
7058
7060
7059 * Removed option to set auto-quote and auto-paren escapes by
7061 * Removed option to set auto-quote and auto-paren escapes by
7060 user. The chances of breaking valid syntax are just too high. If
7062 user. The chances of breaking valid syntax are just too high. If
7061 someone *really* wants, they can always dig into the code.
7063 someone *really* wants, they can always dig into the code.
7062
7064
7063 * Made prompt separators configurable.
7065 * Made prompt separators configurable.
7064
7066
7065 2001-11-22 Fernando Perez <fperez@colorado.edu>
7067 2001-11-22 Fernando Perez <fperez@colorado.edu>
7066
7068
7067 * Small bugfixes in many places.
7069 * Small bugfixes in many places.
7068
7070
7069 * Removed the MyCompleter class from ipplib. It seemed redundant
7071 * Removed the MyCompleter class from ipplib. It seemed redundant
7070 with the C-p,C-n history search functionality. Less code to
7072 with the C-p,C-n history search functionality. Less code to
7071 maintain.
7073 maintain.
7072
7074
7073 * Moved all the original ipython.py code into ipythonlib.py. Right
7075 * Moved all the original ipython.py code into ipythonlib.py. Right
7074 now it's just one big dump into a function called make_IPython, so
7076 now it's just one big dump into a function called make_IPython, so
7075 no real modularity has been gained. But at least it makes the
7077 no real modularity has been gained. But at least it makes the
7076 wrapper script tiny, and since ipythonlib is a module, it gets
7078 wrapper script tiny, and since ipythonlib is a module, it gets
7077 compiled and startup is much faster.
7079 compiled and startup is much faster.
7078
7080
7079 This is a reasobably 'deep' change, so we should test it for a
7081 This is a reasobably 'deep' change, so we should test it for a
7080 while without messing too much more with the code.
7082 while without messing too much more with the code.
7081
7083
7082 2001-11-21 Fernando Perez <fperez@colorado.edu>
7084 2001-11-21 Fernando Perez <fperez@colorado.edu>
7083
7085
7084 * Version 0.1.11 released, 0.1.12 opened for further work.
7086 * Version 0.1.11 released, 0.1.12 opened for further work.
7085
7087
7086 * Removed dependency on Itpl. It was only needed in one place. It
7088 * Removed dependency on Itpl. It was only needed in one place. It
7087 would be nice if this became part of python, though. It makes life
7089 would be nice if this became part of python, though. It makes life
7088 *a lot* easier in some cases.
7090 *a lot* easier in some cases.
7089
7091
7090 * Simplified the prefilter code a bit. Now all handlers are
7092 * Simplified the prefilter code a bit. Now all handlers are
7091 expected to explicitly return a value (at least a blank string).
7093 expected to explicitly return a value (at least a blank string).
7092
7094
7093 * Heavy edits in ipplib. Removed the help system altogether. Now
7095 * Heavy edits in ipplib. Removed the help system altogether. Now
7094 obj?/?? is used for inspecting objects, a magic @doc prints
7096 obj?/?? is used for inspecting objects, a magic @doc prints
7095 docstrings, and full-blown Python help is accessed via the 'help'
7097 docstrings, and full-blown Python help is accessed via the 'help'
7096 keyword. This cleans up a lot of code (less to maintain) and does
7098 keyword. This cleans up a lot of code (less to maintain) and does
7097 the job. Since 'help' is now a standard Python component, might as
7099 the job. Since 'help' is now a standard Python component, might as
7098 well use it and remove duplicate functionality.
7100 well use it and remove duplicate functionality.
7099
7101
7100 Also removed the option to use ipplib as a standalone program. By
7102 Also removed the option to use ipplib as a standalone program. By
7101 now it's too dependent on other parts of IPython to function alone.
7103 now it's too dependent on other parts of IPython to function alone.
7102
7104
7103 * Fixed bug in genutils.pager. It would crash if the pager was
7105 * Fixed bug in genutils.pager. It would crash if the pager was
7104 exited immediately after opening (broken pipe).
7106 exited immediately after opening (broken pipe).
7105
7107
7106 * Trimmed down the VerboseTB reporting a little. The header is
7108 * Trimmed down the VerboseTB reporting a little. The header is
7107 much shorter now and the repeated exception arguments at the end
7109 much shorter now and the repeated exception arguments at the end
7108 have been removed. For interactive use the old header seemed a bit
7110 have been removed. For interactive use the old header seemed a bit
7109 excessive.
7111 excessive.
7110
7112
7111 * Fixed small bug in output of @whos for variables with multi-word
7113 * Fixed small bug in output of @whos for variables with multi-word
7112 types (only first word was displayed).
7114 types (only first word was displayed).
7113
7115
7114 2001-11-17 Fernando Perez <fperez@colorado.edu>
7116 2001-11-17 Fernando Perez <fperez@colorado.edu>
7115
7117
7116 * Version 0.1.10 released, 0.1.11 opened for further work.
7118 * Version 0.1.10 released, 0.1.11 opened for further work.
7117
7119
7118 * Modified dirs and friends. dirs now *returns* the stack (not
7120 * Modified dirs and friends. dirs now *returns* the stack (not
7119 prints), so one can manipulate it as a variable. Convenient to
7121 prints), so one can manipulate it as a variable. Convenient to
7120 travel along many directories.
7122 travel along many directories.
7121
7123
7122 * Fixed bug in magic_pdef: would only work with functions with
7124 * Fixed bug in magic_pdef: would only work with functions with
7123 arguments with default values.
7125 arguments with default values.
7124
7126
7125 2001-11-14 Fernando Perez <fperez@colorado.edu>
7127 2001-11-14 Fernando Perez <fperez@colorado.edu>
7126
7128
7127 * Added the PhysicsInput stuff to dot_ipython so it ships as an
7129 * Added the PhysicsInput stuff to dot_ipython so it ships as an
7128 example with IPython. Various other minor fixes and cleanups.
7130 example with IPython. Various other minor fixes and cleanups.
7129
7131
7130 * Version 0.1.9 released, 0.1.10 opened for further work.
7132 * Version 0.1.9 released, 0.1.10 opened for further work.
7131
7133
7132 * Added sys.path to the list of directories searched in the
7134 * Added sys.path to the list of directories searched in the
7133 execfile= option. It used to be the current directory and the
7135 execfile= option. It used to be the current directory and the
7134 user's IPYTHONDIR only.
7136 user's IPYTHONDIR only.
7135
7137
7136 2001-11-13 Fernando Perez <fperez@colorado.edu>
7138 2001-11-13 Fernando Perez <fperez@colorado.edu>
7137
7139
7138 * Reinstated the raw_input/prefilter separation that Janko had
7140 * Reinstated the raw_input/prefilter separation that Janko had
7139 initially. This gives a more convenient setup for extending the
7141 initially. This gives a more convenient setup for extending the
7140 pre-processor from the outside: raw_input always gets a string,
7142 pre-processor from the outside: raw_input always gets a string,
7141 and prefilter has to process it. We can then redefine prefilter
7143 and prefilter has to process it. We can then redefine prefilter
7142 from the outside and implement extensions for special
7144 from the outside and implement extensions for special
7143 purposes.
7145 purposes.
7144
7146
7145 Today I got one for inputting PhysicalQuantity objects
7147 Today I got one for inputting PhysicalQuantity objects
7146 (from Scientific) without needing any function calls at
7148 (from Scientific) without needing any function calls at
7147 all. Extremely convenient, and it's all done as a user-level
7149 all. Extremely convenient, and it's all done as a user-level
7148 extension (no IPython code was touched). Now instead of:
7150 extension (no IPython code was touched). Now instead of:
7149 a = PhysicalQuantity(4.2,'m/s**2')
7151 a = PhysicalQuantity(4.2,'m/s**2')
7150 one can simply say
7152 one can simply say
7151 a = 4.2 m/s**2
7153 a = 4.2 m/s**2
7152 or even
7154 or even
7153 a = 4.2 m/s^2
7155 a = 4.2 m/s^2
7154
7156
7155 I use this, but it's also a proof of concept: IPython really is
7157 I use this, but it's also a proof of concept: IPython really is
7156 fully user-extensible, even at the level of the parsing of the
7158 fully user-extensible, even at the level of the parsing of the
7157 command line. It's not trivial, but it's perfectly doable.
7159 command line. It's not trivial, but it's perfectly doable.
7158
7160
7159 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7161 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7160 the problem of modules being loaded in the inverse order in which
7162 the problem of modules being loaded in the inverse order in which
7161 they were defined in
7163 they were defined in
7162
7164
7163 * Version 0.1.8 released, 0.1.9 opened for further work.
7165 * Version 0.1.8 released, 0.1.9 opened for further work.
7164
7166
7165 * Added magics pdef, source and file. They respectively show the
7167 * Added magics pdef, source and file. They respectively show the
7166 definition line ('prototype' in C), source code and full python
7168 definition line ('prototype' in C), source code and full python
7167 file for any callable object. The object inspector oinfo uses
7169 file for any callable object. The object inspector oinfo uses
7168 these to show the same information.
7170 these to show the same information.
7169
7171
7170 * Version 0.1.7 released, 0.1.8 opened for further work.
7172 * Version 0.1.7 released, 0.1.8 opened for further work.
7171
7173
7172 * Separated all the magic functions into a class called Magic. The
7174 * Separated all the magic functions into a class called Magic. The
7173 InteractiveShell class was becoming too big for Xemacs to handle
7175 InteractiveShell class was becoming too big for Xemacs to handle
7174 (de-indenting a line would lock it up for 10 seconds while it
7176 (de-indenting a line would lock it up for 10 seconds while it
7175 backtracked on the whole class!)
7177 backtracked on the whole class!)
7176
7178
7177 FIXME: didn't work. It can be done, but right now namespaces are
7179 FIXME: didn't work. It can be done, but right now namespaces are
7178 all messed up. Do it later (reverted it for now, so at least
7180 all messed up. Do it later (reverted it for now, so at least
7179 everything works as before).
7181 everything works as before).
7180
7182
7181 * Got the object introspection system (magic_oinfo) working! I
7183 * Got the object introspection system (magic_oinfo) working! I
7182 think this is pretty much ready for release to Janko, so he can
7184 think this is pretty much ready for release to Janko, so he can
7183 test it for a while and then announce it. Pretty much 100% of what
7185 test it for a while and then announce it. Pretty much 100% of what
7184 I wanted for the 'phase 1' release is ready. Happy, tired.
7186 I wanted for the 'phase 1' release is ready. Happy, tired.
7185
7187
7186 2001-11-12 Fernando Perez <fperez@colorado.edu>
7188 2001-11-12 Fernando Perez <fperez@colorado.edu>
7187
7189
7188 * Version 0.1.6 released, 0.1.7 opened for further work.
7190 * Version 0.1.6 released, 0.1.7 opened for further work.
7189
7191
7190 * Fixed bug in printing: it used to test for truth before
7192 * Fixed bug in printing: it used to test for truth before
7191 printing, so 0 wouldn't print. Now checks for None.
7193 printing, so 0 wouldn't print. Now checks for None.
7192
7194
7193 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7195 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7194 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7196 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7195 reaches by hand into the outputcache. Think of a better way to do
7197 reaches by hand into the outputcache. Think of a better way to do
7196 this later.
7198 this later.
7197
7199
7198 * Various small fixes thanks to Nathan's comments.
7200 * Various small fixes thanks to Nathan's comments.
7199
7201
7200 * Changed magic_pprint to magic_Pprint. This way it doesn't
7202 * Changed magic_pprint to magic_Pprint. This way it doesn't
7201 collide with pprint() and the name is consistent with the command
7203 collide with pprint() and the name is consistent with the command
7202 line option.
7204 line option.
7203
7205
7204 * Changed prompt counter behavior to be fully like
7206 * Changed prompt counter behavior to be fully like
7205 Mathematica's. That is, even input that doesn't return a result
7207 Mathematica's. That is, even input that doesn't return a result
7206 raises the prompt counter. The old behavior was kind of confusing
7208 raises the prompt counter. The old behavior was kind of confusing
7207 (getting the same prompt number several times if the operation
7209 (getting the same prompt number several times if the operation
7208 didn't return a result).
7210 didn't return a result).
7209
7211
7210 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7212 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7211
7213
7212 * Fixed -Classic mode (wasn't working anymore).
7214 * Fixed -Classic mode (wasn't working anymore).
7213
7215
7214 * Added colored prompts using Nathan's new code. Colors are
7216 * Added colored prompts using Nathan's new code. Colors are
7215 currently hardwired, they can be user-configurable. For
7217 currently hardwired, they can be user-configurable. For
7216 developers, they can be chosen in file ipythonlib.py, at the
7218 developers, they can be chosen in file ipythonlib.py, at the
7217 beginning of the CachedOutput class def.
7219 beginning of the CachedOutput class def.
7218
7220
7219 2001-11-11 Fernando Perez <fperez@colorado.edu>
7221 2001-11-11 Fernando Perez <fperez@colorado.edu>
7220
7222
7221 * Version 0.1.5 released, 0.1.6 opened for further work.
7223 * Version 0.1.5 released, 0.1.6 opened for further work.
7222
7224
7223 * Changed magic_env to *return* the environment as a dict (not to
7225 * Changed magic_env to *return* the environment as a dict (not to
7224 print it). This way it prints, but it can also be processed.
7226 print it). This way it prints, but it can also be processed.
7225
7227
7226 * Added Verbose exception reporting to interactive
7228 * Added Verbose exception reporting to interactive
7227 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7229 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7228 traceback. Had to make some changes to the ultraTB file. This is
7230 traceback. Had to make some changes to the ultraTB file. This is
7229 probably the last 'big' thing in my mental todo list. This ties
7231 probably the last 'big' thing in my mental todo list. This ties
7230 in with the next entry:
7232 in with the next entry:
7231
7233
7232 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7234 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7233 has to specify is Plain, Color or Verbose for all exception
7235 has to specify is Plain, Color or Verbose for all exception
7234 handling.
7236 handling.
7235
7237
7236 * Removed ShellServices option. All this can really be done via
7238 * Removed ShellServices option. All this can really be done via
7237 the magic system. It's easier to extend, cleaner and has automatic
7239 the magic system. It's easier to extend, cleaner and has automatic
7238 namespace protection and documentation.
7240 namespace protection and documentation.
7239
7241
7240 2001-11-09 Fernando Perez <fperez@colorado.edu>
7242 2001-11-09 Fernando Perez <fperez@colorado.edu>
7241
7243
7242 * Fixed bug in output cache flushing (missing parameter to
7244 * Fixed bug in output cache flushing (missing parameter to
7243 __init__). Other small bugs fixed (found using pychecker).
7245 __init__). Other small bugs fixed (found using pychecker).
7244
7246
7245 * Version 0.1.4 opened for bugfixing.
7247 * Version 0.1.4 opened for bugfixing.
7246
7248
7247 2001-11-07 Fernando Perez <fperez@colorado.edu>
7249 2001-11-07 Fernando Perez <fperez@colorado.edu>
7248
7250
7249 * Version 0.1.3 released, mainly because of the raw_input bug.
7251 * Version 0.1.3 released, mainly because of the raw_input bug.
7250
7252
7251 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7253 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7252 and when testing for whether things were callable, a call could
7254 and when testing for whether things were callable, a call could
7253 actually be made to certain functions. They would get called again
7255 actually be made to certain functions. They would get called again
7254 once 'really' executed, with a resulting double call. A disaster
7256 once 'really' executed, with a resulting double call. A disaster
7255 in many cases (list.reverse() would never work!).
7257 in many cases (list.reverse() would never work!).
7256
7258
7257 * Removed prefilter() function, moved its code to raw_input (which
7259 * Removed prefilter() function, moved its code to raw_input (which
7258 after all was just a near-empty caller for prefilter). This saves
7260 after all was just a near-empty caller for prefilter). This saves
7259 a function call on every prompt, and simplifies the class a tiny bit.
7261 a function call on every prompt, and simplifies the class a tiny bit.
7260
7262
7261 * Fix _ip to __ip name in magic example file.
7263 * Fix _ip to __ip name in magic example file.
7262
7264
7263 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7265 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7264 work with non-gnu versions of tar.
7266 work with non-gnu versions of tar.
7265
7267
7266 2001-11-06 Fernando Perez <fperez@colorado.edu>
7268 2001-11-06 Fernando Perez <fperez@colorado.edu>
7267
7269
7268 * Version 0.1.2. Just to keep track of the recent changes.
7270 * Version 0.1.2. Just to keep track of the recent changes.
7269
7271
7270 * Fixed nasty bug in output prompt routine. It used to check 'if
7272 * Fixed nasty bug in output prompt routine. It used to check 'if
7271 arg != None...'. Problem is, this fails if arg implements a
7273 arg != None...'. Problem is, this fails if arg implements a
7272 special comparison (__cmp__) which disallows comparing to
7274 special comparison (__cmp__) which disallows comparing to
7273 None. Found it when trying to use the PhysicalQuantity module from
7275 None. Found it when trying to use the PhysicalQuantity module from
7274 ScientificPython.
7276 ScientificPython.
7275
7277
7276 2001-11-05 Fernando Perez <fperez@colorado.edu>
7278 2001-11-05 Fernando Perez <fperez@colorado.edu>
7277
7279
7278 * Also added dirs. Now the pushd/popd/dirs family functions
7280 * Also added dirs. Now the pushd/popd/dirs family functions
7279 basically like the shell, with the added convenience of going home
7281 basically like the shell, with the added convenience of going home
7280 when called with no args.
7282 when called with no args.
7281
7283
7282 * pushd/popd slightly modified to mimic shell behavior more
7284 * pushd/popd slightly modified to mimic shell behavior more
7283 closely.
7285 closely.
7284
7286
7285 * Added env,pushd,popd from ShellServices as magic functions. I
7287 * Added env,pushd,popd from ShellServices as magic functions. I
7286 think the cleanest will be to port all desired functions from
7288 think the cleanest will be to port all desired functions from
7287 ShellServices as magics and remove ShellServices altogether. This
7289 ShellServices as magics and remove ShellServices altogether. This
7288 will provide a single, clean way of adding functionality
7290 will provide a single, clean way of adding functionality
7289 (shell-type or otherwise) to IP.
7291 (shell-type or otherwise) to IP.
7290
7292
7291 2001-11-04 Fernando Perez <fperez@colorado.edu>
7293 2001-11-04 Fernando Perez <fperez@colorado.edu>
7292
7294
7293 * Added .ipython/ directory to sys.path. This way users can keep
7295 * Added .ipython/ directory to sys.path. This way users can keep
7294 customizations there and access them via import.
7296 customizations there and access them via import.
7295
7297
7296 2001-11-03 Fernando Perez <fperez@colorado.edu>
7298 2001-11-03 Fernando Perez <fperez@colorado.edu>
7297
7299
7298 * Opened version 0.1.1 for new changes.
7300 * Opened version 0.1.1 for new changes.
7299
7301
7300 * Changed version number to 0.1.0: first 'public' release, sent to
7302 * Changed version number to 0.1.0: first 'public' release, sent to
7301 Nathan and Janko.
7303 Nathan and Janko.
7302
7304
7303 * Lots of small fixes and tweaks.
7305 * Lots of small fixes and tweaks.
7304
7306
7305 * Minor changes to whos format. Now strings are shown, snipped if
7307 * Minor changes to whos format. Now strings are shown, snipped if
7306 too long.
7308 too long.
7307
7309
7308 * Changed ShellServices to work on __main__ so they show up in @who
7310 * Changed ShellServices to work on __main__ so they show up in @who
7309
7311
7310 * Help also works with ? at the end of a line:
7312 * Help also works with ? at the end of a line:
7311 ?sin and sin?
7313 ?sin and sin?
7312 both produce the same effect. This is nice, as often I use the
7314 both produce the same effect. This is nice, as often I use the
7313 tab-complete to find the name of a method, but I used to then have
7315 tab-complete to find the name of a method, but I used to then have
7314 to go to the beginning of the line to put a ? if I wanted more
7316 to go to the beginning of the line to put a ? if I wanted more
7315 info. Now I can just add the ? and hit return. Convenient.
7317 info. Now I can just add the ? and hit return. Convenient.
7316
7318
7317 2001-11-02 Fernando Perez <fperez@colorado.edu>
7319 2001-11-02 Fernando Perez <fperez@colorado.edu>
7318
7320
7319 * Python version check (>=2.1) added.
7321 * Python version check (>=2.1) added.
7320
7322
7321 * Added LazyPython documentation. At this point the docs are quite
7323 * Added LazyPython documentation. At this point the docs are quite
7322 a mess. A cleanup is in order.
7324 a mess. A cleanup is in order.
7323
7325
7324 * Auto-installer created. For some bizarre reason, the zipfiles
7326 * Auto-installer created. For some bizarre reason, the zipfiles
7325 module isn't working on my system. So I made a tar version
7327 module isn't working on my system. So I made a tar version
7326 (hopefully the command line options in various systems won't kill
7328 (hopefully the command line options in various systems won't kill
7327 me).
7329 me).
7328
7330
7329 * Fixes to Struct in genutils. Now all dictionary-like methods are
7331 * Fixes to Struct in genutils. Now all dictionary-like methods are
7330 protected (reasonably).
7332 protected (reasonably).
7331
7333
7332 * Added pager function to genutils and changed ? to print usage
7334 * Added pager function to genutils and changed ? to print usage
7333 note through it (it was too long).
7335 note through it (it was too long).
7334
7336
7335 * Added the LazyPython functionality. Works great! I changed the
7337 * Added the LazyPython functionality. Works great! I changed the
7336 auto-quote escape to ';', it's on home row and next to '. But
7338 auto-quote escape to ';', it's on home row and next to '. But
7337 both auto-quote and auto-paren (still /) escapes are command-line
7339 both auto-quote and auto-paren (still /) escapes are command-line
7338 parameters.
7340 parameters.
7339
7341
7340
7342
7341 2001-11-01 Fernando Perez <fperez@colorado.edu>
7343 2001-11-01 Fernando Perez <fperez@colorado.edu>
7342
7344
7343 * Version changed to 0.0.7. Fairly large change: configuration now
7345 * Version changed to 0.0.7. Fairly large change: configuration now
7344 is all stored in a directory, by default .ipython. There, all
7346 is all stored in a directory, by default .ipython. There, all
7345 config files have normal looking names (not .names)
7347 config files have normal looking names (not .names)
7346
7348
7347 * Version 0.0.6 Released first to Lucas and Archie as a test
7349 * Version 0.0.6 Released first to Lucas and Archie as a test
7348 run. Since it's the first 'semi-public' release, change version to
7350 run. Since it's the first 'semi-public' release, change version to
7349 > 0.0.6 for any changes now.
7351 > 0.0.6 for any changes now.
7350
7352
7351 * Stuff I had put in the ipplib.py changelog:
7353 * Stuff I had put in the ipplib.py changelog:
7352
7354
7353 Changes to InteractiveShell:
7355 Changes to InteractiveShell:
7354
7356
7355 - Made the usage message a parameter.
7357 - Made the usage message a parameter.
7356
7358
7357 - Require the name of the shell variable to be given. It's a bit
7359 - Require the name of the shell variable to be given. It's a bit
7358 of a hack, but allows the name 'shell' not to be hardwired in the
7360 of a hack, but allows the name 'shell' not to be hardwired in the
7359 magic (@) handler, which is problematic b/c it requires
7361 magic (@) handler, which is problematic b/c it requires
7360 polluting the global namespace with 'shell'. This in turn is
7362 polluting the global namespace with 'shell'. This in turn is
7361 fragile: if a user redefines a variable called shell, things
7363 fragile: if a user redefines a variable called shell, things
7362 break.
7364 break.
7363
7365
7364 - magic @: all functions available through @ need to be defined
7366 - magic @: all functions available through @ need to be defined
7365 as magic_<name>, even though they can be called simply as
7367 as magic_<name>, even though they can be called simply as
7366 @<name>. This allows the special command @magic to gather
7368 @<name>. This allows the special command @magic to gather
7367 information automatically about all existing magic functions,
7369 information automatically about all existing magic functions,
7368 even if they are run-time user extensions, by parsing the shell
7370 even if they are run-time user extensions, by parsing the shell
7369 instance __dict__ looking for special magic_ names.
7371 instance __dict__ looking for special magic_ names.
7370
7372
7371 - mainloop: added *two* local namespace parameters. This allows
7373 - mainloop: added *two* local namespace parameters. This allows
7372 the class to differentiate between parameters which were there
7374 the class to differentiate between parameters which were there
7373 before and after command line initialization was processed. This
7375 before and after command line initialization was processed. This
7374 way, later @who can show things loaded at startup by the
7376 way, later @who can show things loaded at startup by the
7375 user. This trick was necessary to make session saving/reloading
7377 user. This trick was necessary to make session saving/reloading
7376 really work: ideally after saving/exiting/reloading a session,
7378 really work: ideally after saving/exiting/reloading a session,
7377 *everything* should look the same, including the output of @who. I
7379 *everything* should look the same, including the output of @who. I
7378 was only able to make this work with this double namespace
7380 was only able to make this work with this double namespace
7379 trick.
7381 trick.
7380
7382
7381 - added a header to the logfile which allows (almost) full
7383 - added a header to the logfile which allows (almost) full
7382 session restoring.
7384 session restoring.
7383
7385
7384 - prepend lines beginning with @ or !, with a and log
7386 - prepend lines beginning with @ or !, with a and log
7385 them. Why? !lines: may be useful to know what you did @lines:
7387 them. Why? !lines: may be useful to know what you did @lines:
7386 they may affect session state. So when restoring a session, at
7388 they may affect session state. So when restoring a session, at
7387 least inform the user of their presence. I couldn't quite get
7389 least inform the user of their presence. I couldn't quite get
7388 them to properly re-execute, but at least the user is warned.
7390 them to properly re-execute, but at least the user is warned.
7389
7391
7390 * Started ChangeLog.
7392 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now