##// END OF EJS Templates
* IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail...
walter.doerwald -
Show More
@@ -1,390 +1,391 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 def __xrepr__(self, mode="default"):
259 def __xrepr__(self, mode="default"):
260 yield (-1, True)
260 yield (-1, True)
261 for info in self:
261 for info in self:
262 yield info
262 yield info
263
263
264
264
265 def streamstyle(stream, styled=None):
265 def streamstyle(stream, styled=None):
266 """
266 """
267 If ``styled`` is ``None``, return whether ``stream`` refers to a terminal.
267 If ``styled`` is ``None``, return whether ``stream`` refers to a terminal.
268 If this can't be determined (either because ``stream`` doesn't refer to a
268 If this can't be determined (either because ``stream`` doesn't refer to a
269 real OS file, or because you're on Windows) return ``False``. If ``styled``
269 real OS file, or because you're on Windows) return ``False``. If ``styled``
270 is not ``None`` ``styled`` will be returned unchanged.
270 is not ``None`` ``styled`` will be returned unchanged.
271 """
271 """
272 if styled is None:
272 if styled is None:
273 try:
273 try:
274 styled = os.isatty(stream.fileno())
274 styled = os.isatty(stream.fileno())
275 except (KeyboardInterrupt, SystemExit):
275 except (KeyboardInterrupt, SystemExit):
276 raise
276 raise
277 except Exception:
277 except Exception:
278 styled = False
278 styled = False
279 return styled
279 return styled
280
280
281
281
282 def write(stream, styled, *texts):
282 def write(stream, styled, *texts):
283 """
283 """
284 Write ``texts`` to ``stream``.
284 Write ``texts`` to ``stream``.
285 """
285 """
286 text = Text(*texts)
286 text = Text(*texts)
287 text.write(stream, streamstyle(stream, styled))
287 text.write(stream, streamstyle(stream, styled))
288
288
289
289
290 def writeln(stream, styled, *texts):
290 def writeln(stream, styled, *texts):
291 """
291 """
292 Write ``texts`` to ``stream`` and finish with a line feed.
292 Write ``texts`` to ``stream`` and finish with a line feed.
293 """
293 """
294 write(stream, styled, *texts)
294 write(stream, styled, *texts)
295 stream.write("\n")
295 stream.write("\n")
296
296
297
297
298 class Stream(object):
298 class Stream(object):
299 """
299 """
300 Stream wrapper that adds color output.
300 Stream wrapper that adds color output.
301 """
301 """
302 def __init__(self, stream, styled=None):
302 def __init__(self, stream, styled=None):
303 self.stream = stream
303 self.stream = stream
304 self.styled = streamstyle(stream, styled)
304 self.styled = streamstyle(stream, styled)
305
305
306 def write(self, *texts):
306 def write(self, *texts):
307 write(self.stream, self.styled, *texts)
307 write(self.stream, self.styled, *texts)
308
308
309 def writeln(self, *texts):
309 def writeln(self, *texts):
310 writeln(self.stream, self.styled, *texts)
310 writeln(self.stream, self.styled, *texts)
311
311
312 def __getattr__(self, name):
312 def __getattr__(self, name):
313 return getattr(self.stream, name)
313 return getattr(self.stream, name)
314
314
315
315
316 class stdout(object):
316 class stdout(object):
317 """
317 """
318 Stream wrapper for ``sys.stdout`` that adds color output.
318 Stream wrapper for ``sys.stdout`` that adds color output.
319 """
319 """
320 def write(self, *texts):
320 def write(self, *texts):
321 write(sys.stdout, None, *texts)
321 write(sys.stdout, None, *texts)
322
322
323 def writeln(self, *texts):
323 def writeln(self, *texts):
324 writeln(sys.stdout, None, *texts)
324 writeln(sys.stdout, None, *texts)
325
325
326 def __getattr__(self, name):
326 def __getattr__(self, name):
327 return getattr(sys.stdout, name)
327 return getattr(sys.stdout, name)
328 stdout = stdout()
328 stdout = stdout()
329
329
330
330
331 class stderr(object):
331 class stderr(object):
332 """
332 """
333 Stream wrapper for ``sys.stderr`` that adds color output.
333 Stream wrapper for ``sys.stderr`` that adds color output.
334 """
334 """
335 def write(self, *texts):
335 def write(self, *texts):
336 write(sys.stderr, None, *texts)
336 write(sys.stderr, None, *texts)
337
337
338 def writeln(self, *texts):
338 def writeln(self, *texts):
339 writeln(sys.stderr, None, *texts)
339 writeln(sys.stderr, None, *texts)
340
340
341 def __getattr__(self, name):
341 def __getattr__(self, name):
342 return getattr(sys.stdout, name)
342 return getattr(sys.stdout, name)
343 stderr = stderr()
343 stderr = stderr()
344
344
345
345
346 if curses is not None:
346 if curses is not None:
347 # This is probably just range(8)
347 # This is probably just range(8)
348 COLOR2CURSES = [
348 COLOR2CURSES = [
349 COLOR_BLACK,
349 COLOR_BLACK,
350 COLOR_RED,
350 COLOR_RED,
351 COLOR_GREEN,
351 COLOR_GREEN,
352 COLOR_YELLOW,
352 COLOR_YELLOW,
353 COLOR_BLUE,
353 COLOR_BLUE,
354 COLOR_MAGENTA,
354 COLOR_MAGENTA,
355 COLOR_CYAN,
355 COLOR_CYAN,
356 COLOR_WHITE,
356 COLOR_WHITE,
357 ]
357 ]
358
358
359 A2CURSES = {
359 A2CURSES = {
360 A_BLINK: curses.A_BLINK,
360 A_BLINK: curses.A_BLINK,
361 A_BOLD: curses.A_BOLD,
361 A_BOLD: curses.A_BOLD,
362 A_DIM: curses.A_DIM,
362 A_DIM: curses.A_DIM,
363 A_REVERSE: curses.A_REVERSE,
363 A_REVERSE: curses.A_REVERSE,
364 A_STANDOUT: curses.A_STANDOUT,
364 A_STANDOUT: curses.A_STANDOUT,
365 A_UNDERLINE: curses.A_UNDERLINE,
365 A_UNDERLINE: curses.A_UNDERLINE,
366 }
366 }
367
367
368
368
369 # default style
369 # default style
370 style_default = Style.fromstr("white:black")
370 style_default = Style.fromstr("white:black")
371
371
372 # Styles for datatypes
372 # Styles for datatypes
373 style_type_none = Style.fromstr("magenta:black")
373 style_type_none = Style.fromstr("magenta:black")
374 style_type_bool = Style.fromstr("magenta:black")
374 style_type_bool = Style.fromstr("magenta:black")
375 style_type_number = Style.fromstr("yellow:black")
375 style_type_number = Style.fromstr("yellow:black")
376 style_type_datetime = Style.fromstr("magenta:black")
376 style_type_datetime = Style.fromstr("magenta:black")
377 style_type_type = Style.fromstr("cyan:black")
377
378
378 # Style for URLs and file/directory names
379 # Style for URLs and file/directory names
379 style_url = Style.fromstr("green:black")
380 style_url = Style.fromstr("green:black")
380 style_dir = Style.fromstr("cyan:black")
381 style_dir = Style.fromstr("cyan:black")
381 style_file = Style.fromstr("green:black")
382 style_file = Style.fromstr("green:black")
382
383
383 # Style for ellipsis (when an output has been shortened
384 # Style for ellipsis (when an output has been shortened
384 style_ellisis = Style.fromstr("red:black")
385 style_ellisis = Style.fromstr("red:black")
385
386
386 # Style for displaying exceptions
387 # Style for displaying exceptions
387 style_error = Style.fromstr("red:black")
388 style_error = Style.fromstr("red:black")
388
389
389 # Style for displaying non-existing attributes
390 # Style for displaying non-existing attributes
390 style_nodata = Style.fromstr("red:black")
391 style_nodata = Style.fromstr("red:black")
@@ -1,1665 +1,1679 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 import astyle, ipipe
5 import astyle, ipipe
6
6
7
7
8 # Python 2.3 compatibility
8 # Python 2.3 compatibility
9 try:
9 try:
10 set
10 set
11 except NameError:
11 except NameError:
12 import sets
12 import sets
13 set = sets.Set
13 set = sets.Set
14
14
15
15
16 class UnassignedKeyError(Exception):
16 class UnassignedKeyError(Exception):
17 """
17 """
18 Exception that is used for reporting unassigned keys.
18 Exception that is used for reporting unassigned keys.
19 """
19 """
20
20
21
21
22 class UnknownCommandError(Exception):
22 class UnknownCommandError(Exception):
23 """
23 """
24 Exception that is used for reporting unknown command (this should never
24 Exception that is used for reporting unknown command (this should never
25 happen).
25 happen).
26 """
26 """
27
27
28
28
29 class CommandError(Exception):
29 class CommandError(Exception):
30 """
30 """
31 Exception that is used for reporting that a command can't be executed.
31 Exception that is used for reporting that a command can't be executed.
32 """
32 """
33
33
34
34
35 class Keymap(dict):
35 class Keymap(dict):
36 """
36 """
37 Stores mapping of keys to commands.
37 Stores mapping of keys to commands.
38 """
38 """
39 def __init__(self):
39 def __init__(self):
40 self._keymap = {}
40 self._keymap = {}
41
41
42 def __setitem__(self, key, command):
42 def __setitem__(self, key, command):
43 if isinstance(key, str):
43 if isinstance(key, str):
44 for c in key:
44 for c in key:
45 dict.__setitem__(self, ord(c), command)
45 dict.__setitem__(self, ord(c), command)
46 else:
46 else:
47 dict.__setitem__(self, key, command)
47 dict.__setitem__(self, key, command)
48
48
49 def __getitem__(self, key):
49 def __getitem__(self, key):
50 if isinstance(key, str):
50 if isinstance(key, str):
51 key = ord(key)
51 key = ord(key)
52 return dict.__getitem__(self, key)
52 return dict.__getitem__(self, key)
53
53
54 def __detitem__(self, key):
54 def __detitem__(self, key):
55 if isinstance(key, str):
55 if isinstance(key, str):
56 key = ord(key)
56 key = ord(key)
57 dict.__detitem__(self, key)
57 dict.__detitem__(self, key)
58
58
59 def register(self, command, *keys):
59 def register(self, command, *keys):
60 for key in keys:
60 for key in keys:
61 self[key] = command
61 self[key] = command
62
62
63 def get(self, key, default=None):
63 def get(self, key, default=None):
64 if isinstance(key, str):
64 if isinstance(key, str):
65 key = ord(key)
65 key = ord(key)
66 return dict.get(self, key, default)
66 return dict.get(self, key, default)
67
67
68 def findkey(self, command, default=ipipe.noitem):
68 def findkey(self, command, default=ipipe.noitem):
69 for (key, commandcandidate) in self.iteritems():
69 for (key, commandcandidate) in self.iteritems():
70 if commandcandidate == command:
70 if commandcandidate == command:
71 return key
71 return key
72 if default is ipipe.noitem:
72 if default is ipipe.noitem:
73 raise KeyError(command)
73 raise KeyError(command)
74 return default
74 return default
75
75
76
76
77 class _BrowserCachedItem(object):
77 class _BrowserCachedItem(object):
78 # This is used internally by ``ibrowse`` to store a item together with its
78 # This is used internally by ``ibrowse`` to store a item together with its
79 # marked status.
79 # marked status.
80 __slots__ = ("item", "marked")
80 __slots__ = ("item", "marked")
81
81
82 def __init__(self, item):
82 def __init__(self, item):
83 self.item = item
83 self.item = item
84 self.marked = False
84 self.marked = False
85
85
86
86
87 class _BrowserHelp(object):
87 class _BrowserHelp(object):
88 style_header = astyle.Style.fromstr("yellow:black:bold")
88 style_header = astyle.Style.fromstr("yellow:black:bold")
89 # This is used internally by ``ibrowse`` for displaying the help screen.
89 # This is used internally by ``ibrowse`` for displaying the help screen.
90 def __init__(self, browser):
90 def __init__(self, browser):
91 self.browser = browser
91 self.browser = browser
92
92
93 def __xrepr__(self, mode):
93 def __xrepr__(self, mode):
94 yield (-1, True)
94 yield (-1, True)
95 if mode == "header" or mode == "footer":
95 if mode == "header" or mode == "footer":
96 yield (astyle.style_default, "ibrowse help screen")
96 yield (astyle.style_default, "ibrowse help screen")
97 else:
97 else:
98 yield (astyle.style_default, repr(self))
98 yield (astyle.style_default, repr(self))
99
99
100 def __xiter__(self, mode):
100 def __iter__(self):
101 # Get reverse key mapping
101 # Get reverse key mapping
102 allkeys = {}
102 allkeys = {}
103 for (key, cmd) in self.browser.keymap.iteritems():
103 for (key, cmd) in self.browser.keymap.iteritems():
104 allkeys.setdefault(cmd, []).append(key)
104 allkeys.setdefault(cmd, []).append(key)
105
105
106 fields = ("key", "description")
106 fields = ("key", "description")
107
107
108 commands = []
108 commands = []
109 for name in dir(self.browser):
109 for name in dir(self.browser):
110 if name.startswith("cmd_"):
110 if name.startswith("cmd_"):
111 command = getattr(self.browser, name)
111 command = getattr(self.browser, name)
112 commands.append((inspect.getsourcelines(command)[-1], name[4:], command))
112 commands.append((inspect.getsourcelines(command)[-1], name[4:], command))
113 commands.sort()
113 commands.sort()
114 commands = [(c[1], c[2]) for c in commands]
114 commands = [(c[1], c[2]) for c in commands]
115 for (i, (name, command)) in enumerate(commands):
115 for (i, (name, command)) in enumerate(commands):
116 if i:
116 if i:
117 yield ipipe.Fields(fields, key="", description="")
117 yield ipipe.Fields(fields, key="", description="")
118
118
119 description = command.__doc__
119 description = command.__doc__
120 if description is None:
120 if description is None:
121 lines = []
121 lines = []
122 else:
122 else:
123 lines = [l.strip() for l in description.splitlines() if l.strip()]
123 lines = [l.strip() for l in description.splitlines() if l.strip()]
124 description = "\n".join(lines)
124 description = "\n".join(lines)
125 lines = textwrap.wrap(description, 60)
125 lines = textwrap.wrap(description, 60)
126 keys = allkeys.get(name, [])
126 keys = allkeys.get(name, [])
127
127
128 yield ipipe.Fields(fields, description=astyle.Text((self.style_header, name)))
128 yield ipipe.Fields(fields, key="", description=astyle.Text((self.style_header, name)))
129 for i in xrange(max(len(keys), len(lines))):
129 for i in xrange(max(len(keys), len(lines))):
130 try:
130 try:
131 key = self.browser.keylabel(keys[i])
131 key = self.browser.keylabel(keys[i])
132 except IndexError:
132 except IndexError:
133 key = ""
133 key = ""
134 try:
134 try:
135 line = lines[i]
135 line = lines[i]
136 except IndexError:
136 except IndexError:
137 line = ""
137 line = ""
138 yield ipipe.Fields(fields, key=key, description=line)
138 yield ipipe.Fields(fields, key=key, description=line)
139
139
140
140
141 class _BrowserLevel(object):
141 class _BrowserLevel(object):
142 # This is used internally to store the state (iterator, fetch items,
142 # This is used internally to store the state (iterator, fetch items,
143 # position of cursor and screen, etc.) of one browser level
143 # position of cursor and screen, etc.) of one browser level
144 # An ``ibrowse`` object keeps multiple ``_BrowserLevel`` objects in
144 # An ``ibrowse`` object keeps multiple ``_BrowserLevel`` objects in
145 # a stack.
145 # a stack.
146 def __init__(self, browser, input, iterator, mainsizey, *attrs):
146 def __init__(self, browser, input, iterator, mainsizey, *attrs):
147 self.browser = browser
147 self.browser = browser
148 self.input = input
148 self.input = input
149 self.header = [x for x in ipipe.xrepr(input, "header") if not isinstance(x[0], int)]
149 self.header = [x for x in ipipe.xrepr(input, "header") if not isinstance(x[0], int)]
150 # iterator for the input
150 # iterator for the input
151 self.iterator = iterator
151 self.iterator = iterator
152
152
153 # is the iterator exhausted?
153 # is the iterator exhausted?
154 self.exhausted = False
154 self.exhausted = False
155
155
156 # attributes to be display (autodetected if empty)
156 # attributes to be display (autodetected if empty)
157 self.attrs = attrs
157 self.attrs = attrs
158
158
159 # fetched items (+ marked flag)
159 # fetched items (+ marked flag)
160 self.items = ipipe.deque()
160 self.items = ipipe.deque()
161
161
162 # Number of marked objects
162 # Number of marked objects
163 self.marked = 0
163 self.marked = 0
164
164
165 # Vertical cursor position
165 # Vertical cursor position
166 self.cury = 0
166 self.cury = 0
167
167
168 # Horizontal cursor position
168 # Horizontal cursor position
169 self.curx = 0
169 self.curx = 0
170
170
171 # Index of first data column
171 # Index of first data column
172 self.datastartx = 0
172 self.datastartx = 0
173
173
174 # Index of first data line
174 # Index of first data line
175 self.datastarty = 0
175 self.datastarty = 0
176
176
177 # height of the data display area
177 # height of the data display area
178 self.mainsizey = mainsizey
178 self.mainsizey = mainsizey
179
179
180 # width of the data display area (changes when scrolling)
180 # width of the data display area (changes when scrolling)
181 self.mainsizex = 0
181 self.mainsizex = 0
182
182
183 # Size of row number (changes when scrolling)
183 # Size of row number (changes when scrolling)
184 self.numbersizex = 0
184 self.numbersizex = 0
185
185
186 # Attribute names to display (in this order)
186 # Attributes to display (in this order)
187 self.displayattrs = []
187 self.displayattrs = []
188
188
189 # index and name of attribute under the cursor
189 # index and attribute under the cursor
190 self.displayattr = (None, ipipe.noitem)
190 self.displayattr = (None, ipipe.noitem)
191
191
192 # Maps attribute names to column widths
192 # Maps attributes to column widths
193 self.colwidths = {}
193 self.colwidths = {}
194
194
195 # Set of hidden attributes
195 # Set of hidden attributes
196 self.hiddenattrs = set()
196 self.hiddenattrs = set()
197
197
198 # This takes care of all the caches etc.
198 # This takes care of all the caches etc.
199 self.moveto(0, 0, refresh=True)
199 self.moveto(0, 0, refresh=True)
200
200
201 def fetch(self, count):
201 def fetch(self, count):
202 # Try to fill ``self.items`` with at least ``count`` objects.
202 # Try to fill ``self.items`` with at least ``count`` objects.
203 have = len(self.items)
203 have = len(self.items)
204 while not self.exhausted and have < count:
204 while not self.exhausted and have < count:
205 try:
205 try:
206 item = self.iterator.next()
206 item = self.iterator.next()
207 except StopIteration:
207 except StopIteration:
208 self.exhausted = True
208 self.exhausted = True
209 break
209 break
210 except (KeyboardInterrupt, SystemExit):
211 raise
212 except Exception, exc:
213 have += 1
214 self.items.append(_BrowserCachedItem(exc))
215 self.exhausted = True
216 break
210 else:
217 else:
211 have += 1
218 have += 1
212 self.items.append(_BrowserCachedItem(item))
219 self.items.append(_BrowserCachedItem(item))
213
220
214 def calcdisplayattrs(self):
221 def calcdisplayattrs(self):
215 # Calculate which attributes are available from the objects that are
222 # Calculate which attributes are available from the objects that are
216 # currently visible on screen (and store it in ``self.displayattrs``)
223 # currently visible on screen (and store it in ``self.displayattrs``)
217
224
218 attrnames = set()
225 attrs = set()
219 self.displayattrs = []
226 self.displayattrs = []
220 if self.attrs:
227 if self.attrs:
221 # If the browser object specifies a fixed list of attributes,
228 # If the browser object specifies a fixed list of attributes,
222 # simply use it (removing hidden attributes).
229 # simply use it (removing hidden attributes).
223 for attrname in self.attrs:
230 for attr in self.attrs:
224 if attrname not in attrnames and attrname not in self.hiddenattrs:
231 attr = ipipe.upgradexattr(attr)
225 self.displayattrs.append(attrname)
232 if attr not in attrs and attr not in self.hiddenattrs:
226 attrnames.add(attrname)
233 self.displayattrs.append(attr)
234 attrs.add(attr)
227 else:
235 else:
228 endy = min(self.datastarty+self.mainsizey, len(self.items))
236 endy = min(self.datastarty+self.mainsizey, len(self.items))
229 for i in xrange(self.datastarty, endy):
237 for i in xrange(self.datastarty, endy):
230 for attrname in ipipe.xattrs(self.items[i].item, "default"):
238 for attr in ipipe.xattrs(self.items[i].item, "default"):
231 if attrname not in attrnames and attrname not in self.hiddenattrs:
239 if attr not in attrs and attr not in self.hiddenattrs:
232 self.displayattrs.append(attrname)
240 self.displayattrs.append(attr)
233 attrnames.add(attrname)
241 attrs.add(attr)
234
242
235 def getrow(self, i):
243 def getrow(self, i):
236 # Return a dictinary with the attributes for the object
244 # Return a dictinary with the attributes for the object
237 # ``self.items[i]``. Attribute names are taken from
245 # ``self.items[i]``. Attribute names are taken from
238 # ``self.displayattrs`` so ``calcdisplayattrs()`` must have been
246 # ``self.displayattrs`` so ``calcdisplayattrs()`` must have been
239 # called before.
247 # called before.
240 row = {}
248 row = {}
241 item = self.items[i].item
249 item = self.items[i].item
242 for attrname in self.displayattrs:
250 for attr in self.displayattrs:
243 try:
251 try:
244 value = ipipe._getattr(item, attrname, ipipe.noitem)
252 value = attr.value(item)
245 except (KeyboardInterrupt, SystemExit):
253 except (KeyboardInterrupt, SystemExit):
246 raise
254 raise
247 except Exception, exc:
255 except Exception, exc:
248 value = exc
256 value = exc
249 # only store attribute if it exists (or we got an exception)
257 # only store attribute if it exists (or we got an exception)
250 if value is not ipipe.noitem:
258 if value is not ipipe.noitem:
251 # remember alignment, length and colored text
259 # remember alignment, length and colored text
252 row[attrname] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
260 row[attr] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
253 return row
261 return row
254
262
255 def calcwidths(self):
263 def calcwidths(self):
256 # Recalculate the displayed fields and their widths.
264 # Recalculate the displayed fields and their widths.
257 # ``calcdisplayattrs()'' must have been called and the cache
265 # ``calcdisplayattrs()'' must have been called and the cache
258 # for attributes of the objects on screen (``self.displayrows``)
266 # for attributes of the objects on screen (``self.displayrows``)
259 # must have been filled. This returns a dictionary mapping
267 # must have been filled. This returns a dictionary mapping
260 # column names to widths.
268 # column names to widths.
261 self.colwidths = {}
269 self.colwidths = {}
262 for row in self.displayrows:
270 for row in self.displayrows:
263 for attrname in self.displayattrs:
271 for attr in self.displayattrs:
264 try:
272 try:
265 length = row[attrname][1]
273 length = row[attr][1]
266 except KeyError:
274 except KeyError:
267 length = 0
275 length = 0
268 # always add attribute to colwidths, even if it doesn't exist
276 # always add attribute to colwidths, even if it doesn't exist
269 if attrname not in self.colwidths:
277 if attr not in self.colwidths:
270 self.colwidths[attrname] = len(ipipe._attrname(attrname))
278 self.colwidths[attr] = len(attr.name())
271 newwidth = max(self.colwidths[attrname], length)
279 newwidth = max(self.colwidths[attr], length)
272 self.colwidths[attrname] = newwidth
280 self.colwidths[attr] = newwidth
273
281
274 # How many characters do we need to paint the largest item number?
282 # How many characters do we need to paint the largest item number?
275 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
283 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
276 # How must space have we got to display data?
284 # How must space have we got to display data?
277 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
285 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
278 # width of all columns
286 # width of all columns
279 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
287 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
280
288
281 def calcdisplayattr(self):
289 def calcdisplayattr(self):
282 # Find out which attribute the cursor is on and store this
290 # Find out which attribute the cursor is on and store this
283 # information in ``self.displayattr``.
291 # information in ``self.displayattr``.
284 pos = 0
292 pos = 0
285 for (i, attrname) in enumerate(self.displayattrs):
293 for (i, attr) in enumerate(self.displayattrs):
286 if pos+self.colwidths[attrname] >= self.curx:
294 if pos+self.colwidths[attr] >= self.curx:
287 self.displayattr = (i, attrname)
295 self.displayattr = (i, attr)
288 break
296 break
289 pos += self.colwidths[attrname]+1
297 pos += self.colwidths[attr]+1
290 else:
298 else:
291 self.displayattr = (None, ipipe.noitem)
299 self.displayattr = (None, ipipe.noitem)
292
300
293 def moveto(self, x, y, refresh=False):
301 def moveto(self, x, y, refresh=False):
294 # Move the cursor to the position ``(x,y)`` (in data coordinates,
302 # Move the cursor to the position ``(x,y)`` (in data coordinates,
295 # not in screen coordinates). If ``refresh`` is true, all cached
303 # not in screen coordinates). If ``refresh`` is true, all cached
296 # values will be recalculated (e.g. because the list has been
304 # values will be recalculated (e.g. because the list has been
297 # resorted, so screen positions etc. are no longer valid).
305 # resorted, so screen positions etc. are no longer valid).
298 olddatastarty = self.datastarty
306 olddatastarty = self.datastarty
299 oldx = self.curx
307 oldx = self.curx
300 oldy = self.cury
308 oldy = self.cury
301 x = int(x+0.5)
309 x = int(x+0.5)
302 y = int(y+0.5)
310 y = int(y+0.5)
303 newx = x # remember where we wanted to move
311 newx = x # remember where we wanted to move
304 newy = y # remember where we wanted to move
312 newy = y # remember where we wanted to move
305
313
306 scrollbordery = min(self.browser.scrollbordery, self.mainsizey//2)
314 scrollbordery = min(self.browser.scrollbordery, self.mainsizey//2)
307 scrollborderx = min(self.browser.scrollborderx, self.mainsizex//2)
315 scrollborderx = min(self.browser.scrollborderx, self.mainsizex//2)
308
316
309 # Make sure that the cursor didn't leave the main area vertically
317 # Make sure that the cursor didn't leave the main area vertically
310 if y < 0:
318 if y < 0:
311 y = 0
319 y = 0
312 # try to get enough items to fill the screen
320 # try to get enough items to fill the screen
313 self.fetch(max(y+scrollbordery+1, self.mainsizey))
321 self.fetch(max(y+scrollbordery+1, self.mainsizey))
314 if y >= len(self.items):
322 if y >= len(self.items):
315 y = max(0, len(self.items)-1)
323 y = max(0, len(self.items)-1)
316
324
317 # Make sure that the cursor stays on screen vertically
325 # Make sure that the cursor stays on screen vertically
318 if y < self.datastarty+scrollbordery:
326 if y < self.datastarty+scrollbordery:
319 self.datastarty = max(0, y-scrollbordery)
327 self.datastarty = max(0, y-scrollbordery)
320 elif y >= self.datastarty+self.mainsizey-scrollbordery:
328 elif y >= self.datastarty+self.mainsizey-scrollbordery:
321 self.datastarty = max(0, min(y-self.mainsizey+scrollbordery+1,
329 self.datastarty = max(0, min(y-self.mainsizey+scrollbordery+1,
322 len(self.items)-self.mainsizey))
330 len(self.items)-self.mainsizey))
323
331
324 if refresh: # Do we need to refresh the complete display?
332 if refresh: # Do we need to refresh the complete display?
325 self.calcdisplayattrs()
333 self.calcdisplayattrs()
326 endy = min(self.datastarty+self.mainsizey, len(self.items))
334 endy = min(self.datastarty+self.mainsizey, len(self.items))
327 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
335 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
328 self.calcwidths()
336 self.calcwidths()
329 # Did we scroll vertically => update displayrows
337 # Did we scroll vertically => update displayrows
330 # and various other attributes
338 # and various other attributes
331 elif self.datastarty != olddatastarty:
339 elif self.datastarty != olddatastarty:
332 # Recalculate which attributes we have to display
340 # Recalculate which attributes we have to display
333 olddisplayattrs = self.displayattrs
341 olddisplayattrs = self.displayattrs
334 self.calcdisplayattrs()
342 self.calcdisplayattrs()
335 # If there are new attributes, recreate the cache
343 # If there are new attributes, recreate the cache
336 if self.displayattrs != olddisplayattrs:
344 if self.displayattrs != olddisplayattrs:
337 endy = min(self.datastarty+self.mainsizey, len(self.items))
345 endy = min(self.datastarty+self.mainsizey, len(self.items))
338 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
346 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
339 elif self.datastarty<olddatastarty: # we did scroll up
347 elif self.datastarty<olddatastarty: # we did scroll up
340 # drop rows from the end
348 # drop rows from the end
341 del self.displayrows[self.datastarty-olddatastarty:]
349 del self.displayrows[self.datastarty-olddatastarty:]
342 # fetch new items
350 # fetch new items
343 for i in xrange(min(olddatastarty, self.datastarty+self.mainsizey)-1,
351 for i in xrange(min(olddatastarty, self.datastarty+self.mainsizey)-1,
344 self.datastarty-1, -1):
352 self.datastarty-1, -1):
345 try:
353 try:
346 row = self.getrow(i)
354 row = self.getrow(i)
347 except IndexError:
355 except IndexError:
348 # we didn't have enough objects to fill the screen
356 # we didn't have enough objects to fill the screen
349 break
357 break
350 self.displayrows.insert(0, row)
358 self.displayrows.insert(0, row)
351 else: # we did scroll down
359 else: # we did scroll down
352 # drop rows from the start
360 # drop rows from the start
353 del self.displayrows[:self.datastarty-olddatastarty]
361 del self.displayrows[:self.datastarty-olddatastarty]
354 # fetch new items
362 # fetch new items
355 for i in xrange(max(olddatastarty+self.mainsizey, self.datastarty),
363 for i in xrange(max(olddatastarty+self.mainsizey, self.datastarty),
356 self.datastarty+self.mainsizey):
364 self.datastarty+self.mainsizey):
357 try:
365 try:
358 row = self.getrow(i)
366 row = self.getrow(i)
359 except IndexError:
367 except IndexError:
360 # we didn't have enough objects to fill the screen
368 # we didn't have enough objects to fill the screen
361 break
369 break
362 self.displayrows.append(row)
370 self.displayrows.append(row)
363 self.calcwidths()
371 self.calcwidths()
364
372
365 # Make sure that the cursor didn't leave the data area horizontally
373 # Make sure that the cursor didn't leave the data area horizontally
366 if x < 0:
374 if x < 0:
367 x = 0
375 x = 0
368 elif x >= self.datasizex:
376 elif x >= self.datasizex:
369 x = max(0, self.datasizex-1)
377 x = max(0, self.datasizex-1)
370
378
371 # Make sure that the cursor stays on screen horizontally
379 # Make sure that the cursor stays on screen horizontally
372 if x < self.datastartx+scrollborderx:
380 if x < self.datastartx+scrollborderx:
373 self.datastartx = max(0, x-scrollborderx)
381 self.datastartx = max(0, x-scrollborderx)
374 elif x >= self.datastartx+self.mainsizex-scrollborderx:
382 elif x >= self.datastartx+self.mainsizex-scrollborderx:
375 self.datastartx = max(0, min(x-self.mainsizex+scrollborderx+1,
383 self.datastartx = max(0, min(x-self.mainsizex+scrollborderx+1,
376 self.datasizex-self.mainsizex))
384 self.datasizex-self.mainsizex))
377
385
378 if x == oldx and y == oldy and (x != newx or y != newy): # couldn't move
386 if x == oldx and y == oldy and (x != newx or y != newy): # couldn't move
379 self.browser.beep()
387 self.browser.beep()
380 else:
388 else:
381 self.curx = x
389 self.curx = x
382 self.cury = y
390 self.cury = y
383 self.calcdisplayattr()
391 self.calcdisplayattr()
384
392
385 def sort(self, key, reverse=False):
393 def sort(self, key, reverse=False):
386 """
394 """
387 Sort the currently list of items using the key function ``key``. If
395 Sort the currently list of items using the key function ``key``. If
388 ``reverse`` is true the sort order is reversed.
396 ``reverse`` is true the sort order is reversed.
389 """
397 """
390 curitem = self.items[self.cury] # Remember where the cursor is now
398 curitem = self.items[self.cury] # Remember where the cursor is now
391
399
392 # Sort items
400 # Sort items
393 def realkey(item):
401 def realkey(item):
394 return key(item.item)
402 return key(item.item)
395 self.items = ipipe.deque(sorted(self.items, key=realkey, reverse=reverse))
403 self.items = ipipe.deque(sorted(self.items, key=realkey, reverse=reverse))
396
404
397 # Find out where the object under the cursor went
405 # Find out where the object under the cursor went
398 cury = self.cury
406 cury = self.cury
399 for (i, item) in enumerate(self.items):
407 for (i, item) in enumerate(self.items):
400 if item is curitem:
408 if item is curitem:
401 cury = i
409 cury = i
402 break
410 break
403
411
404 self.moveto(self.curx, cury, refresh=True)
412 self.moveto(self.curx, cury, refresh=True)
405
413
406
414
407 class _CommandInput(object):
415 class _CommandInput(object):
408 keymap = Keymap()
416 keymap = Keymap()
409 keymap.register("left", curses.KEY_LEFT)
417 keymap.register("left", curses.KEY_LEFT)
410 keymap.register("right", curses.KEY_RIGHT)
418 keymap.register("right", curses.KEY_RIGHT)
411 keymap.register("home", curses.KEY_HOME, "\x01") # Ctrl-A
419 keymap.register("home", curses.KEY_HOME, "\x01") # Ctrl-A
412 keymap.register("end", curses.KEY_END, "\x05") # Ctrl-E
420 keymap.register("end", curses.KEY_END, "\x05") # Ctrl-E
413 # FIXME: What's happening here?
421 # FIXME: What's happening here?
414 keymap.register("backspace", curses.KEY_BACKSPACE, "\x08\x7f")
422 keymap.register("backspace", curses.KEY_BACKSPACE, "\x08\x7f")
415 keymap.register("delete", curses.KEY_DC)
423 keymap.register("delete", curses.KEY_DC)
416 keymap.register("delend", 0x0b) # Ctrl-K
424 keymap.register("delend", 0x0b) # Ctrl-K
417 keymap.register("execute", "\r\n")
425 keymap.register("execute", "\r\n")
418 keymap.register("up", curses.KEY_UP)
426 keymap.register("up", curses.KEY_UP)
419 keymap.register("down", curses.KEY_DOWN)
427 keymap.register("down", curses.KEY_DOWN)
420 keymap.register("incsearchup", curses.KEY_PPAGE)
428 keymap.register("incsearchup", curses.KEY_PPAGE)
421 keymap.register("incsearchdown", curses.KEY_NPAGE)
429 keymap.register("incsearchdown", curses.KEY_NPAGE)
422 keymap.register("exit", "\x18"), # Ctrl-X
430 keymap.register("exit", "\x18"), # Ctrl-X
423
431
424 def __init__(self, prompt):
432 def __init__(self, prompt):
425 self.prompt = prompt
433 self.prompt = prompt
426 self.history = []
434 self.history = []
427 self.maxhistory = 100
435 self.maxhistory = 100
428 self.input = ""
436 self.input = ""
429 self.curx = 0
437 self.curx = 0
430 self.cury = -1 # blank line
438 self.cury = -1 # blank line
431
439
432 def start(self):
440 def start(self):
433 self.input = ""
441 self.input = ""
434 self.curx = 0
442 self.curx = 0
435 self.cury = -1 # blank line
443 self.cury = -1 # blank line
436
444
437 def handlekey(self, browser, key):
445 def handlekey(self, browser, key):
438 cmdname = self.keymap.get(key, None)
446 cmdname = self.keymap.get(key, None)
439 if cmdname is not None:
447 if cmdname is not None:
440 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
448 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
441 if cmdfunc is not None:
449 if cmdfunc is not None:
442 return cmdfunc(browser)
450 return cmdfunc(browser)
443 curses.beep()
451 curses.beep()
444 elif key != -1:
452 elif key != -1:
445 try:
453 try:
446 char = chr(key)
454 char = chr(key)
447 except ValueError:
455 except ValueError:
448 curses.beep()
456 curses.beep()
449 else:
457 else:
450 return self.handlechar(browser, char)
458 return self.handlechar(browser, char)
451
459
452 def handlechar(self, browser, char):
460 def handlechar(self, browser, char):
453 self.input = self.input[:self.curx] + char + self.input[self.curx:]
461 self.input = self.input[:self.curx] + char + self.input[self.curx:]
454 self.curx += 1
462 self.curx += 1
455 return True
463 return True
456
464
457 def dohistory(self):
465 def dohistory(self):
458 self.history.insert(0, self.input)
466 self.history.insert(0, self.input)
459 del self.history[:-self.maxhistory]
467 del self.history[:-self.maxhistory]
460
468
461 def cmd_backspace(self, browser):
469 def cmd_backspace(self, browser):
462 if self.curx:
470 if self.curx:
463 self.input = self.input[:self.curx-1] + self.input[self.curx:]
471 self.input = self.input[:self.curx-1] + self.input[self.curx:]
464 self.curx -= 1
472 self.curx -= 1
465 return True
473 return True
466 else:
474 else:
467 curses.beep()
475 curses.beep()
468
476
469 def cmd_delete(self, browser):
477 def cmd_delete(self, browser):
470 if self.curx<len(self.input):
478 if self.curx<len(self.input):
471 self.input = self.input[:self.curx] + self.input[self.curx+1:]
479 self.input = self.input[:self.curx] + self.input[self.curx+1:]
472 return True
480 return True
473 else:
481 else:
474 curses.beep()
482 curses.beep()
475
483
476 def cmd_delend(self, browser):
484 def cmd_delend(self, browser):
477 if self.curx<len(self.input):
485 if self.curx<len(self.input):
478 self.input = self.input[:self.curx]
486 self.input = self.input[:self.curx]
479 return True
487 return True
480
488
481 def cmd_left(self, browser):
489 def cmd_left(self, browser):
482 if self.curx:
490 if self.curx:
483 self.curx -= 1
491 self.curx -= 1
484 return True
492 return True
485 else:
493 else:
486 curses.beep()
494 curses.beep()
487
495
488 def cmd_right(self, browser):
496 def cmd_right(self, browser):
489 if self.curx < len(self.input):
497 if self.curx < len(self.input):
490 self.curx += 1
498 self.curx += 1
491 return True
499 return True
492 else:
500 else:
493 curses.beep()
501 curses.beep()
494
502
495 def cmd_home(self, browser):
503 def cmd_home(self, browser):
496 if self.curx:
504 if self.curx:
497 self.curx = 0
505 self.curx = 0
498 return True
506 return True
499 else:
507 else:
500 curses.beep()
508 curses.beep()
501
509
502 def cmd_end(self, browser):
510 def cmd_end(self, browser):
503 if self.curx < len(self.input):
511 if self.curx < len(self.input):
504 self.curx = len(self.input)
512 self.curx = len(self.input)
505 return True
513 return True
506 else:
514 else:
507 curses.beep()
515 curses.beep()
508
516
509 def cmd_up(self, browser):
517 def cmd_up(self, browser):
510 if self.cury < len(self.history)-1:
518 if self.cury < len(self.history)-1:
511 self.cury += 1
519 self.cury += 1
512 self.input = self.history[self.cury]
520 self.input = self.history[self.cury]
513 self.curx = len(self.input)
521 self.curx = len(self.input)
514 return True
522 return True
515 else:
523 else:
516 curses.beep()
524 curses.beep()
517
525
518 def cmd_down(self, browser):
526 def cmd_down(self, browser):
519 if self.cury >= 0:
527 if self.cury >= 0:
520 self.cury -= 1
528 self.cury -= 1
521 if self.cury>=0:
529 if self.cury>=0:
522 self.input = self.history[self.cury]
530 self.input = self.history[self.cury]
523 else:
531 else:
524 self.input = ""
532 self.input = ""
525 self.curx = len(self.input)
533 self.curx = len(self.input)
526 return True
534 return True
527 else:
535 else:
528 curses.beep()
536 curses.beep()
529
537
530 def cmd_incsearchup(self, browser):
538 def cmd_incsearchup(self, browser):
531 prefix = self.input[:self.curx]
539 prefix = self.input[:self.curx]
532 cury = self.cury
540 cury = self.cury
533 while True:
541 while True:
534 cury += 1
542 cury += 1
535 if cury >= len(self.history):
543 if cury >= len(self.history):
536 break
544 break
537 if self.history[cury].startswith(prefix):
545 if self.history[cury].startswith(prefix):
538 self.input = self.history[cury]
546 self.input = self.history[cury]
539 self.cury = cury
547 self.cury = cury
540 return True
548 return True
541 curses.beep()
549 curses.beep()
542
550
543 def cmd_incsearchdown(self, browser):
551 def cmd_incsearchdown(self, browser):
544 prefix = self.input[:self.curx]
552 prefix = self.input[:self.curx]
545 cury = self.cury
553 cury = self.cury
546 while True:
554 while True:
547 cury -= 1
555 cury -= 1
548 if cury <= 0:
556 if cury <= 0:
549 break
557 break
550 if self.history[cury].startswith(prefix):
558 if self.history[cury].startswith(prefix):
551 self.input = self.history[self.cury]
559 self.input = self.history[self.cury]
552 self.cury = cury
560 self.cury = cury
553 return True
561 return True
554 curses.beep()
562 curses.beep()
555
563
556 def cmd_exit(self, browser):
564 def cmd_exit(self, browser):
557 browser.mode = "default"
565 browser.mode = "default"
558 return True
566 return True
559
567
560 def cmd_execute(self, browser):
568 def cmd_execute(self, browser):
561 raise NotImplementedError
569 raise NotImplementedError
562
570
563
571
564 class _CommandGoto(_CommandInput):
572 class _CommandGoto(_CommandInput):
565 def __init__(self):
573 def __init__(self):
566 _CommandInput.__init__(self, "goto object #")
574 _CommandInput.__init__(self, "goto object #")
567
575
568 def handlechar(self, browser, char):
576 def handlechar(self, browser, char):
569 # Only accept digits
577 # Only accept digits
570 if not "0" <= char <= "9":
578 if not "0" <= char <= "9":
571 curses.beep()
579 curses.beep()
572 else:
580 else:
573 return _CommandInput.handlechar(self, browser, char)
581 return _CommandInput.handlechar(self, browser, char)
574
582
575 def cmd_execute(self, browser):
583 def cmd_execute(self, browser):
576 level = browser.levels[-1]
584 level = browser.levels[-1]
577 if self.input:
585 if self.input:
578 self.dohistory()
586 self.dohistory()
579 level.moveto(level.curx, int(self.input))
587 level.moveto(level.curx, int(self.input))
580 browser.mode = "default"
588 browser.mode = "default"
581 return True
589 return True
582
590
583
591
584 class _CommandFind(_CommandInput):
592 class _CommandFind(_CommandInput):
585 def __init__(self):
593 def __init__(self):
586 _CommandInput.__init__(self, "find expression")
594 _CommandInput.__init__(self, "find expression")
587
595
588 def cmd_execute(self, browser):
596 def cmd_execute(self, browser):
589 level = browser.levels[-1]
597 level = browser.levels[-1]
590 if self.input:
598 if self.input:
591 self.dohistory()
599 self.dohistory()
592 while True:
600 while True:
593 cury = level.cury
601 cury = level.cury
594 level.moveto(level.curx, cury+1)
602 level.moveto(level.curx, cury+1)
595 if cury == level.cury:
603 if cury == level.cury:
596 curses.beep()
604 curses.beep()
597 break # hit end
605 break # hit end
598 item = level.items[level.cury].item
606 item = level.items[level.cury].item
599 try:
607 try:
600 globals = ipipe.getglobals(None)
608 globals = ipipe.getglobals(None)
601 if eval(self.input, globals, ipipe.AttrNamespace(item)):
609 if eval(self.input, globals, ipipe.AttrNamespace(item)):
602 break # found something
610 break # found something
603 except (KeyboardInterrupt, SystemExit):
611 except (KeyboardInterrupt, SystemExit):
604 raise
612 raise
605 except Exception, exc:
613 except Exception, exc:
606 browser.report(exc)
614 browser.report(exc)
607 curses.beep()
615 curses.beep()
608 break # break on error
616 break # break on error
609 browser.mode = "default"
617 browser.mode = "default"
610 return True
618 return True
611
619
612
620
613 class _CommandFindBackwards(_CommandInput):
621 class _CommandFindBackwards(_CommandInput):
614 def __init__(self):
622 def __init__(self):
615 _CommandInput.__init__(self, "find backwards expression")
623 _CommandInput.__init__(self, "find backwards expression")
616
624
617 def cmd_execute(self, browser):
625 def cmd_execute(self, browser):
618 level = browser.levels[-1]
626 level = browser.levels[-1]
619 if self.input:
627 if self.input:
620 self.dohistory()
628 self.dohistory()
621 while level.cury:
629 while level.cury:
622 level.moveto(level.curx, level.cury-1)
630 level.moveto(level.curx, level.cury-1)
623 item = level.items[level.cury].item
631 item = level.items[level.cury].item
624 try:
632 try:
625 globals = ipipe.getglobals(None)
633 globals = ipipe.getglobals(None)
626 if eval(self.input, globals, ipipe.AttrNamespace(item)):
634 if eval(self.input, globals, ipipe.AttrNamespace(item)):
627 break # found something
635 break # found something
628 except (KeyboardInterrupt, SystemExit):
636 except (KeyboardInterrupt, SystemExit):
629 raise
637 raise
630 except Exception, exc:
638 except Exception, exc:
631 browser.report(exc)
639 browser.report(exc)
632 curses.beep()
640 curses.beep()
633 break # break on error
641 break # break on error
634 else:
642 else:
635 curses.beep()
643 curses.beep()
636 browser.mode = "default"
644 browser.mode = "default"
637 return True
645 return True
638
646
639
647
640 class ibrowse(ipipe.Display):
648 class ibrowse(ipipe.Display):
641 # Show this many lines from the previous screen when paging horizontally
649 # Show this many lines from the previous screen when paging horizontally
642 pageoverlapx = 1
650 pageoverlapx = 1
643
651
644 # Show this many lines from the previous screen when paging vertically
652 # Show this many lines from the previous screen when paging vertically
645 pageoverlapy = 1
653 pageoverlapy = 1
646
654
647 # Start scrolling when the cursor is less than this number of columns
655 # Start scrolling when the cursor is less than this number of columns
648 # away from the left or right screen edge
656 # away from the left or right screen edge
649 scrollborderx = 10
657 scrollborderx = 10
650
658
651 # Start scrolling when the cursor is less than this number of lines
659 # Start scrolling when the cursor is less than this number of lines
652 # away from the top or bottom screen edge
660 # away from the top or bottom screen edge
653 scrollbordery = 5
661 scrollbordery = 5
654
662
655 # Accelerate by this factor when scrolling horizontally
663 # Accelerate by this factor when scrolling horizontally
656 acceleratex = 1.05
664 acceleratex = 1.05
657
665
658 # Accelerate by this factor when scrolling vertically
666 # Accelerate by this factor when scrolling vertically
659 acceleratey = 1.05
667 acceleratey = 1.05
660
668
661 # The maximum horizontal scroll speed
669 # The maximum horizontal scroll speed
662 # (as a factor of the screen width (i.e. 0.5 == half a screen width)
670 # (as a factor of the screen width (i.e. 0.5 == half a screen width)
663 maxspeedx = 0.5
671 maxspeedx = 0.5
664
672
665 # The maximum vertical scroll speed
673 # The maximum vertical scroll speed
666 # (as a factor of the screen height (i.e. 0.5 == half a screen height)
674 # (as a factor of the screen height (i.e. 0.5 == half a screen height)
667 maxspeedy = 0.5
675 maxspeedy = 0.5
668
676
669 # The maximum number of header lines for browser level
677 # The maximum number of header lines for browser level
670 # if the nesting is deeper, only the innermost levels are displayed
678 # if the nesting is deeper, only the innermost levels are displayed
671 maxheaders = 5
679 maxheaders = 5
672
680
673 # The approximate maximum length of a column entry
681 # The approximate maximum length of a column entry
674 maxattrlength = 200
682 maxattrlength = 200
675
683
676 # Styles for various parts of the GUI
684 # Styles for various parts of the GUI
677 style_objheadertext = astyle.Style.fromstr("white:black:bold|reverse")
685 style_objheadertext = astyle.Style.fromstr("white:black:bold|reverse")
678 style_objheadernumber = astyle.Style.fromstr("white:blue:bold|reverse")
686 style_objheadernumber = astyle.Style.fromstr("white:blue:bold|reverse")
679 style_objheaderobject = astyle.Style.fromstr("white:black:reverse")
687 style_objheaderobject = astyle.Style.fromstr("white:black:reverse")
680 style_colheader = astyle.Style.fromstr("blue:white:reverse")
688 style_colheader = astyle.Style.fromstr("blue:white:reverse")
681 style_colheaderhere = astyle.Style.fromstr("green:black:bold|reverse")
689 style_colheaderhere = astyle.Style.fromstr("green:black:bold|reverse")
682 style_colheadersep = astyle.Style.fromstr("blue:black:reverse")
690 style_colheadersep = astyle.Style.fromstr("blue:black:reverse")
683 style_number = astyle.Style.fromstr("blue:white:reverse")
691 style_number = astyle.Style.fromstr("blue:white:reverse")
684 style_numberhere = astyle.Style.fromstr("green:black:bold|reverse")
692 style_numberhere = astyle.Style.fromstr("green:black:bold|reverse")
685 style_sep = astyle.Style.fromstr("blue:black")
693 style_sep = astyle.Style.fromstr("blue:black")
686 style_data = astyle.Style.fromstr("white:black")
694 style_data = astyle.Style.fromstr("white:black")
687 style_datapad = astyle.Style.fromstr("blue:black:bold")
695 style_datapad = astyle.Style.fromstr("blue:black:bold")
688 style_footer = astyle.Style.fromstr("black:white")
696 style_footer = astyle.Style.fromstr("black:white")
689 style_report = astyle.Style.fromstr("white:black")
697 style_report = astyle.Style.fromstr("white:black")
690
698
691 # Column separator in header
699 # Column separator in header
692 headersepchar = "|"
700 headersepchar = "|"
693
701
694 # Character for padding data cell entries
702 # Character for padding data cell entries
695 datapadchar = "."
703 datapadchar = "."
696
704
697 # Column separator in data area
705 # Column separator in data area
698 datasepchar = "|"
706 datasepchar = "|"
699
707
700 # Character to use for "empty" cell (i.e. for non-existing attributes)
708 # Character to use for "empty" cell (i.e. for non-existing attributes)
701 nodatachar = "-"
709 nodatachar = "-"
702
710
703 # Prompts for modes that require keyboard input
711 # Prompts for modes that require keyboard input
704 prompts = {
712 prompts = {
705 "goto": _CommandGoto(),
713 "goto": _CommandGoto(),
706 "find": _CommandFind(),
714 "find": _CommandFind(),
707 "findbackwards": _CommandFindBackwards()
715 "findbackwards": _CommandFindBackwards()
708 }
716 }
709
717
710 # Maps curses key codes to "function" names
718 # Maps curses key codes to "function" names
711 keymap = Keymap()
719 keymap = Keymap()
712 keymap.register("quit", "q")
720 keymap.register("quit", "q")
713 keymap.register("up", curses.KEY_UP)
721 keymap.register("up", curses.KEY_UP)
714 keymap.register("down", curses.KEY_DOWN)
722 keymap.register("down", curses.KEY_DOWN)
715 keymap.register("pageup", curses.KEY_PPAGE)
723 keymap.register("pageup", curses.KEY_PPAGE)
716 keymap.register("pagedown", curses.KEY_NPAGE)
724 keymap.register("pagedown", curses.KEY_NPAGE)
717 keymap.register("left", curses.KEY_LEFT)
725 keymap.register("left", curses.KEY_LEFT)
718 keymap.register("right", curses.KEY_RIGHT)
726 keymap.register("right", curses.KEY_RIGHT)
719 keymap.register("home", curses.KEY_HOME, "\x01")
727 keymap.register("home", curses.KEY_HOME, "\x01")
720 keymap.register("end", curses.KEY_END, "\x05")
728 keymap.register("end", curses.KEY_END, "\x05")
721 keymap.register("prevattr", "<\x1b")
729 keymap.register("prevattr", "<\x1b")
722 keymap.register("nextattr", ">\t")
730 keymap.register("nextattr", ">\t")
723 keymap.register("pick", "p")
731 keymap.register("pick", "p")
724 keymap.register("pickattr", "P")
732 keymap.register("pickattr", "P")
725 keymap.register("pickallattrs", "C")
733 keymap.register("pickallattrs", "C")
726 keymap.register("pickmarked", "m")
734 keymap.register("pickmarked", "m")
727 keymap.register("pickmarkedattr", "M")
735 keymap.register("pickmarkedattr", "M")
728 keymap.register("enterdefault", "\r\n")
736 keymap.register("enterdefault", "\r\n")
729 # FIXME: What's happening here?
737 # FIXME: What's happening here?
730 keymap.register("leave", curses.KEY_BACKSPACE, "x\x08\x7f")
738 keymap.register("leave", curses.KEY_BACKSPACE, "x\x08\x7f")
731 keymap.register("hideattr", "h")
739 keymap.register("hideattr", "h")
732 keymap.register("unhideattrs", "H")
740 keymap.register("unhideattrs", "H")
733 keymap.register("help", "?")
741 keymap.register("help", "?")
734 keymap.register("enter", "e")
742 keymap.register("enter", "e")
735 keymap.register("enterattr", "E")
743 keymap.register("enterattr", "E")
736 keymap.register("detail", "d")
744 keymap.register("detail", "d")
737 keymap.register("detailattr", "D")
745 keymap.register("detailattr", "D")
738 keymap.register("tooglemark", " ")
746 keymap.register("tooglemark", " ")
739 keymap.register("markrange", "r")
747 keymap.register("markrange", "r")
740 keymap.register("sortattrasc", "v")
748 keymap.register("sortattrasc", "v")
741 keymap.register("sortattrdesc", "V")
749 keymap.register("sortattrdesc", "V")
742 keymap.register("goto", "g")
750 keymap.register("goto", "g")
743 keymap.register("find", "f")
751 keymap.register("find", "f")
744 keymap.register("findbackwards", "b")
752 keymap.register("findbackwards", "b")
745
753
746 def __init__(self, *attrs):
754 def __init__(self, *attrs):
747 """
755 """
748 Create a new browser. If ``attrs`` is not empty, it is the list
756 Create a new browser. If ``attrs`` is not empty, it is the list
749 of attributes that will be displayed in the browser, otherwise
757 of attributes that will be displayed in the browser, otherwise
750 these will be determined by the objects on screen.
758 these will be determined by the objects on screen.
751 """
759 """
752 self.attrs = attrs
760 self.attrs = attrs
753
761
754 # Stack of browser levels
762 # Stack of browser levels
755 self.levels = []
763 self.levels = []
756 # how many colums to scroll (Changes when accelerating)
764 # how many colums to scroll (Changes when accelerating)
757 self.stepx = 1.
765 self.stepx = 1.
758
766
759 # how many rows to scroll (Changes when accelerating)
767 # how many rows to scroll (Changes when accelerating)
760 self.stepy = 1.
768 self.stepy = 1.
761
769
762 # Beep on the edges of the data area? (Will be set to ``False``
770 # Beep on the edges of the data area? (Will be set to ``False``
763 # once the cursor hits the edge of the screen, so we don't get
771 # once the cursor hits the edge of the screen, so we don't get
764 # multiple beeps).
772 # multiple beeps).
765 self._dobeep = True
773 self._dobeep = True
766
774
767 # Cache for registered ``curses`` colors and styles.
775 # Cache for registered ``curses`` colors and styles.
768 self._styles = {}
776 self._styles = {}
769 self._colors = {}
777 self._colors = {}
770 self._maxcolor = 1
778 self._maxcolor = 1
771
779
772 # How many header lines do we want to paint (the numbers of levels
780 # How many header lines do we want to paint (the numbers of levels
773 # we have, but with an upper bound)
781 # we have, but with an upper bound)
774 self._headerlines = 1
782 self._headerlines = 1
775
783
776 # Index of first header line
784 # Index of first header line
777 self._firstheaderline = 0
785 self._firstheaderline = 0
778
786
779 # curses window
787 # curses window
780 self.scr = None
788 self.scr = None
781 # report in the footer line (error, executed command etc.)
789 # report in the footer line (error, executed command etc.)
782 self._report = None
790 self._report = None
783
791
784 # value to be returned to the caller (set by commands)
792 # value to be returned to the caller (set by commands)
785 self.returnvalue = None
793 self.returnvalue = None
786
794
787 # The mode the browser is in
795 # The mode the browser is in
788 # e.g. normal browsing or entering an argument for a command
796 # e.g. normal browsing or entering an argument for a command
789 self.mode = "default"
797 self.mode = "default"
790
798
791 # set by the SIGWINCH signal handler
799 # set by the SIGWINCH signal handler
792 self.resized = False
800 self.resized = False
793
801
794 def nextstepx(self, step):
802 def nextstepx(self, step):
795 """
803 """
796 Accelerate horizontally.
804 Accelerate horizontally.
797 """
805 """
798 return max(1., min(step*self.acceleratex,
806 return max(1., min(step*self.acceleratex,
799 self.maxspeedx*self.levels[-1].mainsizex))
807 self.maxspeedx*self.levels[-1].mainsizex))
800
808
801 def nextstepy(self, step):
809 def nextstepy(self, step):
802 """
810 """
803 Accelerate vertically.
811 Accelerate vertically.
804 """
812 """
805 return max(1., min(step*self.acceleratey,
813 return max(1., min(step*self.acceleratey,
806 self.maxspeedy*self.levels[-1].mainsizey))
814 self.maxspeedy*self.levels[-1].mainsizey))
807
815
808 def getstyle(self, style):
816 def getstyle(self, style):
809 """
817 """
810 Register the ``style`` with ``curses`` or get it from the cache,
818 Register the ``style`` with ``curses`` or get it from the cache,
811 if it has been registered before.
819 if it has been registered before.
812 """
820 """
813 try:
821 try:
814 return self._styles[style.fg, style.bg, style.attrs]
822 return self._styles[style.fg, style.bg, style.attrs]
815 except KeyError:
823 except KeyError:
816 attrs = 0
824 attrs = 0
817 for b in astyle.A2CURSES:
825 for b in astyle.A2CURSES:
818 if style.attrs & b:
826 if style.attrs & b:
819 attrs |= astyle.A2CURSES[b]
827 attrs |= astyle.A2CURSES[b]
820 try:
828 try:
821 color = self._colors[style.fg, style.bg]
829 color = self._colors[style.fg, style.bg]
822 except KeyError:
830 except KeyError:
823 curses.init_pair(
831 curses.init_pair(
824 self._maxcolor,
832 self._maxcolor,
825 astyle.COLOR2CURSES[style.fg],
833 astyle.COLOR2CURSES[style.fg],
826 astyle.COLOR2CURSES[style.bg]
834 astyle.COLOR2CURSES[style.bg]
827 )
835 )
828 color = curses.color_pair(self._maxcolor)
836 color = curses.color_pair(self._maxcolor)
829 self._colors[style.fg, style.bg] = color
837 self._colors[style.fg, style.bg] = color
830 self._maxcolor += 1
838 self._maxcolor += 1
831 c = color | attrs
839 c = color | attrs
832 self._styles[style.fg, style.bg, style.attrs] = c
840 self._styles[style.fg, style.bg, style.attrs] = c
833 return c
841 return c
834
842
835 def addstr(self, y, x, begx, endx, text, style):
843 def addstr(self, y, x, begx, endx, text, style):
836 """
844 """
837 A version of ``curses.addstr()`` that can handle ``x`` coordinates
845 A version of ``curses.addstr()`` that can handle ``x`` coordinates
838 that are outside the screen.
846 that are outside the screen.
839 """
847 """
840 text2 = text[max(0, begx-x):max(0, endx-x)]
848 text2 = text[max(0, begx-x):max(0, endx-x)]
841 if text2:
849 if text2:
842 self.scr.addstr(y, max(x, begx), text2, self.getstyle(style))
850 self.scr.addstr(y, max(x, begx), text2, self.getstyle(style))
843 return len(text)
851 return len(text)
844
852
845 def addchr(self, y, x, begx, endx, c, l, style):
853 def addchr(self, y, x, begx, endx, c, l, style):
846 x0 = max(x, begx)
854 x0 = max(x, begx)
847 x1 = min(x+l, endx)
855 x1 = min(x+l, endx)
848 if x1>x0:
856 if x1>x0:
849 self.scr.addstr(y, x0, c*(x1-x0), self.getstyle(style))
857 self.scr.addstr(y, x0, c*(x1-x0), self.getstyle(style))
850 return l
858 return l
851
859
852 def _calcheaderlines(self, levels):
860 def _calcheaderlines(self, levels):
853 # Calculate how many headerlines do we have to display, if we have
861 # Calculate how many headerlines do we have to display, if we have
854 # ``levels`` browser levels
862 # ``levels`` browser levels
855 if levels is None:
863 if levels is None:
856 levels = len(self.levels)
864 levels = len(self.levels)
857 self._headerlines = min(self.maxheaders, levels)
865 self._headerlines = min(self.maxheaders, levels)
858 self._firstheaderline = levels-self._headerlines
866 self._firstheaderline = levels-self._headerlines
859
867
860 def getstylehere(self, style):
868 def getstylehere(self, style):
861 """
869 """
862 Return a style for displaying the original style ``style``
870 Return a style for displaying the original style ``style``
863 in the row the cursor is on.
871 in the row the cursor is on.
864 """
872 """
865 return astyle.Style(style.fg, astyle.COLOR_BLUE, style.attrs | astyle.A_BOLD)
873 return astyle.Style(style.fg, astyle.COLOR_BLUE, style.attrs | astyle.A_BOLD)
866
874
867 def report(self, msg):
875 def report(self, msg):
868 """
876 """
869 Store the message ``msg`` for display below the footer line. This
877 Store the message ``msg`` for display below the footer line. This
870 will be displayed as soon as the screen is redrawn.
878 will be displayed as soon as the screen is redrawn.
871 """
879 """
872 self._report = msg
880 self._report = msg
873
881
874 def enter(self, item, mode, *attrs):
882 def enter(self, item, mode, *attrs):
875 """
883 """
876 Enter the object ``item`` in the mode ``mode``. If ``attrs`` is
884 Enter the object ``item`` in the mode ``mode``. If ``attrs`` is
877 specified, it will be used as a fixed list of attributes to display.
885 specified, it will be used as a fixed list of attributes to display.
878 """
886 """
879 try:
887 try:
880 iterator = ipipe.xiter(item, mode)
888 iterator = ipipe.xiter(item, mode)
881 except (KeyboardInterrupt, SystemExit):
889 except (KeyboardInterrupt, SystemExit):
882 raise
890 raise
883 except Exception, exc:
891 except Exception, exc:
884 curses.beep()
892 curses.beep()
885 self.report(exc)
893 self.report(exc)
886 else:
894 else:
887 self._calcheaderlines(len(self.levels)+1)
895 self._calcheaderlines(len(self.levels)+1)
888 level = _BrowserLevel(
896 level = _BrowserLevel(
889 self,
897 self,
890 item,
898 item,
891 iterator,
899 iterator,
892 self.scrsizey-1-self._headerlines-2,
900 self.scrsizey-1-self._headerlines-2,
893 *attrs
901 *attrs
894 )
902 )
895 self.levels.append(level)
903 self.levels.append(level)
896
904
897 def startkeyboardinput(self, mode):
905 def startkeyboardinput(self, mode):
898 """
906 """
899 Enter mode ``mode``, which requires keyboard input.
907 Enter mode ``mode``, which requires keyboard input.
900 """
908 """
901 self.mode = mode
909 self.mode = mode
902 self.prompts[mode].start()
910 self.prompts[mode].start()
903
911
904 def keylabel(self, keycode):
912 def keylabel(self, keycode):
905 """
913 """
906 Return a pretty name for the ``curses`` key ``keycode`` (used in the
914 Return a pretty name for the ``curses`` key ``keycode`` (used in the
907 help screen and in reports about unassigned keys).
915 help screen and in reports about unassigned keys).
908 """
916 """
909 if keycode <= 0xff:
917 if keycode <= 0xff:
910 specialsnames = {
918 specialsnames = {
911 ord("\n"): "RETURN",
919 ord("\n"): "RETURN",
912 ord(" "): "SPACE",
920 ord(" "): "SPACE",
913 ord("\t"): "TAB",
921 ord("\t"): "TAB",
914 ord("\x7f"): "DELETE",
922 ord("\x7f"): "DELETE",
915 ord("\x08"): "BACKSPACE",
923 ord("\x08"): "BACKSPACE",
916 }
924 }
917 if keycode in specialsnames:
925 if keycode in specialsnames:
918 return specialsnames[keycode]
926 return specialsnames[keycode]
919 elif 0x00 < keycode < 0x20:
927 elif 0x00 < keycode < 0x20:
920 return "CTRL-%s" % chr(keycode + 64)
928 return "CTRL-%s" % chr(keycode + 64)
921 return repr(chr(keycode))
929 return repr(chr(keycode))
922 for name in dir(curses):
930 for name in dir(curses):
923 if name.startswith("KEY_") and getattr(curses, name) == keycode:
931 if name.startswith("KEY_") and getattr(curses, name) == keycode:
924 return name
932 return name
925 return str(keycode)
933 return str(keycode)
926
934
927 def beep(self, force=False):
935 def beep(self, force=False):
928 if force or self._dobeep:
936 if force or self._dobeep:
929 curses.beep()
937 curses.beep()
930 # don't beep again (as long as the same key is pressed)
938 # don't beep again (as long as the same key is pressed)
931 self._dobeep = False
939 self._dobeep = False
932
940
933 def cmd_up(self):
941 def cmd_up(self):
934 """
942 """
935 Move the cursor to the previous row.
943 Move the cursor to the previous row.
936 """
944 """
937 level = self.levels[-1]
945 level = self.levels[-1]
938 self.report("up")
946 self.report("up")
939 level.moveto(level.curx, level.cury-self.stepy)
947 level.moveto(level.curx, level.cury-self.stepy)
940
948
941 def cmd_down(self):
949 def cmd_down(self):
942 """
950 """
943 Move the cursor to the next row.
951 Move the cursor to the next row.
944 """
952 """
945 level = self.levels[-1]
953 level = self.levels[-1]
946 self.report("down")
954 self.report("down")
947 level.moveto(level.curx, level.cury+self.stepy)
955 level.moveto(level.curx, level.cury+self.stepy)
948
956
949 def cmd_pageup(self):
957 def cmd_pageup(self):
950 """
958 """
951 Move the cursor up one page.
959 Move the cursor up one page.
952 """
960 """
953 level = self.levels[-1]
961 level = self.levels[-1]
954 self.report("page up")
962 self.report("page up")
955 level.moveto(level.curx, level.cury-level.mainsizey+self.pageoverlapy)
963 level.moveto(level.curx, level.cury-level.mainsizey+self.pageoverlapy)
956
964
957 def cmd_pagedown(self):
965 def cmd_pagedown(self):
958 """
966 """
959 Move the cursor down one page.
967 Move the cursor down one page.
960 """
968 """
961 level = self.levels[-1]
969 level = self.levels[-1]
962 self.report("page down")
970 self.report("page down")
963 level.moveto(level.curx, level.cury+level.mainsizey-self.pageoverlapy)
971 level.moveto(level.curx, level.cury+level.mainsizey-self.pageoverlapy)
964
972
965 def cmd_left(self):
973 def cmd_left(self):
966 """
974 """
967 Move the cursor left.
975 Move the cursor left.
968 """
976 """
969 level = self.levels[-1]
977 level = self.levels[-1]
970 self.report("left")
978 self.report("left")
971 level.moveto(level.curx-self.stepx, level.cury)
979 level.moveto(level.curx-self.stepx, level.cury)
972
980
973 def cmd_right(self):
981 def cmd_right(self):
974 """
982 """
975 Move the cursor right.
983 Move the cursor right.
976 """
984 """
977 level = self.levels[-1]
985 level = self.levels[-1]
978 self.report("right")
986 self.report("right")
979 level.moveto(level.curx+self.stepx, level.cury)
987 level.moveto(level.curx+self.stepx, level.cury)
980
988
981 def cmd_home(self):
989 def cmd_home(self):
982 """
990 """
983 Move the cursor to the first column.
991 Move the cursor to the first column.
984 """
992 """
985 level = self.levels[-1]
993 level = self.levels[-1]
986 self.report("home")
994 self.report("home")
987 level.moveto(0, level.cury)
995 level.moveto(0, level.cury)
988
996
989 def cmd_end(self):
997 def cmd_end(self):
990 """
998 """
991 Move the cursor to the last column.
999 Move the cursor to the last column.
992 """
1000 """
993 level = self.levels[-1]
1001 level = self.levels[-1]
994 self.report("end")
1002 self.report("end")
995 level.moveto(level.datasizex+level.mainsizey-self.pageoverlapx, level.cury)
1003 level.moveto(level.datasizex+level.mainsizey-self.pageoverlapx, level.cury)
996
1004
997 def cmd_prevattr(self):
1005 def cmd_prevattr(self):
998 """
1006 """
999 Move the cursor one attribute column to the left.
1007 Move the cursor one attribute column to the left.
1000 """
1008 """
1001 level = self.levels[-1]
1009 level = self.levels[-1]
1002 if level.displayattr[0] is None or level.displayattr[0] == 0:
1010 if level.displayattr[0] is None or level.displayattr[0] == 0:
1003 self.beep()
1011 self.beep()
1004 else:
1012 else:
1005 self.report("prevattr")
1013 self.report("prevattr")
1006 pos = 0
1014 pos = 0
1007 for (i, attrname) in enumerate(level.displayattrs):
1015 for (i, attrname) in enumerate(level.displayattrs):
1008 if i == level.displayattr[0]-1:
1016 if i == level.displayattr[0]-1:
1009 break
1017 break
1010 pos += level.colwidths[attrname] + 1
1018 pos += level.colwidths[attrname] + 1
1011 level.moveto(pos, level.cury)
1019 level.moveto(pos, level.cury)
1012
1020
1013 def cmd_nextattr(self):
1021 def cmd_nextattr(self):
1014 """
1022 """
1015 Move the cursor one attribute column to the right.
1023 Move the cursor one attribute column to the right.
1016 """
1024 """
1017 level = self.levels[-1]
1025 level = self.levels[-1]
1018 if level.displayattr[0] is None or level.displayattr[0] == len(level.displayattrs)-1:
1026 if level.displayattr[0] is None or level.displayattr[0] == len(level.displayattrs)-1:
1019 self.beep()
1027 self.beep()
1020 else:
1028 else:
1021 self.report("nextattr")
1029 self.report("nextattr")
1022 pos = 0
1030 pos = 0
1023 for (i, attrname) in enumerate(level.displayattrs):
1031 for (i, attrname) in enumerate(level.displayattrs):
1024 if i == level.displayattr[0]+1:
1032 if i == level.displayattr[0]+1:
1025 break
1033 break
1026 pos += level.colwidths[attrname] + 1
1034 pos += level.colwidths[attrname] + 1
1027 level.moveto(pos, level.cury)
1035 level.moveto(pos, level.cury)
1028
1036
1029 def cmd_pick(self):
1037 def cmd_pick(self):
1030 """
1038 """
1031 'Pick' the object under the cursor (i.e. the row the cursor is on).
1039 'Pick' the object under the cursor (i.e. the row the cursor is on).
1032 This leaves the browser and returns the picked object to the caller.
1040 This leaves the browser and returns the picked object to the caller.
1033 (In IPython this object will be available as the '_' variable.)
1041 (In IPython this object will be available as the ``_`` variable.)
1034 """
1042 """
1035 level = self.levels[-1]
1043 level = self.levels[-1]
1036 self.returnvalue = level.items[level.cury].item
1044 self.returnvalue = level.items[level.cury].item
1037 return True
1045 return True
1038
1046
1039 def cmd_pickattr(self):
1047 def cmd_pickattr(self):
1040 """
1048 """
1041 'Pick' the attribute under the cursor (i.e. the row/column the
1049 'Pick' the attribute under the cursor (i.e. the row/column the
1042 cursor is on).
1050 cursor is on).
1043 """
1051 """
1044 level = self.levels[-1]
1052 level = self.levels[-1]
1045 attrname = level.displayattr[1]
1053 attr = level.displayattr[1]
1046 if attrname is ipipe.noitem:
1054 if attr is ipipe.noitem:
1047 curses.beep()
1055 curses.beep()
1048 self.report(AttributeError(ipipe._attrname(attrname)))
1056 self.report(CommandError("no column under cursor"))
1049 return
1057 return
1050 attr = ipipe._getattr(level.items[level.cury].item, attrname)
1058 value = attr.value(level.items[level.cury].item)
1051 if attr is ipipe.noitem:
1059 if value is ipipe.noitem:
1052 curses.beep()
1060 curses.beep()
1053 self.report(AttributeError(ipipe._attrname(attrname)))
1061 self.report(AttributeError(attr.name()))
1054 else:
1062 else:
1055 self.returnvalue = attr
1063 self.returnvalue = value
1056 return True
1064 return True
1057
1065
1058 def cmd_pickallattrs(self):
1066 def cmd_pickallattrs(self):
1059 """
1067 """
1060 Pick' the complete column under the cursor (i.e. the attribute under
1068 Pick' the complete column under the cursor (i.e. the attribute under
1061 the cursor) from all currently fetched objects. These attributes
1069 the cursor) from all currently fetched objects. These attributes
1062 will be returned as a list.
1070 will be returned as a list.
1063 """
1071 """
1064 level = self.levels[-1]
1072 level = self.levels[-1]
1065 attrname = level.displayattr[1]
1073 attr = level.displayattr[1]
1066 if attrname is ipipe.noitem:
1074 if attr is ipipe.noitem:
1067 curses.beep()
1075 curses.beep()
1068 self.report(AttributeError(ipipe._attrname(attrname)))
1076 self.report(CommandError("no column under cursor"))
1069 return
1077 return
1070 result = []
1078 result = []
1071 for cache in level.items:
1079 for cache in level.items:
1072 attr = ipipe._getattr(cache.item, attrname)
1080 value = attr.value(cache.item)
1073 if attr is not ipipe.noitem:
1081 if value is not ipipe.noitem:
1074 result.append(attr)
1082 result.append(value)
1075 self.returnvalue = result
1083 self.returnvalue = result
1076 return True
1084 return True
1077
1085
1078 def cmd_pickmarked(self):
1086 def cmd_pickmarked(self):
1079 """
1087 """
1080 'Pick' marked objects. Marked objects will be returned as a list.
1088 'Pick' marked objects. Marked objects will be returned as a list.
1081 """
1089 """
1082 level = self.levels[-1]
1090 level = self.levels[-1]
1083 self.returnvalue = [cache.item for cache in level.items if cache.marked]
1091 self.returnvalue = [cache.item for cache in level.items if cache.marked]
1084 return True
1092 return True
1085
1093
1086 def cmd_pickmarkedattr(self):
1094 def cmd_pickmarkedattr(self):
1087 """
1095 """
1088 'Pick' the attribute under the cursor from all marked objects
1096 'Pick' the attribute under the cursor from all marked objects
1089 (This returns a list).
1097 (This returns a list).
1090 """
1098 """
1091
1099
1092 level = self.levels[-1]
1100 level = self.levels[-1]
1093 attrname = level.displayattr[1]
1101 attr = level.displayattr[1]
1094 if attrname is ipipe.noitem:
1102 if attr is ipipe.noitem:
1095 curses.beep()
1103 curses.beep()
1096 self.report(AttributeError(ipipe._attrname(attrname)))
1104 self.report(CommandError("no column under cursor"))
1097 return
1105 return
1098 result = []
1106 result = []
1099 for cache in level.items:
1107 for cache in level.items:
1100 if cache.marked:
1108 if cache.marked:
1101 attr = ipipe._getattr(cache.item, attrname)
1109 value = attr.value(cache.item)
1102 if attr is not ipipe.noitem:
1110 if value is not ipipe.noitem:
1103 result.append(attr)
1111 result.append(value)
1104 self.returnvalue = result
1112 self.returnvalue = result
1105 return True
1113 return True
1106
1114
1107 def cmd_markrange(self):
1115 def cmd_markrange(self):
1108 """
1116 """
1109 Mark all objects from the last marked object before the current cursor
1117 Mark all objects from the last marked object before the current cursor
1110 position to the cursor position.
1118 position to the cursor position.
1111 """
1119 """
1112 level = self.levels[-1]
1120 level = self.levels[-1]
1113 self.report("markrange")
1121 self.report("markrange")
1114 start = None
1122 start = None
1115 if level.items:
1123 if level.items:
1116 for i in xrange(level.cury, -1, -1):
1124 for i in xrange(level.cury, -1, -1):
1117 if level.items[i].marked:
1125 if level.items[i].marked:
1118 start = i
1126 start = i
1119 break
1127 break
1120 if start is None:
1128 if start is None:
1121 self.report(CommandError("no mark before cursor"))
1129 self.report(CommandError("no mark before cursor"))
1122 curses.beep()
1130 curses.beep()
1123 else:
1131 else:
1124 for i in xrange(start, level.cury+1):
1132 for i in xrange(start, level.cury+1):
1125 cache = level.items[i]
1133 cache = level.items[i]
1126 if not cache.marked:
1134 if not cache.marked:
1127 cache.marked = True
1135 cache.marked = True
1128 level.marked += 1
1136 level.marked += 1
1129
1137
1130 def cmd_enterdefault(self):
1138 def cmd_enterdefault(self):
1131 """
1139 """
1132 Enter the object under the cursor. (what this mean depends on the object
1140 Enter the object under the cursor. (what this mean depends on the object
1133 itself (i.e. how it implements the '__xiter__' method). This opens a new
1141 itself (i.e. how it implements the ``__xiter__`` method). This opens a new
1134 browser 'level'.
1142 browser 'level'.
1135 """
1143 """
1136 level = self.levels[-1]
1144 level = self.levels[-1]
1137 try:
1145 try:
1138 item = level.items[level.cury].item
1146 item = level.items[level.cury].item
1139 except IndexError:
1147 except IndexError:
1140 self.report(CommandError("No object"))
1148 self.report(CommandError("No object"))
1141 curses.beep()
1149 curses.beep()
1142 else:
1150 else:
1143 self.report("entering object (default mode)...")
1151 self.report("entering object (default mode)...")
1144 self.enter(item, "default")
1152 self.enter(item, "default")
1145
1153
1146 def cmd_leave(self):
1154 def cmd_leave(self):
1147 """
1155 """
1148 Leave the current browser level and go back to the previous one.
1156 Leave the current browser level and go back to the previous one.
1149 """
1157 """
1150 self.report("leave")
1158 self.report("leave")
1151 if len(self.levels) > 1:
1159 if len(self.levels) > 1:
1152 self._calcheaderlines(len(self.levels)-1)
1160 self._calcheaderlines(len(self.levels)-1)
1153 self.levels.pop(-1)
1161 self.levels.pop(-1)
1154 else:
1162 else:
1155 self.report(CommandError("This is the last level"))
1163 self.report(CommandError("This is the last level"))
1156 curses.beep()
1164 curses.beep()
1157
1165
1158 def cmd_enter(self):
1166 def cmd_enter(self):
1159 """
1167 """
1160 Enter the object under the cursor. If the object provides different
1168 Enter the object under the cursor. If the object provides different
1161 enter modes a menu of all modes will be presented; choose one and enter
1169 enter modes a menu of all modes will be presented; choose one and enter
1162 it (via the 'enter' or 'enterdefault' command).
1170 it (via the 'enter' or 'enterdefault' command).
1163 """
1171 """
1164 level = self.levels[-1]
1172 level = self.levels[-1]
1165 try:
1173 try:
1166 item = level.items[level.cury].item
1174 item = level.items[level.cury].item
1167 except IndexError:
1175 except IndexError:
1168 self.report(CommandError("No object"))
1176 self.report(CommandError("No object"))
1169 curses.beep()
1177 curses.beep()
1170 else:
1178 else:
1171 self.report("entering object...")
1179 self.report("entering object...")
1172 self.enter(item, None)
1180 self.enter(item, None)
1173
1181
1174 def cmd_enterattr(self):
1182 def cmd_enterattr(self):
1175 """
1183 """
1176 Enter the attribute under the cursor.
1184 Enter the attribute under the cursor.
1177 """
1185 """
1178 level = self.levels[-1]
1186 level = self.levels[-1]
1179 attrname = level.displayattr[1]
1187 attr = level.displayattr[1]
1180 if attrname is ipipe.noitem:
1188 if attr is ipipe.noitem:
1181 curses.beep()
1189 curses.beep()
1182 self.report(AttributeError(ipipe._attrname(attrname)))
1190 self.report(CommandError("no column under cursor"))
1183 return
1191 return
1184 try:
1192 try:
1185 item = level.items[level.cury].item
1193 item = level.items[level.cury].item
1186 except IndexError:
1194 except IndexError:
1187 self.report(CommandError("No object"))
1195 self.report(CommandError("No object"))
1188 curses.beep()
1196 curses.beep()
1189 else:
1197 else:
1190 attr = ipipe._getattr(item, attrname)
1198 value = attr.value(item)
1191 if attr is ipipe.noitem:
1199 name = attr.name()
1192 self.report(AttributeError(ipipe._attrname(attrname)))
1200 if value is ipipe.noitem:
1201 self.report(AttributeError(name))
1193 else:
1202 else:
1194 self.report("entering object attribute %s..." % ipipe._attrname(attrname))
1203 self.report("entering object attribute %s..." % name)
1195 self.enter(attr, None)
1204 self.enter(value, None)
1196
1205
1197 def cmd_detail(self):
1206 def cmd_detail(self):
1198 """
1207 """
1199 Show a detail view of the object under the cursor. This shows the
1208 Show a detail view of the object under the cursor. This shows the
1200 name, type, doc string and value of the object attributes (and it
1209 name, type, doc string and value of the object attributes (and it
1201 might show more attributes than in the list view, depending on
1210 might show more attributes than in the list view, depending on
1202 the object).
1211 the object).
1203 """
1212 """
1204 level = self.levels[-1]
1213 level = self.levels[-1]
1205 try:
1214 try:
1206 item = level.items[level.cury].item
1215 item = level.items[level.cury].item
1207 except IndexError:
1216 except IndexError:
1208 self.report(CommandError("No object"))
1217 self.report(CommandError("No object"))
1209 curses.beep()
1218 curses.beep()
1210 else:
1219 else:
1211 self.report("entering detail view for object...")
1220 self.report("entering detail view for object...")
1212 self.enter(item, "detail")
1221 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1222 self.enter(attrs, "detail")
1213
1223
1214 def cmd_detailattr(self):
1224 def cmd_detailattr(self):
1215 """
1225 """
1216 Show a detail view of the attribute under the cursor.
1226 Show a detail view of the attribute under the cursor.
1217 """
1227 """
1218 level = self.levels[-1]
1228 level = self.levels[-1]
1219 attrname = level.displayattr[1]
1229 attr = level.displayattr[1]
1220 if attrname is ipipe.noitem:
1230 if attr is ipipe.noitem:
1221 curses.beep()
1231 curses.beep()
1222 self.report(AttributeError(ipipe._attrname(attrname)))
1232 self.report(CommandError("no attribute"))
1223 return
1233 return
1224 try:
1234 try:
1225 item = level.items[level.cury].item
1235 item = level.items[level.cury].item
1226 except IndexError:
1236 except IndexError:
1227 self.report(CommandError("No object"))
1237 self.report(CommandError("No object"))
1228 curses.beep()
1238 curses.beep()
1229 else:
1239 else:
1230 attr = ipipe._getattr(item, attrname)
1240 try:
1231 if attr is ipipe.noitem:
1241 item = attr.value(item)
1232 self.report(AttributeError(ipipe._attrname(attrname)))
1242 except (KeyboardInterrupt, SystemExit):
1243 raise
1244 except Exception, exc:
1245 self.report(exc)
1233 else:
1246 else:
1234 self.report("entering detail view for attribute...")
1247 self.report("entering detail view for attribute %s..." % attr.name())
1235 self.enter(attr, "detail")
1248 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1249 self.enter(attrs, "detail")
1236
1250
1237 def cmd_tooglemark(self):
1251 def cmd_tooglemark(self):
1238 """
1252 """
1239 Mark/unmark the object under the cursor. Marked objects have a '!'
1253 Mark/unmark the object under the cursor. Marked objects have a '!'
1240 after the row number).
1254 after the row number).
1241 """
1255 """
1242 level = self.levels[-1]
1256 level = self.levels[-1]
1243 self.report("toggle mark")
1257 self.report("toggle mark")
1244 try:
1258 try:
1245 item = level.items[level.cury]
1259 item = level.items[level.cury]
1246 except IndexError: # no items?
1260 except IndexError: # no items?
1247 pass
1261 pass
1248 else:
1262 else:
1249 if item.marked:
1263 if item.marked:
1250 item.marked = False
1264 item.marked = False
1251 level.marked -= 1
1265 level.marked -= 1
1252 else:
1266 else:
1253 item.marked = True
1267 item.marked = True
1254 level.marked += 1
1268 level.marked += 1
1255
1269
1256 def cmd_sortattrasc(self):
1270 def cmd_sortattrasc(self):
1257 """
1271 """
1258 Sort the objects (in ascending order) using the attribute under
1272 Sort the objects (in ascending order) using the attribute under
1259 the cursor as the sort key.
1273 the cursor as the sort key.
1260 """
1274 """
1261 level = self.levels[-1]
1275 level = self.levels[-1]
1262 attrname = level.displayattr[1]
1276 attr = level.displayattr[1]
1263 if attrname is ipipe.noitem:
1277 if attr is ipipe.noitem:
1264 curses.beep()
1278 curses.beep()
1265 self.report(AttributeError(ipipe._attrname(attrname)))
1279 self.report(CommandError("no column under cursor"))
1266 return
1280 return
1267 self.report("sort by %s (ascending)" % ipipe._attrname(attrname))
1281 self.report("sort by %s (ascending)" % attr.name())
1268 def key(item):
1282 def key(item):
1269 try:
1283 try:
1270 return ipipe._getattr(item, attrname, None)
1284 return attr.value(item)
1271 except (KeyboardInterrupt, SystemExit):
1285 except (KeyboardInterrupt, SystemExit):
1272 raise
1286 raise
1273 except Exception:
1287 except Exception:
1274 return None
1288 return None
1275 level.sort(key)
1289 level.sort(key)
1276
1290
1277 def cmd_sortattrdesc(self):
1291 def cmd_sortattrdesc(self):
1278 """
1292 """
1279 Sort the objects (in descending order) using the attribute under
1293 Sort the objects (in descending order) using the attribute under
1280 the cursor as the sort key.
1294 the cursor as the sort key.
1281 """
1295 """
1282 level = self.levels[-1]
1296 level = self.levels[-1]
1283 attrname = level.displayattr[1]
1297 attr = level.displayattr[1]
1284 if attrname is ipipe.noitem:
1298 if attr is ipipe.noitem:
1285 curses.beep()
1299 curses.beep()
1286 self.report(AttributeError(ipipe._attrname(attrname)))
1300 self.report(CommandError("no column under cursor"))
1287 return
1301 return
1288 self.report("sort by %s (descending)" % ipipe._attrname(attrname))
1302 self.report("sort by %s (descending)" % attr.name())
1289 def key(item):
1303 def key(item):
1290 try:
1304 try:
1291 return ipipe._getattr(item, attrname, None)
1305 return attr.value(item)
1292 except (KeyboardInterrupt, SystemExit):
1306 except (KeyboardInterrupt, SystemExit):
1293 raise
1307 raise
1294 except Exception:
1308 except Exception:
1295 return None
1309 return None
1296 level.sort(key, reverse=True)
1310 level.sort(key, reverse=True)
1297
1311
1298 def cmd_hideattr(self):
1312 def cmd_hideattr(self):
1299 """
1313 """
1300 Hide the attribute under the cursor.
1314 Hide the attribute under the cursor.
1301 """
1315 """
1302 level = self.levels[-1]
1316 level = self.levels[-1]
1303 if level.displayattr[0] is None:
1317 if level.displayattr[0] is None:
1304 self.beep()
1318 self.beep()
1305 else:
1319 else:
1306 self.report("hideattr")
1320 self.report("hideattr")
1307 level.hiddenattrs.add(level.displayattr[1])
1321 level.hiddenattrs.add(level.displayattr[1])
1308 level.moveto(level.curx, level.cury, refresh=True)
1322 level.moveto(level.curx, level.cury, refresh=True)
1309
1323
1310 def cmd_unhideattrs(self):
1324 def cmd_unhideattrs(self):
1311 """
1325 """
1312 Make all attributes visible again.
1326 Make all attributes visible again.
1313 """
1327 """
1314 level = self.levels[-1]
1328 level = self.levels[-1]
1315 self.report("unhideattrs")
1329 self.report("unhideattrs")
1316 level.hiddenattrs.clear()
1330 level.hiddenattrs.clear()
1317 level.moveto(level.curx, level.cury, refresh=True)
1331 level.moveto(level.curx, level.cury, refresh=True)
1318
1332
1319 def cmd_goto(self):
1333 def cmd_goto(self):
1320 """
1334 """
1321 Jump to a row. The row number can be entered at the
1335 Jump to a row. The row number can be entered at the
1322 bottom of the screen.
1336 bottom of the screen.
1323 """
1337 """
1324 self.startkeyboardinput("goto")
1338 self.startkeyboardinput("goto")
1325
1339
1326 def cmd_find(self):
1340 def cmd_find(self):
1327 """
1341 """
1328 Search forward for a row. The search condition can be entered at the
1342 Search forward for a row. The search condition can be entered at the
1329 bottom of the screen.
1343 bottom of the screen.
1330 """
1344 """
1331 self.startkeyboardinput("find")
1345 self.startkeyboardinput("find")
1332
1346
1333 def cmd_findbackwards(self):
1347 def cmd_findbackwards(self):
1334 """
1348 """
1335 Search backward for a row. The search condition can be entered at the
1349 Search backward for a row. The search condition can be entered at the
1336 bottom of the screen.
1350 bottom of the screen.
1337 """
1351 """
1338 self.startkeyboardinput("findbackwards")
1352 self.startkeyboardinput("findbackwards")
1339
1353
1340 def cmd_help(self):
1354 def cmd_help(self):
1341 """
1355 """
1342 Opens the help screen as a new browser level, describing keyboard
1356 Opens the help screen as a new browser level, describing keyboard
1343 shortcuts.
1357 shortcuts.
1344 """
1358 """
1345 for level in self.levels:
1359 for level in self.levels:
1346 if isinstance(level.input, _BrowserHelp):
1360 if isinstance(level.input, _BrowserHelp):
1347 curses.beep()
1361 curses.beep()
1348 self.report(CommandError("help already active"))
1362 self.report(CommandError("help already active"))
1349 return
1363 return
1350
1364
1351 self.enter(_BrowserHelp(self), "default")
1365 self.enter(_BrowserHelp(self), "default")
1352
1366
1353 def cmd_quit(self):
1367 def cmd_quit(self):
1354 """
1368 """
1355 Quit the browser and return to the IPython prompt.
1369 Quit the browser and return to the IPython prompt.
1356 """
1370 """
1357 self.returnvalue = None
1371 self.returnvalue = None
1358 return True
1372 return True
1359
1373
1360 def sigwinchhandler(self, signal, frame):
1374 def sigwinchhandler(self, signal, frame):
1361 self.resized = True
1375 self.resized = True
1362
1376
1363 def _dodisplay(self, scr):
1377 def _dodisplay(self, scr):
1364 """
1378 """
1365 This method is the workhorse of the browser. It handles screen
1379 This method is the workhorse of the browser. It handles screen
1366 drawing and the keyboard.
1380 drawing and the keyboard.
1367 """
1381 """
1368 self.scr = scr
1382 self.scr = scr
1369 curses.halfdelay(1)
1383 curses.halfdelay(1)
1370 footery = 2
1384 footery = 2
1371
1385
1372 keys = []
1386 keys = []
1373 for key in ("quit", "help"):
1387 for key in ("quit", "help"):
1374 key = self.keymap.findkey(key, None)
1388 key = self.keymap.findkey(key, None)
1375 if key is not None:
1389 if key is not None:
1376 keys.append("%s=quit" % self.keylabel(key))
1390 keys.append("%s=quit" % self.keylabel(key))
1377 helpmsg = " | %s" % " ".join(keys)
1391 helpmsg = " | %s" % " ".join(keys)
1378
1392
1379 scr.clear()
1393 scr.clear()
1380 msg = "Fetching first batch of objects..."
1394 msg = "Fetching first batch of objects..."
1381 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1395 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1382 scr.addstr(self.scrsizey//2, (self.scrsizex-len(msg))//2, msg)
1396 scr.addstr(self.scrsizey//2, (self.scrsizex-len(msg))//2, msg)
1383 scr.refresh()
1397 scr.refresh()
1384
1398
1385 lastc = -1
1399 lastc = -1
1386
1400
1387 self.levels = []
1401 self.levels = []
1388 # enter the first level
1402 # enter the first level
1389 self.enter(self.input, ipipe.xiter(self.input, "default"), *self.attrs)
1403 self.enter(self.input, ipipe.xiter(self.input, "default"), *self.attrs)
1390
1404
1391 self._calcheaderlines(None)
1405 self._calcheaderlines(None)
1392
1406
1393 while True:
1407 while True:
1394 level = self.levels[-1]
1408 level = self.levels[-1]
1395 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1409 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1396 level.mainsizey = self.scrsizey-1-self._headerlines-footery
1410 level.mainsizey = self.scrsizey-1-self._headerlines-footery
1397
1411
1398 # Paint object header
1412 # Paint object header
1399 for i in xrange(self._firstheaderline, self._firstheaderline+self._headerlines):
1413 for i in xrange(self._firstheaderline, self._firstheaderline+self._headerlines):
1400 lv = self.levels[i]
1414 lv = self.levels[i]
1401 posx = 0
1415 posx = 0
1402 posy = i-self._firstheaderline
1416 posy = i-self._firstheaderline
1403 endx = self.scrsizex
1417 endx = self.scrsizex
1404 if i: # not the first level
1418 if i: # not the first level
1405 msg = " (%d/%d" % (self.levels[i-1].cury, len(self.levels[i-1].items))
1419 msg = " (%d/%d" % (self.levels[i-1].cury, len(self.levels[i-1].items))
1406 if not self.levels[i-1].exhausted:
1420 if not self.levels[i-1].exhausted:
1407 msg += "+"
1421 msg += "+"
1408 msg += ") "
1422 msg += ") "
1409 endx -= len(msg)+1
1423 endx -= len(msg)+1
1410 posx += self.addstr(posy, posx, 0, endx, " ibrowse #%d: " % i, self.style_objheadertext)
1424 posx += self.addstr(posy, posx, 0, endx, " ibrowse #%d: " % i, self.style_objheadertext)
1411 for (style, text) in lv.header:
1425 for (style, text) in lv.header:
1412 posx += self.addstr(posy, posx, 0, endx, text, self.style_objheaderobject)
1426 posx += self.addstr(posy, posx, 0, endx, text, self.style_objheaderobject)
1413 if posx >= endx:
1427 if posx >= endx:
1414 break
1428 break
1415 if i:
1429 if i:
1416 posx += self.addstr(posy, posx, 0, self.scrsizex, msg, self.style_objheadernumber)
1430 posx += self.addstr(posy, posx, 0, self.scrsizex, msg, self.style_objheadernumber)
1417 posx += self.addchr(posy, posx, 0, self.scrsizex, " ", self.scrsizex-posx, self.style_objheadernumber)
1431 posx += self.addchr(posy, posx, 0, self.scrsizex, " ", self.scrsizex-posx, self.style_objheadernumber)
1418
1432
1419 if not level.items:
1433 if not level.items:
1420 self.addchr(self._headerlines, 0, 0, self.scrsizex, " ", self.scrsizex, self.style_colheader)
1434 self.addchr(self._headerlines, 0, 0, self.scrsizex, " ", self.scrsizex, self.style_colheader)
1421 self.addstr(self._headerlines+1, 0, 0, self.scrsizex, " <empty>", astyle.style_error)
1435 self.addstr(self._headerlines+1, 0, 0, self.scrsizex, " <empty>", astyle.style_error)
1422 scr.clrtobot()
1436 scr.clrtobot()
1423 else:
1437 else:
1424 # Paint column headers
1438 # Paint column headers
1425 scr.move(self._headerlines, 0)
1439 scr.move(self._headerlines, 0)
1426 scr.addstr(" %*s " % (level.numbersizex, "#"), self.getstyle(self.style_colheader))
1440 scr.addstr(" %*s " % (level.numbersizex, "#"), self.getstyle(self.style_colheader))
1427 scr.addstr(self.headersepchar, self.getstyle(self.style_colheadersep))
1441 scr.addstr(self.headersepchar, self.getstyle(self.style_colheadersep))
1428 begx = level.numbersizex+3
1442 begx = level.numbersizex+3
1429 posx = begx-level.datastartx
1443 posx = begx-level.datastartx
1430 for attrname in level.displayattrs:
1444 for attr in level.displayattrs:
1431 strattrname = ipipe._attrname(attrname)
1445 attrname = attr.name()
1432 cwidth = level.colwidths[attrname]
1446 cwidth = level.colwidths[attr]
1433 header = strattrname.ljust(cwidth)
1447 header = attrname.ljust(cwidth)
1434 if attrname == level.displayattr[1]:
1448 if attr is level.displayattr[1]:
1435 style = self.style_colheaderhere
1449 style = self.style_colheaderhere
1436 else:
1450 else:
1437 style = self.style_colheader
1451 style = self.style_colheader
1438 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, header, style)
1452 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, header, style)
1439 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, self.headersepchar, self.style_colheadersep)
1453 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, self.headersepchar, self.style_colheadersep)
1440 if posx >= self.scrsizex:
1454 if posx >= self.scrsizex:
1441 break
1455 break
1442 else:
1456 else:
1443 scr.addstr(" "*(self.scrsizex-posx), self.getstyle(self.style_colheader))
1457 scr.addstr(" "*(self.scrsizex-posx), self.getstyle(self.style_colheader))
1444
1458
1445 # Paint rows
1459 # Paint rows
1446 posy = self._headerlines+1+level.datastarty
1460 posy = self._headerlines+1+level.datastarty
1447 for i in xrange(level.datastarty, min(level.datastarty+level.mainsizey, len(level.items))):
1461 for i in xrange(level.datastarty, min(level.datastarty+level.mainsizey, len(level.items))):
1448 cache = level.items[i]
1462 cache = level.items[i]
1449 if i == level.cury:
1463 if i == level.cury:
1450 style = self.style_numberhere
1464 style = self.style_numberhere
1451 else:
1465 else:
1452 style = self.style_number
1466 style = self.style_number
1453
1467
1454 posy = self._headerlines+1+i-level.datastarty
1468 posy = self._headerlines+1+i-level.datastarty
1455 posx = begx-level.datastartx
1469 posx = begx-level.datastartx
1456
1470
1457 scr.move(posy, 0)
1471 scr.move(posy, 0)
1458 scr.addstr(" %*d%s" % (level.numbersizex, i, " !"[cache.marked]), self.getstyle(style))
1472 scr.addstr(" %*d%s" % (level.numbersizex, i, " !"[cache.marked]), self.getstyle(style))
1459 scr.addstr(self.headersepchar, self.getstyle(self.style_sep))
1473 scr.addstr(self.headersepchar, self.getstyle(self.style_sep))
1460
1474
1461 for attrname in level.displayattrs:
1475 for attrname in level.displayattrs:
1462 cwidth = level.colwidths[attrname]
1476 cwidth = level.colwidths[attrname]
1463 try:
1477 try:
1464 (align, length, parts) = level.displayrows[i-level.datastarty][attrname]
1478 (align, length, parts) = level.displayrows[i-level.datastarty][attrname]
1465 except KeyError:
1479 except KeyError:
1466 align = 2
1480 align = 2
1467 style = astyle.style_nodata
1481 style = astyle.style_nodata
1468 if i == level.cury:
1482 if i == level.cury:
1469 style = self.getstylehere(style)
1483 style = self.getstylehere(style)
1470 padstyle = self.style_datapad
1484 padstyle = self.style_datapad
1471 sepstyle = self.style_sep
1485 sepstyle = self.style_sep
1472 if i == level.cury:
1486 if i == level.cury:
1473 padstyle = self.getstylehere(padstyle)
1487 padstyle = self.getstylehere(padstyle)
1474 sepstyle = self.getstylehere(sepstyle)
1488 sepstyle = self.getstylehere(sepstyle)
1475 if align == 2:
1489 if align == 2:
1476 posx += self.addchr(posy, posx, begx, self.scrsizex, self.nodatachar, cwidth, style)
1490 posx += self.addchr(posy, posx, begx, self.scrsizex, self.nodatachar, cwidth, style)
1477 else:
1491 else:
1478 if align == 1:
1492 if align == 1:
1479 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1493 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1480 elif align == 0:
1494 elif align == 0:
1481 pad1 = (cwidth-length)//2
1495 pad1 = (cwidth-length)//2
1482 pad2 = cwidth-length-len(pad1)
1496 pad2 = cwidth-length-len(pad1)
1483 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad1, padstyle)
1497 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad1, padstyle)
1484 for (style, text) in parts:
1498 for (style, text) in parts:
1485 if i == level.cury:
1499 if i == level.cury:
1486 style = self.getstylehere(style)
1500 style = self.getstylehere(style)
1487 posx += self.addstr(posy, posx, begx, self.scrsizex, text, style)
1501 posx += self.addstr(posy, posx, begx, self.scrsizex, text, style)
1488 if posx >= self.scrsizex:
1502 if posx >= self.scrsizex:
1489 break
1503 break
1490 if align == -1:
1504 if align == -1:
1491 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1505 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1492 elif align == 0:
1506 elif align == 0:
1493 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad2, padstyle)
1507 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad2, padstyle)
1494 posx += self.addstr(posy, posx, begx, self.scrsizex, self.datasepchar, sepstyle)
1508 posx += self.addstr(posy, posx, begx, self.scrsizex, self.datasepchar, sepstyle)
1495 else:
1509 else:
1496 scr.clrtoeol()
1510 scr.clrtoeol()
1497
1511
1498 # Add blank row headers for the rest of the screen
1512 # Add blank row headers for the rest of the screen
1499 for posy in xrange(posy+1, self.scrsizey-2):
1513 for posy in xrange(posy+1, self.scrsizey-2):
1500 scr.addstr(posy, 0, " " * (level.numbersizex+2), self.getstyle(self.style_colheader))
1514 scr.addstr(posy, 0, " " * (level.numbersizex+2), self.getstyle(self.style_colheader))
1501 scr.clrtoeol()
1515 scr.clrtoeol()
1502
1516
1503 posy = self.scrsizey-footery
1517 posy = self.scrsizey-footery
1504 # Display footer
1518 # Display footer
1505 scr.addstr(posy, 0, " "*self.scrsizex, self.getstyle(self.style_footer))
1519 scr.addstr(posy, 0, " "*self.scrsizex, self.getstyle(self.style_footer))
1506
1520
1507 if level.exhausted:
1521 if level.exhausted:
1508 flag = ""
1522 flag = ""
1509 else:
1523 else:
1510 flag = "+"
1524 flag = "+"
1511
1525
1512 endx = self.scrsizex-len(helpmsg)-1
1526 endx = self.scrsizex-len(helpmsg)-1
1513 scr.addstr(posy, endx, helpmsg, self.getstyle(self.style_footer))
1527 scr.addstr(posy, endx, helpmsg, self.getstyle(self.style_footer))
1514
1528
1515 posx = 0
1529 posx = 0
1516 msg = " %d%s objects (%d marked): " % (len(level.items), flag, level.marked)
1530 msg = " %d%s objects (%d marked): " % (len(level.items), flag, level.marked)
1517 posx += self.addstr(posy, posx, 0, endx, msg, self.style_footer)
1531 posx += self.addstr(posy, posx, 0, endx, msg, self.style_footer)
1518 try:
1532 try:
1519 item = level.items[level.cury].item
1533 item = level.items[level.cury].item
1520 except IndexError: # empty
1534 except IndexError: # empty
1521 pass
1535 pass
1522 else:
1536 else:
1523 for (nostyle, text) in ipipe.xrepr(item, "footer"):
1537 for (nostyle, text) in ipipe.xrepr(item, "footer"):
1524 if not isinstance(nostyle, int):
1538 if not isinstance(nostyle, int):
1525 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1539 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1526 if posx >= endx:
1540 if posx >= endx:
1527 break
1541 break
1528
1542
1529 attrstyle = [(astyle.style_default, "no attribute")]
1543 attrstyle = [(astyle.style_default, "no attribute")]
1530 attrname = level.displayattr[1]
1544 attr = level.displayattr[1]
1531 if attrname is not ipipe.noitem and attrname is not None:
1545 if attr is not ipipe.noitem and not isinstance(attr, ipipe.SelfDescriptor):
1532 posx += self.addstr(posy, posx, 0, endx, " | ", self.style_footer)
1546 posx += self.addstr(posy, posx, 0, endx, " | ", self.style_footer)
1533 posx += self.addstr(posy, posx, 0, endx, ipipe._attrname(attrname), self.style_footer)
1547 posx += self.addstr(posy, posx, 0, endx, attr.name(), self.style_footer)
1534 posx += self.addstr(posy, posx, 0, endx, ": ", self.style_footer)
1548 posx += self.addstr(posy, posx, 0, endx, ": ", self.style_footer)
1535 try:
1549 try:
1536 attr = ipipe._getattr(item, attrname)
1550 value = attr.value(item)
1537 except (SystemExit, KeyboardInterrupt):
1551 except (SystemExit, KeyboardInterrupt):
1538 raise
1552 raise
1539 except Exception, exc:
1553 except Exception, exc:
1540 attr = exc
1554 attr = exc
1541 if attr is not ipipe.noitem:
1555 if value is not ipipe.noitem:
1542 attrstyle = ipipe.xrepr(attr, "footer")
1556 attrstyle = ipipe.xrepr(value, "footer")
1543 for (nostyle, text) in attrstyle:
1557 for (nostyle, text) in attrstyle:
1544 if not isinstance(nostyle, int):
1558 if not isinstance(nostyle, int):
1545 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1559 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1546 if posx >= endx:
1560 if posx >= endx:
1547 break
1561 break
1548
1562
1549 try:
1563 try:
1550 # Display input prompt
1564 # Display input prompt
1551 if self.mode in self.prompts:
1565 if self.mode in self.prompts:
1552 history = self.prompts[self.mode]
1566 history = self.prompts[self.mode]
1553 posx = 0
1567 posx = 0
1554 posy = self.scrsizey-1
1568 posy = self.scrsizey-1
1555 posx += self.addstr(posy, posx, 0, endx, history.prompt, astyle.style_default)
1569 posx += self.addstr(posy, posx, 0, endx, history.prompt, astyle.style_default)
1556 posx += self.addstr(posy, posx, 0, endx, " [", astyle.style_default)
1570 posx += self.addstr(posy, posx, 0, endx, " [", astyle.style_default)
1557 if history.cury==-1:
1571 if history.cury==-1:
1558 text = "new"
1572 text = "new"
1559 else:
1573 else:
1560 text = str(history.cury+1)
1574 text = str(history.cury+1)
1561 posx += self.addstr(posy, posx, 0, endx, text, astyle.style_type_number)
1575 posx += self.addstr(posy, posx, 0, endx, text, astyle.style_type_number)
1562 if history.history:
1576 if history.history:
1563 posx += self.addstr(posy, posx, 0, endx, "/", astyle.style_default)
1577 posx += self.addstr(posy, posx, 0, endx, "/", astyle.style_default)
1564 posx += self.addstr(posy, posx, 0, endx, str(len(history.history)), astyle.style_type_number)
1578 posx += self.addstr(posy, posx, 0, endx, str(len(history.history)), astyle.style_type_number)
1565 posx += self.addstr(posy, posx, 0, endx, "]: ", astyle.style_default)
1579 posx += self.addstr(posy, posx, 0, endx, "]: ", astyle.style_default)
1566 inputstartx = posx
1580 inputstartx = posx
1567 posx += self.addstr(posy, posx, 0, endx, history.input, astyle.style_default)
1581 posx += self.addstr(posy, posx, 0, endx, history.input, astyle.style_default)
1568 # Display report
1582 # Display report
1569 else:
1583 else:
1570 if self._report is not None:
1584 if self._report is not None:
1571 if isinstance(self._report, Exception):
1585 if isinstance(self._report, Exception):
1572 style = self.getstyle(astyle.style_error)
1586 style = self.getstyle(astyle.style_error)
1573 if self._report.__class__.__module__ == "exceptions":
1587 if self._report.__class__.__module__ == "exceptions":
1574 msg = "%s: %s" % \
1588 msg = "%s: %s" % \
1575 (self._report.__class__.__name__, self._report)
1589 (self._report.__class__.__name__, self._report)
1576 else:
1590 else:
1577 msg = "%s.%s: %s" % \
1591 msg = "%s.%s: %s" % \
1578 (self._report.__class__.__module__,
1592 (self._report.__class__.__module__,
1579 self._report.__class__.__name__, self._report)
1593 self._report.__class__.__name__, self._report)
1580 else:
1594 else:
1581 style = self.getstyle(self.style_report)
1595 style = self.getstyle(self.style_report)
1582 msg = self._report
1596 msg = self._report
1583 scr.addstr(self.scrsizey-1, 0, msg[:self.scrsizex], style)
1597 scr.addstr(self.scrsizey-1, 0, msg[:self.scrsizex], style)
1584 self._report = None
1598 self._report = None
1585 else:
1599 else:
1586 scr.move(self.scrsizey-1, 0)
1600 scr.move(self.scrsizey-1, 0)
1587 except curses.error:
1601 except curses.error:
1588 # Protect against errors from writing to the last line
1602 # Protect against errors from writing to the last line
1589 pass
1603 pass
1590 scr.clrtoeol()
1604 scr.clrtoeol()
1591
1605
1592 # Position cursor
1606 # Position cursor
1593 if self.mode in self.prompts:
1607 if self.mode in self.prompts:
1594 history = self.prompts[self.mode]
1608 history = self.prompts[self.mode]
1595 scr.move(self.scrsizey-1, inputstartx+history.curx)
1609 scr.move(self.scrsizey-1, inputstartx+history.curx)
1596 else:
1610 else:
1597 scr.move(
1611 scr.move(
1598 1+self._headerlines+level.cury-level.datastarty,
1612 1+self._headerlines+level.cury-level.datastarty,
1599 level.numbersizex+3+level.curx-level.datastartx
1613 level.numbersizex+3+level.curx-level.datastartx
1600 )
1614 )
1601 scr.refresh()
1615 scr.refresh()
1602
1616
1603 # Check keyboard
1617 # Check keyboard
1604 while True:
1618 while True:
1605 c = scr.getch()
1619 c = scr.getch()
1606 if self.resized:
1620 if self.resized:
1607 size = fcntl.ioctl(0, tty.TIOCGWINSZ, "12345678")
1621 size = fcntl.ioctl(0, tty.TIOCGWINSZ, "12345678")
1608 size = struct.unpack("4H", size)
1622 size = struct.unpack("4H", size)
1609 oldsize = scr.getmaxyx()
1623 oldsize = scr.getmaxyx()
1610 scr.erase()
1624 scr.erase()
1611 curses.resize_term(size[0], size[1])
1625 curses.resize_term(size[0], size[1])
1612 newsize = scr.getmaxyx()
1626 newsize = scr.getmaxyx()
1613 scr.erase()
1627 scr.erase()
1614 for l in self.levels:
1628 for l in self.levels:
1615 l.mainsizey += newsize[0]-oldsize[0]
1629 l.mainsizey += newsize[0]-oldsize[0]
1616 l.moveto(l.curx, l.cury, refresh=True)
1630 l.moveto(l.curx, l.cury, refresh=True)
1617 scr.refresh()
1631 scr.refresh()
1618 self.resized = False
1632 self.resized = False
1619 break # Redisplay
1633 break # Redisplay
1620 if self.mode in self.prompts:
1634 if self.mode in self.prompts:
1621 if self.prompts[self.mode].handlekey(self, c):
1635 if self.prompts[self.mode].handlekey(self, c):
1622 break # Redisplay
1636 break # Redisplay
1623 else:
1637 else:
1624 # if no key is pressed slow down and beep again
1638 # if no key is pressed slow down and beep again
1625 if c == -1:
1639 if c == -1:
1626 self.stepx = 1.
1640 self.stepx = 1.
1627 self.stepy = 1.
1641 self.stepy = 1.
1628 self._dobeep = True
1642 self._dobeep = True
1629 else:
1643 else:
1630 # if a different key was pressed slow down and beep too
1644 # if a different key was pressed slow down and beep too
1631 if c != lastc:
1645 if c != lastc:
1632 lastc = c
1646 lastc = c
1633 self.stepx = 1.
1647 self.stepx = 1.
1634 self.stepy = 1.
1648 self.stepy = 1.
1635 self._dobeep = True
1649 self._dobeep = True
1636 cmdname = self.keymap.get(c, None)
1650 cmdname = self.keymap.get(c, None)
1637 if cmdname is None:
1651 if cmdname is None:
1638 self.report(
1652 self.report(
1639 UnassignedKeyError("Unassigned key %s" %
1653 UnassignedKeyError("Unassigned key %s" %
1640 self.keylabel(c)))
1654 self.keylabel(c)))
1641 else:
1655 else:
1642 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
1656 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
1643 if cmdfunc is None:
1657 if cmdfunc is None:
1644 self.report(
1658 self.report(
1645 UnknownCommandError("Unknown command %r" %
1659 UnknownCommandError("Unknown command %r" %
1646 (cmdname,)))
1660 (cmdname,)))
1647 elif cmdfunc():
1661 elif cmdfunc():
1648 returnvalue = self.returnvalue
1662 returnvalue = self.returnvalue
1649 self.returnvalue = None
1663 self.returnvalue = None
1650 return returnvalue
1664 return returnvalue
1651 self.stepx = self.nextstepx(self.stepx)
1665 self.stepx = self.nextstepx(self.stepx)
1652 self.stepy = self.nextstepy(self.stepy)
1666 self.stepy = self.nextstepy(self.stepy)
1653 curses.flushinp() # get rid of type ahead
1667 curses.flushinp() # get rid of type ahead
1654 break # Redisplay
1668 break # Redisplay
1655 self.scr = None
1669 self.scr = None
1656
1670
1657 def display(self):
1671 def display(self):
1658 if hasattr(curses, "resize_term"):
1672 if hasattr(curses, "resize_term"):
1659 oldhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler)
1673 oldhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler)
1660 try:
1674 try:
1661 return curses.wrapper(self._dodisplay)
1675 return curses.wrapper(self._dodisplay)
1662 finally:
1676 finally:
1663 signal.signal(signal.SIGWINCH, oldhandler)
1677 signal.signal(signal.SIGWINCH, oldhandler)
1664 else:
1678 else:
1665 return curses.wrapper(self._dodisplay)
1679 return curses.wrapper(self._dodisplay)
This diff has been collapsed as it changes many lines, (592 lines changed) Show them Hide them
@@ -1,1853 +1,2121 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 ``ls`` (listing the
18 * ``Table``s: These objects produce items. Examples are ``ls`` (listing the
19 current directory, ``ienv`` (listing environment variables), ``ipwd`` (listing
19 current directory, ``ienv`` (listing environment variables), ``ipwd`` (listing
20 user account) and ``igrp`` (listing user groups). A ``Table`` must be the
20 user account) 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 ``browse`` which is a ``curses``
32 display objects will be used. One example is ``browse`` 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)``. This method must return a
40 implement the method ``__xattrs__(self, mode)``. This method must return a
41 sequence of attribute names. This sequence may also contain integers, which
41 sequence of attribute names. This sequence may also contain integers, which
42 will be treated as sequence indizes. Also supported is ``None``, which uses
42 will be treated as sequence indizes. Also supported is ``None``, which uses
43 the object itself and callables which will be called with the object as the
43 the object itself and callables which will be called with the object as the
44 an argument. If ``__xattrs__()`` isn't implemented ``(None,)`` will be used as
44 an argument. If ``__xattrs__()`` isn't implemented ``(None,)`` will be used as
45 the attribute sequence (i.e. the object itself (it's ``repr()`` format) will
45 the attribute sequence (i.e. the object itself (it's ``repr()`` format) will
46 be being displayed. The global function ``xattrs()`` implements this
46 be being displayed. The global function ``xattrs()`` implements this
47 functionality.
47 functionality.
48
48
49 * When an object ``foo`` is displayed in the header, footer or table cell of the
49 * When an object ``foo`` is displayed in the header, footer or table cell of the
50 browser ``foo.__xrepr__(mode)`` is called. Mode can be ``"header"`` or
50 browser ``foo.__xrepr__(mode)`` is called. Mode can be ``"header"`` or
51 ``"footer"`` for the header or footer line and ``"cell"`` for a table cell.
51 ``"footer"`` for the header or footer line and ``"cell"`` for a table cell.
52 ``__xrepr__()```must return an iterable (e.g. by being a generator) which
52 ``__xrepr__()```must return an iterable (e.g. by being a generator) which
53 produces the following items: The first item should be a tuple containing
53 produces the following items: The first item should be a tuple containing
54 the alignment (-1 left aligned, 0 centered and 1 right aligned) and whether
54 the alignment (-1 left aligned, 0 centered and 1 right aligned) and whether
55 the complete output must be displayed or if the browser is allowed to stop
55 the complete output must be displayed or if the browser is allowed to stop
56 output after enough text has been produced (e.g. a syntax highlighted text
56 output after enough text has been produced (e.g. a syntax highlighted text
57 line would use ``True``, but for a large data structure (i.e. a nested list,
57 line would use ``True``, but for a large data structure (i.e. a nested list,
58 tuple or dictionary) ``False`` would be used). The other output ``__xrepr__()``
58 tuple or dictionary) ``False`` would be used). The other output ``__xrepr__()``
59 may produce is tuples of ``Style```objects and text (which contain the text
59 may produce is tuples of ``Style```objects and text (which contain the text
60 representation of the object; see the ``astyle`` module). If ``__xrepr__()``
60 representation of the object; see the ``astyle`` module). If ``__xrepr__()``
61 recursively outputs a data structure the function ``xrepr(object, mode)`` can
61 recursively outputs a data structure the function ``xrepr(object, mode)`` can
62 be used and ``"default"`` must be passed as the mode in these calls. This in
62 be used and ``"default"`` must be passed as the mode in these calls. This in
63 turn calls the ``__xrepr__()`` method on ``object`` (or uses ``repr(object)``
63 turn calls the ``__xrepr__()`` method on ``object`` (or uses ``repr(object)``
64 as the string representation if ``__xrepr__()`` doesn't exist).
64 as the string representation if ``__xrepr__()`` doesn't exist).
65
65
66 * Objects that can be iterated by ``Pipe``s must implement the method
66 * Objects that can be iterated by ``Pipe``s must implement the method
67 ``__xiter__(self, mode)``. ``mode`` can take the following values:
67 ``__xiter__(self, mode)``. ``mode`` can take the following values:
68
68
69 - ``"default"``: This is the default value and ist always used by pipeline
69 - ``"default"``: This is the default value and ist always used by pipeline
70 expressions. Other values are only used in the browser.
70 expressions. Other values are only used in the browser.
71 - ``None``: This value is passed by the browser. The object must return an
71 - ``None``: This value is passed by the browser. The object must return an
72 iterable of ``XMode`` objects describing all modes supported by the object.
72 iterable of ``XMode`` objects describing all modes supported by the object.
73 (This should never include ``"default"`` or ``None``).
73 (This should never include ``"default"`` or ``None``).
74 - Any other value that the object supports.
74 - Any other value that the object supports.
75
75
76 The global function ``xiter()`` can be called to get such an iterator. If
76 The global function ``xiter()`` can be called to get such an iterator. If
77 the method ``_xiter__`` isn't implemented, ``xiter()`` falls back to
77 the method ``_xiter__`` isn't implemented, ``xiter()`` falls back to
78 ``__iter__``. In addition to that, dictionaries and modules receive special
78 ``__iter__``. In addition to that, dictionaries and modules receive special
79 treatment (returning an iterator over ``(key, value)`` pairs). This makes it
79 treatment (returning an iterator over ``(key, value)`` pairs). This makes it
80 possible to use dictionaries and modules in pipeline expressions, for example:
80 possible to use dictionaries and modules in pipeline expressions, for example:
81
81
82 >>> import sys
82 >>> import sys
83 >>> sys | ifilter("isinstance(value, int)") | idump
83 >>> sys | ifilter("isinstance(value, int)") | idump
84 key |value
84 key |value
85 api_version| 1012
85 api_version| 1012
86 dllhandle | 503316480
86 dllhandle | 503316480
87 hexversion | 33817328
87 hexversion | 33817328
88 maxint |2147483647
88 maxint |2147483647
89 maxunicode | 65535
89 maxunicode | 65535
90 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
90 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
91 ...
91 ...
92
92
93 Note: The expression strings passed to ``ifilter()`` and ``isort()`` can
93 Note: The expression strings passed to ``ifilter()`` and ``isort()`` can
94 refer to the object to be filtered or sorted via the variable ``_`` and to any
94 refer to the object to be filtered or sorted via the variable ``_`` and to any
95 of the attributes of the object, i.e.:
95 of the attributes of the object, i.e.:
96
96
97 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
97 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
98
98
99 does the same as
99 does the same as
100
100
101 >>> sys.modules | ifilter("value is not None") | isort("key.lower()")
101 >>> sys.modules | ifilter("value is not None") | isort("key.lower()")
102
102
103 In addition to expression strings, it's possible to pass callables (taking
103 In addition to expression strings, it's possible to pass callables (taking
104 the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``:
104 the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``:
105
105
106 >>> sys | ifilter(lambda _:isinstance(_.value, int)) \
106 >>> sys | ifilter(lambda _:isinstance(_.value, int)) \
107 ... | ieval(lambda _: (_.key, hex(_.value))) | idump
107 ... | ieval(lambda _: (_.key, hex(_.value))) | idump
108 0 |1
108 0 |1
109 api_version|0x3f4
109 api_version|0x3f4
110 dllhandle |0x1e000000
110 dllhandle |0x1e000000
111 hexversion |0x20402f0
111 hexversion |0x20402f0
112 maxint |0x7fffffff
112 maxint |0x7fffffff
113 maxunicode |0xffff
113 maxunicode |0xffff
114 """
114 """
115
115
116 import sys, os, os.path, stat, glob, new, csv, datetime, types
116 import sys, os, os.path, stat, glob, new, csv, datetime, types
117 import itertools, mimetypes
117 import itertools, mimetypes
118
118
119 try: # Python 2.3 compatibility
119 try: # Python 2.3 compatibility
120 import collections
120 import collections
121 except ImportError:
121 except ImportError:
122 deque = list
122 deque = list
123 else:
123 else:
124 deque = collections.deque
124 deque = collections.deque
125
125
126 try: # Python 2.3 compatibility
126 try: # Python 2.3 compatibility
127 set
127 set
128 except NameError:
128 except NameError:
129 import sets
129 import sets
130 set = sets.Set
130 set = sets.Set
131
131
132 try: # Python 2.3 compatibility
132 try: # Python 2.3 compatibility
133 sorted
133 sorted
134 except NameError:
134 except NameError:
135 def sorted(iterator, key=None, reverse=False):
135 def sorted(iterator, key=None, reverse=False):
136 items = list(iterator)
136 items = list(iterator)
137 if key is not None:
137 if key is not None:
138 items.sort(lambda i1, i2: cmp(key(i1), key(i2)))
138 items.sort(lambda i1, i2: cmp(key(i1), key(i2)))
139 else:
139 else:
140 items.sort()
140 items.sort()
141 if reverse:
141 if reverse:
142 items.reverse()
142 items.reverse()
143 return items
143 return items
144
144
145 try:
145 try:
146 import pwd
146 import pwd
147 except ImportError:
147 except ImportError:
148 pwd = None
148 pwd = None
149
149
150 try:
150 try:
151 import grp
151 import grp
152 except ImportError:
152 except ImportError:
153 grp = None
153 grp = None
154
154
155 import path
155 import path
156 try:
156 try:
157 from IPython import genutils, ipapi
157 from IPython import genutils, ipapi
158 except ImportError:
158 except ImportError:
159 genutils = None
159 genutils = None
160 ipapi = None
160 ipapi = None
161
161
162 import astyle
162 import astyle
163
163
164
164
165 __all__ = [
165 __all__ = [
166 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
166 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
167 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum", "ienv",
167 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum", "ienv",
168 "idump", "iless"
168 "idump", "iless"
169 ]
169 ]
170
170
171
171
172 os.stat_float_times(True) # enable microseconds
172 os.stat_float_times(True) # enable microseconds
173
173
174
174
175 class AttrNamespace(object):
175 class AttrNamespace(object):
176 """
176 """
177 Helper class that is used for providing a namespace for evaluating
177 Helper class that is used for providing a namespace for evaluating
178 expressions containing attribute names of an object.
178 expressions containing attribute names of an object.
179 """
179 """
180 def __init__(self, wrapped):
180 def __init__(self, wrapped):
181 self.wrapped = wrapped
181 self.wrapped = wrapped
182
182
183 def __getitem__(self, name):
183 def __getitem__(self, name):
184 if name == "_":
184 if name == "_":
185 return self.wrapped
185 return self.wrapped
186 try:
186 try:
187 return getattr(self.wrapped, name)
187 return getattr(self.wrapped, name)
188 except AttributeError:
188 except AttributeError:
189 raise KeyError(name)
189 raise KeyError(name)
190
190
191 # Python 2.3 compatibility
191 # Python 2.3 compatibility
192 # use eval workaround to find out which names are used in the
192 # use eval workaround to find out which names are used in the
193 # eval string and put them into the locals. This works for most
193 # eval string and put them into the locals. This works for most
194 # normal uses case, bizarre ones like accessing the locals()
194 # normal uses case, bizarre ones like accessing the locals()
195 # will fail
195 # will fail
196 try:
196 try:
197 eval("_", None, AttrNamespace(None))
197 eval("_", None, AttrNamespace(None))
198 except TypeError:
198 except TypeError:
199 real_eval = eval
199 real_eval = eval
200 def eval(codestring, _globals, _locals):
200 def eval(codestring, _globals, _locals):
201 """
201 """
202 eval(source[, globals[, locals]]) -> value
202 eval(source[, globals[, locals]]) -> value
203
203
204 Evaluate the source in the context of globals and locals.
204 Evaluate the source in the context of globals and locals.
205 The source may be a string representing a Python expression
205 The source may be a string representing a Python expression
206 or a code object as returned by compile().
206 or a code object as returned by compile().
207 The globals must be a dictionary and locals can be any mappping.
207 The globals must be a dictionary and locals can be any mappping.
208
208
209 This function is a workaround for the shortcomings of
209 This function is a workaround for the shortcomings of
210 Python 2.3's eval.
210 Python 2.3's eval.
211 """
211 """
212
212
213 if isinstance(codestring, basestring):
213 if isinstance(codestring, basestring):
214 code = compile(codestring, "_eval", "eval")
214 code = compile(codestring, "_eval", "eval")
215 else:
215 else:
216 code = codestring
216 code = codestring
217 newlocals = {}
217 newlocals = {}
218 for name in code.co_names:
218 for name in code.co_names:
219 try:
219 try:
220 newlocals[name] = _locals[name]
220 newlocals[name] = _locals[name]
221 except KeyError:
221 except KeyError:
222 pass
222 pass
223 return real_eval(code, _globals, newlocals)
223 return real_eval(code, _globals, newlocals)
224
224
225
225
226 noitem = object()
226 noitem = object()
227
227
228 def item(iterator, index, default=noitem):
228 def item(iterator, index, default=noitem):
229 """
229 """
230 Return the ``index``th item from the iterator ``iterator``.
230 Return the ``index``th item from the iterator ``iterator``.
231 ``index`` must be an integer (negative integers are relative to the
231 ``index`` must be an integer (negative integers are relative to the
232 end (i.e. the last item produced by the iterator)).
232 end (i.e. the last item produced by the iterator)).
233
233
234 If ``default`` is given, this will be the default value when
234 If ``default`` is given, this will be the default value when
235 the iterator doesn't contain an item at this position. Otherwise an
235 the iterator doesn't contain an item at this position. Otherwise an
236 ``IndexError`` will be raised.
236 ``IndexError`` will be raised.
237
237
238 Note that using this function will partially or totally exhaust the
238 Note that using this function will partially or totally exhaust the
239 iterator.
239 iterator.
240 """
240 """
241 i = index
241 i = index
242 if i>=0:
242 if i>=0:
243 for item in iterator:
243 for item in iterator:
244 if not i:
244 if not i:
245 return item
245 return item
246 i -= 1
246 i -= 1
247 else:
247 else:
248 i = -index
248 i = -index
249 cache = deque()
249 cache = deque()
250 for item in iterator:
250 for item in iterator:
251 cache.append(item)
251 cache.append(item)
252 if len(cache)>i:
252 if len(cache)>i:
253 cache.popleft()
253 cache.popleft()
254 if len(cache)==i:
254 if len(cache)==i:
255 return cache.popleft()
255 return cache.popleft()
256 if default is noitem:
256 if default is noitem:
257 raise IndexError(index)
257 raise IndexError(index)
258 else:
258 else:
259 return default
259 return default
260
260
261
261
262 def getglobals(g):
262 def getglobals(g):
263 if g is None:
263 if g is None:
264 if ipapi is not None:
264 if ipapi is not None:
265 api = ipapi.get()
265 api = ipapi.get()
266 if api is not None:
266 if api is not None:
267 return api.user_ns
267 return api.user_ns
268 return globals()
268 return globals()
269 return g
269 return g
270
270
271
271
272 class Descriptor(object):
273 def __hash__(self):
274 return hash(self.__class__) ^ hash(self.key())
275
276 def __eq__(self, other):
277 return self.__class__ is other.__class__ and self.key() == other.key()
278
279 def __ne__(self, other):
280 return self.__class__ is not other.__class__ or self.key() != other.key()
281
282 def key(self):
283 pass
284
285 def name(self):
286 key = self.key()
287 if key is None:
288 return "_"
289 return str(key)
290
291 def attrtype(self, obj):
292 pass
293
294 def valuetype(self, obj):
295 pass
296
297 def value(self, obj):
298 pass
299
300 def doc(self, obj):
301 pass
302
303 def shortdoc(self, obj):
304 doc = self.doc(obj)
305 if doc is not None:
306 doc = doc.strip().splitlines()[0].strip()
307 return doc
308
309 def iter(self, obj):
310 return xiter(self.value(obj))
311
312
313 class SelfDescriptor(Descriptor):
314 def key(self):
315 return None
316
317 def attrtype(self, obj):
318 return "self"
319
320 def valuetype(self, obj):
321 return type(obj)
322
323 def value(self, obj):
324 return obj
325
326 def __repr__(self):
327 return "Self"
328
329 selfdescriptor = SelfDescriptor() # there's no need for more than one
330
331
332 class AttributeDescriptor(Descriptor):
333 __slots__ = ("_name", "_doc")
334
335 def __init__(self, name, doc=None):
336 self._name = name
337 self._doc = doc
338
339 def key(self):
340 return self._name
341
342 def doc(self, obj):
343 return self._doc
344
345 def attrtype(self, obj):
346 return "attr"
347
348 def valuetype(self, obj):
349 return type(getattr(obj, self._name))
350
351 def value(self, obj):
352 return getattr(obj, self._name)
353
354 def __repr__(self):
355 if self._doc is None:
356 return "Attribute(%r)" % self._name
357 else:
358 return "Attribute(%r, %r)" % (self._name, self._doc)
359
360
361 class IndexDescriptor(Descriptor):
362 __slots__ = ("_index",)
363
364 def __init__(self, index):
365 self._index = index
366
367 def key(self):
368 return self._index
369
370 def attrtype(self, obj):
371 return "item"
372
373 def valuetype(self, obj):
374 return type(obj[self._index])
375
376 def value(self, obj):
377 return obj[self._index]
378
379 def __repr__(self):
380 return "Index(%r)" % self._index
381
382
383 class MethodDescriptor(Descriptor):
384 __slots__ = ("_name", "_doc")
385
386 def __init__(self, name, doc=None):
387 self._name = name
388 self._doc = doc
389
390 def key(self):
391 return self._name
392
393 def doc(self, obj):
394 if self._doc is None:
395 return getattr(obj, self._name).__doc__
396 return self._doc
397
398 def attrtype(self, obj):
399 return "method"
400
401 def valuetype(self, obj):
402 return type(self.value(obj))
403
404 def value(self, obj):
405 return getattr(obj, self._name)()
406
407 def __repr__(self):
408 if self._doc is None:
409 return "Method(%r)" % self._name
410 else:
411 return "Method(%r, %r)" % (self._name, self._doc)
412
413
414 class IterAttributeDescriptor(Descriptor):
415 __slots__ = ("_name", "_doc")
416
417 def __init__(self, name, doc=None):
418 self._name = name
419 self._doc = doc
420
421 def key(self):
422 return self._name
423
424 def doc(self, obj):
425 return self._doc
426
427 def attrtype(self, obj):
428 return "iter"
429
430 def valuetype(self, obj):
431 return noitem
432
433 def value(self, obj):
434 return noitem
435
436 def iter(self, obj):
437 return xiter(getattr(obj, self._name))
438
439 def __repr__(self):
440 if self._doc is None:
441 return "IterAttribute(%r)" % self._name
442 else:
443 return "IterAttribute(%r, %r)" % (self._name, self._doc)
444
445
446 class IterMethodDescriptor(Descriptor):
447 __slots__ = ("_name", "_doc")
448
449 def __init__(self, name, doc=None):
450 self._name = name
451 self._doc = doc
452
453 def key(self):
454 return self._name
455
456 def doc(self, obj):
457 if self._doc is None:
458 return getattr(obj, self._name).__doc__
459 return self._doc
460
461 def attrtype(self, obj):
462 return "itermethod"
463
464 def valuetype(self, obj):
465 return noitem
466
467 def value(self, obj):
468 return noitem
469
470 def iter(self, obj):
471 return xiter(getattr(obj, self._name)())
472
473 def __repr__(self):
474 if self._doc is None:
475 return "IterMethod(%r)" % self._name
476 else:
477 return "IterMethod(%r, %r)" % (self._name, self._doc)
478
479
480 class FunctionDescriptor(Descriptor):
481 __slots__ = ("_function", "_name", "_doc")
482
483 def __init__(self, function, name=None, doc=None):
484 self._function = function
485 self._name = name
486 self._doc = doc
487
488 def key(self):
489 return self._function
490
491 def name(self):
492 if self._name is not None:
493 return self._name
494 return getattr(self._function, "__xname__", self._function.__name__)
495
496 def doc(self, obj):
497 if self._doc is None:
498 return self._function.__doc__
499 return self._doc
500
501 def attrtype(self, obj):
502 return "function"
503
504 def valuetype(self, obj):
505 return type(self._function(obj))
506
507 def value(self, obj):
508 return self._function(obj)
509
510 def __repr__(self):
511 if self._doc is None:
512 return "Function(%r)" % self._name
513 else:
514 return "Function(%r, %r)" % (self._name, self._doc)
515
516
272 class Table(object):
517 class Table(object):
273 """
518 """
274 A ``Table`` is an object that produces items (just like a normal Python
519 A ``Table`` is an object that produces items (just like a normal Python
275 iterator/generator does) and can be used as the first object in a pipeline
520 iterator/generator does) and can be used as the first object in a pipeline
276 expression. The displayhook will open the default browser for such an object
521 expression. The displayhook will open the default browser for such an object
277 (instead of simply printing the ``repr()`` result).
522 (instead of simply printing the ``repr()`` result).
278 """
523 """
279
524
280 # We want to support ``foo`` and ``foo()`` in pipeline expression:
525 # We want to support ``foo`` and ``foo()`` in pipeline expression:
281 # So we implement the required operators (``|`` and ``+``) in the metaclass,
526 # So we implement the required operators (``|`` and ``+``) in the metaclass,
282 # instantiate the class and forward the operator to the instance
527 # instantiate the class and forward the operator to the instance
283 class __metaclass__(type):
528 class __metaclass__(type):
284 def __iter__(self):
529 def __iter__(self):
285 return iter(self())
530 return iter(self())
286
531
287 def __or__(self, other):
532 def __or__(self, other):
288 return self() | other
533 return self() | other
289
534
290 def __add__(self, other):
535 def __add__(self, other):
291 return self() + other
536 return self() + other
292
537
293 def __radd__(self, other):
538 def __radd__(self, other):
294 return other + self()
539 return other + self()
295
540
296 def __getitem__(self, index):
541 def __getitem__(self, index):
297 return self()[index]
542 return self()[index]
298
543
299 def __getitem__(self, index):
544 def __getitem__(self, index):
300 return item(self, index)
545 return item(self, index)
301
546
302 def __contains__(self, item):
547 def __contains__(self, item):
303 for haveitem in self:
548 for haveitem in self:
304 if item == haveitem:
549 if item == haveitem:
305 return True
550 return True
306 return False
551 return False
307
552
308 def __or__(self, other):
553 def __or__(self, other):
309 # autoinstantiate right hand side
554 # autoinstantiate right hand side
310 if isinstance(other, type) and issubclass(other, (Table, Display)):
555 if isinstance(other, type) and issubclass(other, (Table, Display)):
311 other = other()
556 other = other()
312 # treat simple strings and functions as ``ieval`` instances
557 # treat simple strings and functions as ``ieval`` instances
313 elif not isinstance(other, Display) and not isinstance(other, Table):
558 elif not isinstance(other, Display) and not isinstance(other, Table):
314 other = ieval(other)
559 other = ieval(other)
315 # forward operations to the right hand side
560 # forward operations to the right hand side
316 return other.__ror__(self)
561 return other.__ror__(self)
317
562
318 def __add__(self, other):
563 def __add__(self, other):
319 # autoinstantiate right hand side
564 # autoinstantiate right hand side
320 if isinstance(other, type) and issubclass(other, Table):
565 if isinstance(other, type) and issubclass(other, Table):
321 other = other()
566 other = other()
322 return ichain(self, other)
567 return ichain(self, other)
323
568
324 def __radd__(self, other):
569 def __radd__(self, other):
325 # autoinstantiate left hand side
570 # autoinstantiate left hand side
326 if isinstance(other, type) and issubclass(other, Table):
571 if isinstance(other, type) and issubclass(other, Table):
327 other = other()
572 other = other()
328 return ichain(other, self)
573 return ichain(other, self)
329
574
330 def __iter__(self):
575 def __iter__(self):
331 return xiter(self, "default")
576 return xiter(self, "default")
332
577
333
578
334 class Pipe(Table):
579 class Pipe(Table):
335 """
580 """
336 A ``Pipe`` is an object that can be used in a pipeline expression. It
581 A ``Pipe`` is an object that can be used in a pipeline expression. It
337 processes the objects it gets from its input ``Table``/``Pipe``. Note that
582 processes the objects it gets from its input ``Table``/``Pipe``. Note that
338 a ``Pipe`` object can't be used as the first object in a pipeline
583 a ``Pipe`` object can't be used as the first object in a pipeline
339 expression, as it doesn't produces items itself.
584 expression, as it doesn't produces items itself.
340 """
585 """
341 class __metaclass__(Table.__metaclass__):
586 class __metaclass__(Table.__metaclass__):
342 def __ror__(self, input):
587 def __ror__(self, input):
343 return input | self()
588 return input | self()
344
589
345 def __ror__(self, input):
590 def __ror__(self, input):
346 # autoinstantiate left hand side
591 # autoinstantiate left hand side
347 if isinstance(input, type) and issubclass(input, Table):
592 if isinstance(input, type) and issubclass(input, Table):
348 input = input()
593 input = input()
349 self.input = input
594 self.input = input
350 return self
595 return self
351
596
352
597
353 def _getattr(obj, name, default=noitem):
598 def xrepr(item, mode="default"):
354 """
355 Internal helper for getting an attribute of an item. If ``name`` is ``None``
356 return the object itself. If ``name`` is an integer, use ``__getitem__``
357 instead. If the attribute or item does not exist, return ``default``.
358 """
359 if name is None:
360 return obj
361 elif isinstance(name, basestring):
362 if name.endswith("()"):
363 return getattr(obj, name[:-2], default)()
364 else:
365 return getattr(obj, name, default)
366 elif callable(name):
367 try:
368 return name(obj)
369 except AttributeError:
370 return default
371 else:
372 try:
373 return obj[name]
374 except IndexError:
375 return default
376
377
378 def _attrname(name):
379 """
380 Internal helper that gives a proper name for the attribute ``name``
381 (which might be ``None`` or an ``int``).
382 """
383 if name is None:
384 return "_"
385 elif isinstance(name, basestring):
386 return name
387 elif callable(name):
388 return getattr(name, "__xname__", name.__name__)
389 else:
390 return str(name)
391
392
393 def xrepr(item, mode):
394 try:
599 try:
395 func = item.__xrepr__
600 func = item.__xrepr__
396 except AttributeError:
601 except AttributeError:
397 pass
602 pass
398 else:
603 else:
399 try:
604 try:
400 for x in func(mode):
605 for x in func(mode):
401 yield x
606 yield x
402 except (KeyboardInterrupt, SystemExit):
607 except (KeyboardInterrupt, SystemExit):
403 raise
608 raise
404 except Exception:
609 except Exception:
405 yield (astyle.style_default, repr(item))
610 yield (astyle.style_default, repr(item))
406 return
611 return
407 if item is None:
612 if item is None:
408 yield (astyle.style_type_none, repr(item))
613 yield (astyle.style_type_none, repr(item))
409 elif isinstance(item, bool):
614 elif isinstance(item, bool):
410 yield (astyle.style_type_bool, repr(item))
615 yield (astyle.style_type_bool, repr(item))
411 elif isinstance(item, str):
616 elif isinstance(item, str):
412 if mode == "cell":
617 if mode == "cell":
413 yield (astyle.style_default, repr(item.expandtabs(tab))[1:-1])
618 yield (astyle.style_default, repr(item.expandtabs(tab))[1:-1])
414 else:
619 else:
415 yield (astyle.style_default, repr(item))
620 yield (astyle.style_default, repr(item))
416 elif isinstance(item, unicode):
621 elif isinstance(item, unicode):
417 if mode == "cell":
622 if mode == "cell":
418 yield (astyle.style_default, repr(item.expandtabs(tab))[2:-1])
623 yield (astyle.style_default, repr(item.expandtabs(tab))[2:-1])
419 else:
624 else:
420 yield (astyle.style_default, repr(item))
625 yield (astyle.style_default, repr(item))
421 elif isinstance(item, (int, long, float)):
626 elif isinstance(item, (int, long, float)):
422 yield (1, True)
627 yield (1, True)
423 yield (astyle.style_type_number, repr(item))
628 yield (astyle.style_type_number, repr(item))
424 elif isinstance(item, complex):
629 elif isinstance(item, complex):
425 yield (astyle.style_type_number, repr(item))
630 yield (astyle.style_type_number, repr(item))
426 elif isinstance(item, datetime.datetime):
631 elif isinstance(item, datetime.datetime):
427 if mode == "cell":
632 if mode == "cell":
428 # Don't use strftime() here, as this requires year >= 1900
633 # Don't use strftime() here, as this requires year >= 1900
429 yield (astyle.style_type_datetime,
634 yield (astyle.style_type_datetime,
430 "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
635 "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
431 (item.year, item.month, item.day,
636 (item.year, item.month, item.day,
432 item.hour, item.minute, item.second,
637 item.hour, item.minute, item.second,
433 item.microsecond),
638 item.microsecond),
434 )
639 )
435 else:
640 else:
436 yield (astyle.style_type_datetime, repr(item))
641 yield (astyle.style_type_datetime, repr(item))
437 elif isinstance(item, datetime.date):
642 elif isinstance(item, datetime.date):
438 if mode == "cell":
643 if mode == "cell":
439 yield (astyle.style_type_datetime,
644 yield (astyle.style_type_datetime,
440 "%04d-%02d-%02d" % (item.year, item.month, item.day))
645 "%04d-%02d-%02d" % (item.year, item.month, item.day))
441 else:
646 else:
442 yield (astyle.style_type_datetime, repr(item))
647 yield (astyle.style_type_datetime, repr(item))
443 elif isinstance(item, datetime.time):
648 elif isinstance(item, datetime.time):
444 if mode == "cell":
649 if mode == "cell":
445 yield (astyle.style_type_datetime,
650 yield (astyle.style_type_datetime,
446 "%02d:%02d:%02d.%06d" % \
651 "%02d:%02d:%02d.%06d" % \
447 (item.hour, item.minute, item.second, item.microsecond))
652 (item.hour, item.minute, item.second, item.microsecond))
448 else:
653 else:
449 yield (astyle.style_type_datetime, repr(item))
654 yield (astyle.style_type_datetime, repr(item))
450 elif isinstance(item, datetime.timedelta):
655 elif isinstance(item, datetime.timedelta):
451 yield (astyle.style_type_datetime, repr(item))
656 yield (astyle.style_type_datetime, repr(item))
657 elif isinstance(item, type):
658 if item.__module__ == "__builtin__":
659 yield (astyle.style_type_type, item.__name__)
660 else:
661 yield (astyle.style_type_type, "%s.%s" % (item.__module__, item.__name__))
452 elif isinstance(item, Exception):
662 elif isinstance(item, Exception):
453 if item.__class__.__module__ == "exceptions":
663 if item.__class__.__module__ == "exceptions":
454 classname = item.__class__.__name__
664 classname = item.__class__.__name__
455 else:
665 else:
456 classname = "%s.%s" % \
666 classname = "%s.%s" % \
457 (item.__class__.__module__, item.__class__.__name__)
667 (item.__class__.__module__, item.__class__.__name__)
458 if mode == "header" or mode == "footer":
668 if mode == "header" or mode == "footer":
459 yield (astyle.style_error, "%s: %s" % (classname, item))
669 yield (astyle.style_error, "%s: %s" % (classname, item))
460 else:
670 else:
461 yield (astyle.style_error, classname)
671 yield (astyle.style_error, classname)
462 elif isinstance(item, (list, tuple)):
672 elif isinstance(item, (list, tuple)):
463 if mode == "header" or mode == "footer":
673 if mode == "header" or mode == "footer":
464 if item.__class__.__module__ == "__builtin__":
674 if item.__class__.__module__ == "__builtin__":
465 classname = item.__class__.__name__
675 classname = item.__class__.__name__
466 else:
676 else:
467 classname = "%s.%s" % \
677 classname = "%s.%s" % \
468 (item.__class__.__module__,item.__class__.__name__)
678 (item.__class__.__module__,item.__class__.__name__)
469 yield (astyle.style_default,
679 yield (astyle.style_default,
470 "<%s object with %d items at 0x%x>" % \
680 "<%s object with %d items at 0x%x>" % \
471 (classname, len(item), id(item)))
681 (classname, len(item), id(item)))
472 else:
682 else:
473 yield (-1, False)
683 yield (-1, False)
474 if isinstance(item, list):
684 if isinstance(item, list):
475 yield (astyle.style_default, "[")
685 yield (astyle.style_default, "[")
476 end = "]"
686 end = "]"
477 else:
687 else:
478 yield (astyle.style_default, "(")
688 yield (astyle.style_default, "(")
479 end = ")"
689 end = ")"
480 for (i, subitem) in enumerate(item):
690 for (i, subitem) in enumerate(item):
481 if i:
691 if i:
482 yield (astyle.style_default, ", ")
692 yield (astyle.style_default, ", ")
483 for part in xrepr(subitem, "default"):
693 for part in xrepr(subitem, "default"):
484 yield part
694 yield part
485 yield (astyle.style_default, end)
695 yield (astyle.style_default, end)
486 elif isinstance(item, (dict, types.DictProxyType)):
696 elif isinstance(item, (dict, types.DictProxyType)):
487 if mode == "header" or mode == "footer":
697 if mode == "header" or mode == "footer":
488 if item.__class__.__module__ == "__builtin__":
698 if item.__class__.__module__ == "__builtin__":
489 classname = item.__class__.__name__
699 classname = item.__class__.__name__
490 else:
700 else:
491 classname = "%s.%s" % \
701 classname = "%s.%s" % \
492 (item.__class__.__module__,item.__class__.__name__)
702 (item.__class__.__module__,item.__class__.__name__)
493 yield (astyle.style_default,
703 yield (astyle.style_default,
494 "<%s object with %d items at 0x%x>" % \
704 "<%s object with %d items at 0x%x>" % \
495 (classname, len(item), id(item)))
705 (classname, len(item), id(item)))
496 else:
706 else:
497 yield (-1, False)
707 yield (-1, False)
498 if isinstance(item, dict):
708 if isinstance(item, dict):
499 yield (astyle.style_default, "{")
709 yield (astyle.style_default, "{")
500 end = "}"
710 end = "}"
501 else:
711 else:
502 yield (astyle.style_default, "dictproxy((")
712 yield (astyle.style_default, "dictproxy((")
503 end = "})"
713 end = "})"
504 for (i, (key, value)) in enumerate(item.iteritems()):
714 for (i, (key, value)) in enumerate(item.iteritems()):
505 if i:
715 if i:
506 yield (astyle.style_default, ", ")
716 yield (astyle.style_default, ", ")
507 for part in xrepr(key, "default"):
717 for part in xrepr(key, "default"):
508 yield part
718 yield part
509 yield (astyle.style_default, ": ")
719 yield (astyle.style_default, ": ")
510 for part in xrepr(value, "default"):
720 for part in xrepr(value, "default"):
511 yield part
721 yield part
512 yield (astyle.style_default, end)
722 yield (astyle.style_default, end)
513 else:
723 else:
514 yield (astyle.style_default, repr(item))
724 yield (astyle.style_default, repr(item))
515
725
516
726
517 def xattrs(item, mode):
727 def upgradexattr(attr):
728 if attr is None:
729 return selfdescriptor
730 elif isinstance(attr, Descriptor):
731 return attr
732 elif isinstance(attr, str):
733 if attr.endswith("()"):
734 if attr.startswith("-"):
735 return IterMethodDescriptor(attr[1:-2])
736 else:
737 return MethodDescriptor(attr[:-2])
738 else:
739 if attr.startswith("-"):
740 return IterAttributeDescriptor(attr[1:])
741 else:
742 return AttributeDescriptor(attr)
743 elif isinstance(attr, (int, long)):
744 return IndexDescriptor(attr)
745 elif callable(attr):
746 return FunctionDescriptor(attr)
747 else:
748 raise TypeError("can't handle descriptor %r" % attr)
749
750
751 def xattrs(item, mode="default"):
518 try:
752 try:
519 func = item.__xattrs__
753 func = item.__xattrs__
520 except AttributeError:
754 except AttributeError:
521 if mode == "detail":
755 if mode == "detail":
522 return dir(item)
756 for attrname in dir(item):
757 yield AttributeDescriptor(attrname)
523 else:
758 else:
524 return (None,)
759 yield selfdescriptor
525 else:
760 else:
761 for attr in func(mode):
762 yield upgradexattr(attr)
763
764
765 def _isdict(item):
526 try:
766 try:
527 return func(mode)
767 itermeth = item.__class__.__iter__
528 except (KeyboardInterrupt, SystemExit):
768 except (AttributeError, TypeError):
529 raise
769 return False
530 except Exception:
770 return itermeth is dict.__iter__ or itermeth is types.DictProxyType.__iter__
531 return (None,)
532
771
533
772
534 def xiter(item, mode):
773 def _isstr(item):
535 if mode == "detail":
774 if not isinstance(item, basestring):
536 def items():
775 return False
537 for name in xattrs(item, mode):
776 try:
538 yield XAttr(item, name)
777 itermeth = item.__class__.__iter__
539 return items()
778 except AttributeError:
779 return True
780 return False # ``__iter__`` has been redefined
781
782
783 def xiter(item, mode="default"):
540 try:
784 try:
541 func = item.__xiter__
785 func = item.__xiter__
542 except AttributeError:
786 except AttributeError:
543 if isinstance(item, (dict, types.DictProxyType)):
787 if _isdict(item):
544 def items(item):
788 def items(item):
545 fields = ("key", "value")
789 fields = ("key", "value")
546 for (key, value) in item.iteritems():
790 for (key, value) in item.iteritems():
547 yield Fields(fields, key=key, value=value)
791 yield Fields(fields, key=key, value=value)
548 return items(item)
792 return items(item)
549 elif isinstance(item, new.module):
793 elif isinstance(item, new.module):
550 def items(item):
794 def items(item):
551 fields = ("key", "value")
795 fields = ("key", "value")
552 for key in sorted(item.__dict__):
796 for key in sorted(item.__dict__):
553 yield Fields(fields, key=key, value=getattr(item, key))
797 yield Fields(fields, key=key, value=getattr(item, key))
554 return items(item)
798 return items(item)
555 elif isinstance(item, basestring):
799 elif _isstr(item):
556 if not len(item):
800 if not item:
557 raise ValueError("can't enter empty string")
801 raise ValueError("can't enter empty string")
558 lines = item.splitlines()
802 lines = item.splitlines()
559 if len(lines) <= 1:
803 if len(lines) <= 1:
560 raise ValueError("can't enter one line string")
804 raise ValueError("can't enter one line string")
561 return iter(lines)
805 return iter(lines)
562 return iter(item)
806 return iter(item)
563 else:
807 else:
564 return iter(func(mode)) # iter() just to be safe
808 return iter(func(mode)) # iter() just to be safe
565
809
566
810
567 class ichain(Pipe):
811 class ichain(Pipe):
568 """
812 """
569 Chains multiple ``Table``s into one.
813 Chains multiple ``Table``s into one.
570 """
814 """
571
815
572 def __init__(self, *iters):
816 def __init__(self, *iters):
573 self.iters = iters
817 self.iters = iters
574
818
575 def __xiter__(self, mode):
819 def __iter__(self):
576 return itertools.chain(*self.iters)
820 return itertools.chain(*self.iters)
577
821
578 def __xrepr__(self, mode):
822 def __xrepr__(self, mode):
579 if mode == "header" or mode == "footer":
823 if mode == "header" or mode == "footer":
580 for (i, item) in enumerate(self.iters):
824 for (i, item) in enumerate(self.iters):
581 if i:
825 if i:
582 yield (astyle.style_default, "+")
826 yield (astyle.style_default, "+")
583 if isinstance(item, Pipe):
827 if isinstance(item, Pipe):
584 yield (astyle.style_default, "(")
828 yield (astyle.style_default, "(")
585 for part in xrepr(item, mode):
829 for part in xrepr(item, mode):
586 yield part
830 yield part
587 if isinstance(item, Pipe):
831 if isinstance(item, Pipe):
588 yield (astyle.style_default, ")")
832 yield (astyle.style_default, ")")
589 else:
833 else:
590 yield (astyle.style_default, repr(self))
834 yield (astyle.style_default, repr(self))
591
835
592 def __repr__(self):
836 def __repr__(self):
593 args = ", ".join([repr(it) for it in self.iters])
837 args = ", ".join([repr(it) for it in self.iters])
594 return "%s.%s(%s)" % \
838 return "%s.%s(%s)" % \
595 (self.__class__.__module__, self.__class__.__name__, args)
839 (self.__class__.__module__, self.__class__.__name__, args)
596
840
597
841
598 class ifile(path.path):
842 class ifile(path.path):
599 """
843 """
600 file (or directory) object.
844 file (or directory) object.
601 """
845 """
602
846
603 def __add_(self, other):
847 def __add_(self, other):
604 return ifile(path._base(self) + other)
848 return ifile(path._base(self) + other)
605
849
606 def __radd_(self, other):
850 def __radd_(self, other):
607 return ifile(other + path._base(self))
851 return ifile(other + path._base(self))
608
852
609 def __div_(self, other):
853 def __div_(self, other):
610 return ifile(path.__div__(self, other))
854 return ifile(path.__div__(self, other))
611
855
612 def getcwd():
856 def getcwd():
613 return ifile(path.path.getcwd())
857 return ifile(path.path.getcwd())
614 getcwd.__doc__ = path.path.getcwd.__doc__
858 getcwd.__doc__ = path.path.getcwd.__doc__
615 getcwd = staticmethod(getcwd)
859 getcwd = staticmethod(getcwd)
616
860
617 def abspath(self):
861 def abspath(self):
618 return ifile(path.path.abspath(self))
862 return ifile(path.path.abspath(self))
619 abspath.__doc__ = path.path.abspath.__doc__
863 abspath.__doc__ = path.path.abspath.__doc__
620
864
621 def normcase(self):
865 def normcase(self):
622 return ifile(path.path.normcase(self))
866 return ifile(path.path.normcase(self))
623 normcase.__doc__ = path.path.normcase.__doc__
867 normcase.__doc__ = path.path.normcase.__doc__
624
868
625 def normpath(self):
869 def normpath(self):
626 return ifile(path.path.normpath(self))
870 return ifile(path.path.normpath(self))
627 normpath.__doc__ = path.path.normpath.__doc__
871 normpath.__doc__ = path.path.normpath.__doc__
628
872
629 def realpath(self):
873 def realpath(self):
630 return ifile(path.path.realpath(self))
874 return ifile(path.path.realpath(self))
631 realpath.__doc__ = path.path.realpath.__doc__
875 realpath.__doc__ = path.path.realpath.__doc__
632
876
633 def expanduser(self):
877 def expanduser(self):
634 return ifile(path.path.expanduser(self))
878 return ifile(path.path.expanduser(self))
635 expanduser.__doc__ = path.path.expanduser.__doc__
879 expanduser.__doc__ = path.path.expanduser.__doc__
636
880
637 def expandvars(self):
881 def expandvars(self):
638 return ifile(path.path.expandvars(self))
882 return ifile(path.path.expandvars(self))
639 expandvars.__doc__ = path.path.expandvars.__doc__
883 expandvars.__doc__ = path.path.expandvars.__doc__
640
884
641 def dirname(self):
885 def dirname(self):
642 return ifile(path.path.dirname(self))
886 return ifile(path.path.dirname(self))
643 dirname.__doc__ = path.path.dirname.__doc__
887 dirname.__doc__ = path.path.dirname.__doc__
644
888
645 parent = property(dirname, None, None, path.path.parent.__doc__)
889 parent = property(dirname, None, None, path.path.parent.__doc__)
646
890
647 def splitpath(self):
891 def splitpath(self):
648 (parent, child) = path.path.splitpath(self)
892 (parent, child) = path.path.splitpath(self)
649 return (ifile(parent), child)
893 return (ifile(parent), child)
650 splitpath.__doc__ = path.path.splitpath.__doc__
894 splitpath.__doc__ = path.path.splitpath.__doc__
651
895
652 def splitdrive(self):
896 def splitdrive(self):
653 (drive, rel) = path.path.splitdrive(self)
897 (drive, rel) = path.path.splitdrive(self)
654 return (ifile(drive), rel)
898 return (ifile(drive), rel)
655 splitdrive.__doc__ = path.path.splitdrive.__doc__
899 splitdrive.__doc__ = path.path.splitdrive.__doc__
656
900
657 def splitext(self):
901 def splitext(self):
658 (filename, ext) = path.path.splitext(self)
902 (filename, ext) = path.path.splitext(self)
659 return (ifile(filename), ext)
903 return (ifile(filename), ext)
660 splitext.__doc__ = path.path.splitext.__doc__
904 splitext.__doc__ = path.path.splitext.__doc__
661
905
662 if hasattr(path.path, "splitunc"):
906 if hasattr(path.path, "splitunc"):
663 def splitunc(self):
907 def splitunc(self):
664 (unc, rest) = path.path.splitunc(self)
908 (unc, rest) = path.path.splitunc(self)
665 return (ifile(unc), rest)
909 return (ifile(unc), rest)
666 splitunc.__doc__ = path.path.splitunc.__doc__
910 splitunc.__doc__ = path.path.splitunc.__doc__
667
911
668 def _get_uncshare(self):
912 def _get_uncshare(self):
669 unc, r = os.path.splitunc(self)
913 unc, r = os.path.splitunc(self)
670 return ifile(unc)
914 return ifile(unc)
671
915
672 uncshare = property(
916 uncshare = property(
673 _get_uncshare, None, None,
917 _get_uncshare, None, None,
674 """ The UNC mount point for this path.
918 """ The UNC mount point for this path.
675 This is empty for paths on local drives. """)
919 This is empty for paths on local drives. """)
676
920
677 def joinpath(self, *args):
921 def joinpath(self, *args):
678 return ifile(path.path.joinpath(self, *args))
922 return ifile(path.path.joinpath(self, *args))
679 joinpath.__doc__ = path.path.joinpath.__doc__
923 joinpath.__doc__ = path.path.joinpath.__doc__
680
924
681 def splitall(self):
925 def splitall(self):
682 return map(ifile, path.path.splitall(self))
926 return map(ifile, path.path.splitall(self))
683 splitall.__doc__ = path.path.splitall.__doc__
927 splitall.__doc__ = path.path.splitall.__doc__
684
928
685 def relpath(self):
929 def relpath(self):
686 return ifile(path.path.relpath(self))
930 return ifile(path.path.relpath(self))
687 relpath.__doc__ = path.path.relpath.__doc__
931 relpath.__doc__ = path.path.relpath.__doc__
688
932
689 def relpathto(self, dest):
933 def relpathto(self, dest):
690 return ifile(path.path.relpathto(self, dest))
934 return ifile(path.path.relpathto(self, dest))
691 relpathto.__doc__ = path.path.relpathto.__doc__
935 relpathto.__doc__ = path.path.relpathto.__doc__
692
936
693 def listdir(self, pattern=None):
937 def listdir(self, pattern=None):
694 return [ifile(child) for child in path.path.listdir(self, pattern)]
938 return [ifile(child) for child in path.path.listdir(self, pattern)]
695 listdir.__doc__ = path.path.listdir.__doc__
939 listdir.__doc__ = path.path.listdir.__doc__
696
940
697 def dirs(self, pattern=None):
941 def dirs(self, pattern=None):
698 return [ifile(child) for child in path.path.dirs(self, pattern)]
942 return [ifile(child) for child in path.path.dirs(self, pattern)]
699 dirs.__doc__ = path.path.dirs.__doc__
943 dirs.__doc__ = path.path.dirs.__doc__
700
944
701 def files(self, pattern=None):
945 def files(self, pattern=None):
702 return [ifile(child) for child in path.path.files(self, pattern)]
946 return [ifile(child) for child in path.path.files(self, pattern)]
703 files.__doc__ = path.path.files.__doc__
947 files.__doc__ = path.path.files.__doc__
704
948
705 def walk(self, pattern=None):
949 def walk(self, pattern=None):
706 for child in path.path.walk(self, pattern):
950 for child in path.path.walk(self, pattern):
707 yield ifile(child)
951 yield ifile(child)
708 walk.__doc__ = path.path.walk.__doc__
952 walk.__doc__ = path.path.walk.__doc__
709
953
710 def walkdirs(self, pattern=None):
954 def walkdirs(self, pattern=None):
711 for child in path.path.walkdirs(self, pattern):
955 for child in path.path.walkdirs(self, pattern):
712 yield ifile(child)
956 yield ifile(child)
713 walkdirs.__doc__ = path.path.walkdirs.__doc__
957 walkdirs.__doc__ = path.path.walkdirs.__doc__
714
958
715 def walkfiles(self, pattern=None):
959 def walkfiles(self, pattern=None):
716 for child in path.path.walkfiles(self, pattern):
960 for child in path.path.walkfiles(self, pattern):
717 yield ifile(child)
961 yield ifile(child)
718 walkfiles.__doc__ = path.path.walkfiles.__doc__
962 walkfiles.__doc__ = path.path.walkfiles.__doc__
719
963
720 def glob(self, pattern):
964 def glob(self, pattern):
721 return map(ifile, path.path.glob(self, pattern))
965 return map(ifile, path.path.glob(self, pattern))
722 glob.__doc__ = path.path.glob.__doc__
966 glob.__doc__ = path.path.glob.__doc__
723
967
724 if hasattr(os, 'readlink'):
968 if hasattr(os, 'readlink'):
725 def readlink(self):
969 def readlink(self):
726 return ifile(path.path.readlink(self))
970 return ifile(path.path.readlink(self))
727 readlink.__doc__ = path.path.readlink.__doc__
971 readlink.__doc__ = path.path.readlink.__doc__
728
972
729 def readlinkabs(self):
973 def readlinkabs(self):
730 return ifile(path.path.readlinkabs(self))
974 return ifile(path.path.readlinkabs(self))
731 readlinkabs.__doc__ = path.path.readlinkabs.__doc__
975 readlinkabs.__doc__ = path.path.readlinkabs.__doc__
732
976
733 def getmode(self):
977 def getmode(self):
734 return self.stat().st_mode
978 return self.stat().st_mode
735 mode = property(getmode, None, None, "Access mode")
979 mode = property(getmode, None, None, "Access mode")
736
980
737 def gettype(self):
981 def gettype(self):
738 data = [
982 data = [
739 (stat.S_ISREG, "file"),
983 (stat.S_ISREG, "file"),
740 (stat.S_ISDIR, "dir"),
984 (stat.S_ISDIR, "dir"),
741 (stat.S_ISCHR, "chardev"),
985 (stat.S_ISCHR, "chardev"),
742 (stat.S_ISBLK, "blockdev"),
986 (stat.S_ISBLK, "blockdev"),
743 (stat.S_ISFIFO, "fifo"),
987 (stat.S_ISFIFO, "fifo"),
744 (stat.S_ISLNK, "symlink"),
988 (stat.S_ISLNK, "symlink"),
745 (stat.S_ISSOCK,"socket"),
989 (stat.S_ISSOCK,"socket"),
746 ]
990 ]
747 lstat = self.lstat()
991 lstat = self.lstat()
748 if lstat is not None:
992 if lstat is not None:
749 types = set([text for (func, text) in data if func(lstat.st_mode)])
993 types = set([text for (func, text) in data if func(lstat.st_mode)])
750 else:
994 else:
751 types = set()
995 types = set()
752 m = self.mode
996 m = self.mode
753 types.update([text for (func, text) in data if func(m)])
997 types.update([text for (func, text) in data if func(m)])
754 return ", ".join(types)
998 return ", ".join(types)
755 type = property(gettype, None, None, "file type (file, directory, link, etc.)")
999 type = property(gettype, None, None, "file type (file, directory, link, etc.)")
756
1000
757 def getmodestr(self):
1001 def getmodestr(self):
758 m = self.mode
1002 m = self.mode
759 data = [
1003 data = [
760 (stat.S_IRUSR, "-r"),
1004 (stat.S_IRUSR, "-r"),
761 (stat.S_IWUSR, "-w"),
1005 (stat.S_IWUSR, "-w"),
762 (stat.S_IXUSR, "-x"),
1006 (stat.S_IXUSR, "-x"),
763 (stat.S_IRGRP, "-r"),
1007 (stat.S_IRGRP, "-r"),
764 (stat.S_IWGRP, "-w"),
1008 (stat.S_IWGRP, "-w"),
765 (stat.S_IXGRP, "-x"),
1009 (stat.S_IXGRP, "-x"),
766 (stat.S_IROTH, "-r"),
1010 (stat.S_IROTH, "-r"),
767 (stat.S_IWOTH, "-w"),
1011 (stat.S_IWOTH, "-w"),
768 (stat.S_IXOTH, "-x"),
1012 (stat.S_IXOTH, "-x"),
769 ]
1013 ]
770 return "".join([text[bool(m&bit)] for (bit, text) in data])
1014 return "".join([text[bool(m&bit)] for (bit, text) in data])
771
1015
772 modestr = property(getmodestr, None, None, "Access mode as string")
1016 modestr = property(getmodestr, None, None, "Access mode as string")
773
1017
774 def getblocks(self):
1018 def getblocks(self):
775 return self.stat().st_blocks
1019 return self.stat().st_blocks
776 blocks = property(getblocks, None, None, "File size in blocks")
1020 blocks = property(getblocks, None, None, "File size in blocks")
777
1021
778 def getblksize(self):
1022 def getblksize(self):
779 return self.stat().st_blksize
1023 return self.stat().st_blksize
780 blksize = property(getblksize, None, None, "Filesystem block size")
1024 blksize = property(getblksize, None, None, "Filesystem block size")
781
1025
782 def getdev(self):
1026 def getdev(self):
783 return self.stat().st_dev
1027 return self.stat().st_dev
784 dev = property(getdev)
1028 dev = property(getdev)
785
1029
786 def getnlink(self):
1030 def getnlink(self):
787 return self.stat().st_nlink
1031 return self.stat().st_nlink
788 nlink = property(getnlink, None, None, "Number of links")
1032 nlink = property(getnlink, None, None, "Number of links")
789
1033
790 def getuid(self):
1034 def getuid(self):
791 return self.stat().st_uid
1035 return self.stat().st_uid
792 uid = property(getuid, None, None, "User id of file owner")
1036 uid = property(getuid, None, None, "User id of file owner")
793
1037
794 def getgid(self):
1038 def getgid(self):
795 return self.stat().st_gid
1039 return self.stat().st_gid
796 gid = property(getgid, None, None, "Group id of file owner")
1040 gid = property(getgid, None, None, "Group id of file owner")
797
1041
798 def getowner(self):
1042 def getowner(self):
799 stat = self.stat()
1043 stat = self.stat()
800 try:
1044 try:
801 return pwd.getpwuid(stat.st_uid).pw_name
1045 return pwd.getpwuid(stat.st_uid).pw_name
802 except KeyError:
1046 except KeyError:
803 return stat.st_uid
1047 return stat.st_uid
804 owner = property(getowner, None, None, "Owner name (or id)")
1048 owner = property(getowner, None, None, "Owner name (or id)")
805
1049
806 def getgroup(self):
1050 def getgroup(self):
807 stat = self.stat()
1051 stat = self.stat()
808 try:
1052 try:
809 return grp.getgrgid(stat.st_gid).gr_name
1053 return grp.getgrgid(stat.st_gid).gr_name
810 except KeyError:
1054 except KeyError:
811 return stat.st_gid
1055 return stat.st_gid
812 group = property(getgroup, None, None, "Group name (or id)")
1056 group = property(getgroup, None, None, "Group name (or id)")
813
1057
814 def getadate(self):
1058 def getadate(self):
815 return datetime.datetime.utcfromtimestamp(self.atime)
1059 return datetime.datetime.utcfromtimestamp(self.atime)
816 adate = property(getadate, None, None, "Access date")
1060 adate = property(getadate, None, None, "Access date")
817
1061
818 def getcdate(self):
1062 def getcdate(self):
819 return datetime.datetime.utcfromtimestamp(self.ctime)
1063 return datetime.datetime.utcfromtimestamp(self.ctime)
820 cdate = property(getcdate, None, None, "Creation date")
1064 cdate = property(getcdate, None, None, "Creation date")
821
1065
822 def getmdate(self):
1066 def getmdate(self):
823 return datetime.datetime.utcfromtimestamp(self.mtime)
1067 return datetime.datetime.utcfromtimestamp(self.mtime)
824 mdate = property(getmdate, None, None, "Modification date")
1068 mdate = property(getmdate, None, None, "Modification date")
825
1069
826 def getmimetype(self):
1070 def mimetype(self):
1071 """
1072 Return MIME type guessed from the extension.
1073 """
827 return mimetypes.guess_type(self.basename())[0]
1074 return mimetypes.guess_type(self.basename())[0]
828 mimetype = property(getmimetype, None, None, "MIME type")
829
1075
830 def getencoding(self):
1076 def encoding(self):
1077 """
1078 Return guessed compression (like "compress" or "gzip").
1079 """
831 return mimetypes.guess_type(self.basename())[1]
1080 return mimetypes.guess_type(self.basename())[1]
832 encoding = property(getencoding, None, None, "Compression")
833
1081
834 def __repr__(self):
1082 def __repr__(self):
835 return "ifile(%s)" % path._base.__repr__(self)
1083 return "ifile(%s)" % path._base.__repr__(self)
836
1084
837 defaultattrs = (None, "type", "size", "modestr", "owner", "group", "mdate")
838
839 def __xattrs__(self, mode):
1085 def __xattrs__(self, mode):
840 if mode == "detail":
1086 if mode == "detail":
841 return (
1087 return (
842 "name", "basename()", "abspath()", "realpath()",
1088 "name",
843 "type", "mode", "modestr", "stat()", "lstat()",
1089 "basename()",
844 "uid", "gid", "owner", "group", "dev", "nlink",
1090 "abspath()",
845 "ctime", "mtime", "atime", "cdate", "mdate", "adate",
1091 "realpath()",
846 "size", "blocks", "blksize", "isdir()", "islink()",
1092 "type",
847 "mimetype", "encoding"
1093 "mode",
1094 "modestr",
1095 "stat()",
1096 "lstat()",
1097 "uid",
1098 "gid",
1099 "owner",
1100 "group",
1101 "dev",
1102 "nlink",
1103 "ctime",
1104 "mtime",
1105 "atime",
1106 "cdate",
1107 "mdate",
1108 "adate",
1109 "size",
1110 "blocks",
1111 "blksize",
1112 "isdir()",
1113 "islink()",
1114 "mimetype()",
1115 "encoding()",
1116 "-listdir()",
1117 "-dirs()",
1118 "-files()",
1119 "-walk()",
1120 "-walkdirs()",
1121 "-walkfiles()",
848 )
1122 )
849 return self.defaultattrs
1123 else:
1124 return (None, "type", "size", "modestr", "owner", "group", "mdate")
850
1125
851 def __xrepr__(self, mode):
1126 def __xrepr__(self, mode):
852 try:
1127 try:
853 if self.isdir():
1128 if self.isdir():
854 name = "idir"
1129 name = "idir"
855 style = astyle.style_dir
1130 style = astyle.style_dir
856 else:
1131 else:
857 name = "ifile"
1132 name = "ifile"
858 style = astyle.style_file
1133 style = astyle.style_file
859 except IOError:
1134 except IOError:
860 name = "ifile"
1135 name = "ifile"
861 style = astyle.style_default
1136 style = astyle.style_default
862 if mode == "cell" or mode in "header" or mode == "footer":
1137 if mode == "cell" or mode in "header" or mode == "footer":
863 abspath = repr(path._base(self.normpath()))
1138 abspath = repr(path._base(self.normpath()))
864 if abspath.startswith("u"):
1139 if abspath.startswith("u"):
865 abspath = abspath[2:-1]
1140 abspath = abspath[2:-1]
866 else:
1141 else:
867 abspath = abspath[1:-1]
1142 abspath = abspath[1:-1]
868 if mode == "cell":
1143 if mode == "cell":
869 yield (style, abspath)
1144 yield (style, abspath)
870 else:
1145 else:
871 yield (style, "%s(%s)" % (name, abspath))
1146 yield (style, "%s(%s)" % (name, abspath))
872 else:
1147 else:
873 yield (style, repr(self))
1148 yield (style, repr(self))
874
1149
875 def __xiter__(self, mode):
1150 def __iter__(self):
876 if self.isdir():
1151 if self.isdir():
877 yield iparentdir(self / os.pardir)
1152 yield iparentdir(self / os.pardir)
878 for child in sorted(self.listdir()):
1153 for child in sorted(self.listdir()):
879 yield child
1154 yield child
880 else:
1155 else:
881 f = self.open("rb")
1156 f = self.open("rb")
882 for line in f:
1157 for line in f:
883 yield line
1158 yield line
884 f.close()
1159 f.close()
885
1160
886
1161
887 class iparentdir(ifile):
1162 class iparentdir(ifile):
888 def __xrepr__(self, mode):
1163 def __xrepr__(self, mode):
889 if mode == "cell":
1164 if mode == "cell":
890 yield (astyle.style_dir, os.pardir)
1165 yield (astyle.style_dir, os.pardir)
891 else:
1166 else:
892 for part in ifile.__xrepr__(self, mode):
1167 for part in ifile.__xrepr__(self, mode):
893 yield part
1168 yield part
894
1169
895
1170
896 class ils(Table):
1171 class ils(Table):
897 """
1172 """
898 List the current (or a specific) directory.
1173 List the current (or a specific) directory.
899
1174
900 Examples:
1175 Examples:
901
1176
902 >>> ils
1177 >>> ils
903 >>> ils("/usr/local/lib/python2.4")
1178 >>> ils("/usr/local/lib/python2.4")
904 >>> ils("~")
1179 >>> ils("~")
905 """
1180 """
906 def __init__(self, base=os.curdir):
1181 def __init__(self, base=os.curdir):
907 self.base = os.path.expanduser(base)
1182 self.base = os.path.expanduser(base)
908
1183
909 def __xiter__(self, mode):
1184 def __iter__(self):
910 return xiter(ifile(self.base), mode)
1185 return xiter(ifile(self.base))
911
1186
912 def __xrepr__(self, mode):
1187 def __xrepr__(self, mode):
913 return ifile(self.base).__xrepr__(mode)
1188 return ifile(self.base).__xrepr__(mode)
914
1189
915 def __repr__(self):
1190 def __repr__(self):
916 return "%s.%s(%r)" % \
1191 return "%s.%s(%r)" % \
917 (self.__class__.__module__, self.__class__.__name__, self.base)
1192 (self.__class__.__module__, self.__class__.__name__, self.base)
918
1193
919
1194
920 class iglob(Table):
1195 class iglob(Table):
921 """
1196 """
922 List all files and directories matching a specified pattern.
1197 List all files and directories matching a specified pattern.
923 (See ``glob.glob()`` for more info.).
1198 (See ``glob.glob()`` for more info.).
924
1199
925 Examples:
1200 Examples:
926
1201
927 >>> iglob("*.py")
1202 >>> iglob("*.py")
928 """
1203 """
929 def __init__(self, glob):
1204 def __init__(self, glob):
930 self.glob = glob
1205 self.glob = glob
931
1206
932 def __xiter__(self, mode):
1207 def __iter__(self):
933 for name in glob.glob(self.glob):
1208 for name in glob.glob(self.glob):
934 yield ifile(name)
1209 yield ifile(name)
935
1210
936 def __xrepr__(self, mode):
1211 def __xrepr__(self, mode):
937 if mode == "header" or mode == "footer" or mode == "cell":
1212 if mode == "header" or mode == "footer" or mode == "cell":
938 yield (astyle.style_default,
1213 yield (astyle.style_default,
939 "%s(%r)" % (self.__class__.__name__, self.glob))
1214 "%s(%r)" % (self.__class__.__name__, self.glob))
940 else:
1215 else:
941 yield (astyle.style_default, repr(self))
1216 yield (astyle.style_default, repr(self))
942
1217
943 def __repr__(self):
1218 def __repr__(self):
944 return "%s.%s(%r)" % \
1219 return "%s.%s(%r)" % \
945 (self.__class__.__module__, self.__class__.__name__, self.glob)
1220 (self.__class__.__module__, self.__class__.__name__, self.glob)
946
1221
947
1222
948 class iwalk(Table):
1223 class iwalk(Table):
949 """
1224 """
950 List all files and directories in a directory and it's subdirectory.
1225 List all files and directories in a directory and it's subdirectory.
951
1226
952 >>> iwalk
1227 >>> iwalk
953 >>> iwalk("/usr/local/lib/python2.4")
1228 >>> iwalk("/usr/local/lib/python2.4")
954 >>> iwalk("~")
1229 >>> iwalk("~")
955 """
1230 """
956 def __init__(self, base=os.curdir, dirs=True, files=True):
1231 def __init__(self, base=os.curdir, dirs=True, files=True):
957 self.base = os.path.expanduser(base)
1232 self.base = os.path.expanduser(base)
958 self.dirs = dirs
1233 self.dirs = dirs
959 self.files = files
1234 self.files = files
960
1235
961 def __xiter__(self, mode):
1236 def __iter__(self):
962 for (dirpath, dirnames, filenames) in os.walk(self.base):
1237 for (dirpath, dirnames, filenames) in os.walk(self.base):
963 if self.dirs:
1238 if self.dirs:
964 for name in sorted(dirnames):
1239 for name in sorted(dirnames):
965 yield ifile(os.path.join(dirpath, name))
1240 yield ifile(os.path.join(dirpath, name))
966 if self.files:
1241 if self.files:
967 for name in sorted(filenames):
1242 for name in sorted(filenames):
968 yield ifile(os.path.join(dirpath, name))
1243 yield ifile(os.path.join(dirpath, name))
969
1244
970 def __xrepr__(self, mode):
1245 def __xrepr__(self, mode):
971 if mode == "header" or mode == "footer" or mode == "cell":
1246 if mode == "header" or mode == "footer" or mode == "cell":
972 yield (astyle.style_default,
1247 yield (astyle.style_default,
973 "%s(%r)" % (self.__class__.__name__, self.base))
1248 "%s(%r)" % (self.__class__.__name__, self.base))
974 else:
1249 else:
975 yield (astyle.style_default, repr(self))
1250 yield (astyle.style_default, repr(self))
976
1251
977 def __repr__(self):
1252 def __repr__(self):
978 return "%s.%s(%r)" % \
1253 return "%s.%s(%r)" % \
979 (self.__class__.__module__, self.__class__.__name__, self.base)
1254 (self.__class__.__module__, self.__class__.__name__, self.base)
980
1255
981
1256
982 class ipwdentry(object):
1257 class ipwdentry(object):
983 """
1258 """
984 ``ipwdentry`` objects encapsulate entries in the Unix user account and
1259 ``ipwdentry`` objects encapsulate entries in the Unix user account and
985 password database.
1260 password database.
986 """
1261 """
987 def __init__(self, id):
1262 def __init__(self, id):
988 self._id = id
1263 self._id = id
989 self._entry = None
1264 self._entry = None
990
1265
991 def _getentry(self):
1266 def _getentry(self):
992 if self._entry is None:
1267 if self._entry is None:
993 if isinstance(self._id, basestring):
1268 if isinstance(self._id, basestring):
994 self._entry = pwd.getpwnam(self._id)
1269 self._entry = pwd.getpwnam(self._id)
995 else:
1270 else:
996 self._entry = pwd.getpwuid(self._id)
1271 self._entry = pwd.getpwuid(self._id)
997 return self._entry
1272 return self._entry
998
1273
999 def getname(self):
1274 def getname(self):
1000 if isinstance(self._id, basestring):
1275 if isinstance(self._id, basestring):
1001 return self._id
1276 return self._id
1002 else:
1277 else:
1003 return self._getentry().pw_name
1278 return self._getentry().pw_name
1004 name = property(getname, None, None, "User name")
1279 name = property(getname, None, None, "User name")
1005
1280
1006 def getpasswd(self):
1281 def getpasswd(self):
1007 return self._getentry().pw_passwd
1282 return self._getentry().pw_passwd
1008 passwd = property(getpasswd, None, None, "Password")
1283 passwd = property(getpasswd, None, None, "Password")
1009
1284
1010 def getuid(self):
1285 def getuid(self):
1011 if isinstance(self._id, basestring):
1286 if isinstance(self._id, basestring):
1012 return self._getentry().pw_uid
1287 return self._getentry().pw_uid
1013 else:
1288 else:
1014 return self._id
1289 return self._id
1015 uid = property(getuid, None, None, "User id")
1290 uid = property(getuid, None, None, "User id")
1016
1291
1017 def getgid(self):
1292 def getgid(self):
1018 return self._getentry().pw_gid
1293 return self._getentry().pw_gid
1019 gid = property(getgid, None, None, "Primary group id")
1294 gid = property(getgid, None, None, "Primary group id")
1020
1295
1021 def getgroup(self):
1296 def getgroup(self):
1022 return igrpentry(self.gid)
1297 return igrpentry(self.gid)
1023 group = property(getgroup, None, None, "Group")
1298 group = property(getgroup, None, None, "Group")
1024
1299
1025 def getgecos(self):
1300 def getgecos(self):
1026 return self._getentry().pw_gecos
1301 return self._getentry().pw_gecos
1027 gecos = property(getgecos, None, None, "Information (e.g. full user name)")
1302 gecos = property(getgecos, None, None, "Information (e.g. full user name)")
1028
1303
1029 def getdir(self):
1304 def getdir(self):
1030 return self._getentry().pw_dir
1305 return self._getentry().pw_dir
1031 dir = property(getdir, None, None, "$HOME directory")
1306 dir = property(getdir, None, None, "$HOME directory")
1032
1307
1033 def getshell(self):
1308 def getshell(self):
1034 return self._getentry().pw_shell
1309 return self._getentry().pw_shell
1035 shell = property(getshell, None, None, "Login shell")
1310 shell = property(getshell, None, None, "Login shell")
1036
1311
1037 def __xattrs__(self, mode):
1312 def __xattrs__(self, mode):
1038 return ("name", "passwd", "uid", "gid", "gecos", "dir", "shell")
1313 return ("name", "passwd", "uid", "gid", "gecos", "dir", "shell")
1039
1314
1040 def __repr__(self):
1315 def __repr__(self):
1041 return "%s.%s(%r)" % \
1316 return "%s.%s(%r)" % \
1042 (self.__class__.__module__, self.__class__.__name__, self._id)
1317 (self.__class__.__module__, self.__class__.__name__, self._id)
1043
1318
1044
1319
1045 class ipwd(Table):
1320 class ipwd(Table):
1046 """
1321 """
1047 List all entries in the Unix user account and password database.
1322 List all entries in the Unix user account and password database.
1048
1323
1049 Example:
1324 Example:
1050
1325
1051 >>> ipwd | isort("uid")
1326 >>> ipwd | isort("uid")
1052 """
1327 """
1053 def __iter__(self):
1328 def __iter__(self):
1054 for entry in pwd.getpwall():
1329 for entry in pwd.getpwall():
1055 yield ipwdentry(entry.pw_name)
1330 yield ipwdentry(entry.pw_name)
1056
1331
1057 def __xrepr__(self, mode):
1332 def __xrepr__(self, mode):
1058 if mode == "header" or mode == "footer" or mode == "cell":
1333 if mode == "header" or mode == "footer" or mode == "cell":
1059 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1334 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1060 else:
1335 else:
1061 yield (astyle.style_default, repr(self))
1336 yield (astyle.style_default, repr(self))
1062
1337
1063
1338
1064 class igrpentry(object):
1339 class igrpentry(object):
1065 """
1340 """
1066 ``igrpentry`` objects encapsulate entries in the Unix group database.
1341 ``igrpentry`` objects encapsulate entries in the Unix group database.
1067 """
1342 """
1068 def __init__(self, id):
1343 def __init__(self, id):
1069 self._id = id
1344 self._id = id
1070 self._entry = None
1345 self._entry = None
1071
1346
1072 def _getentry(self):
1347 def _getentry(self):
1073 if self._entry is None:
1348 if self._entry is None:
1074 if isinstance(self._id, basestring):
1349 if isinstance(self._id, basestring):
1075 self._entry = grp.getgrnam(self._id)
1350 self._entry = grp.getgrnam(self._id)
1076 else:
1351 else:
1077 self._entry = grp.getgrgid(self._id)
1352 self._entry = grp.getgrgid(self._id)
1078 return self._entry
1353 return self._entry
1079
1354
1080 def getname(self):
1355 def getname(self):
1081 if isinstance(self._id, basestring):
1356 if isinstance(self._id, basestring):
1082 return self._id
1357 return self._id
1083 else:
1358 else:
1084 return self._getentry().gr_name
1359 return self._getentry().gr_name
1085 name = property(getname, None, None, "Group name")
1360 name = property(getname, None, None, "Group name")
1086
1361
1087 def getpasswd(self):
1362 def getpasswd(self):
1088 return self._getentry().gr_passwd
1363 return self._getentry().gr_passwd
1089 passwd = property(getpasswd, None, None, "Password")
1364 passwd = property(getpasswd, None, None, "Password")
1090
1365
1091 def getgid(self):
1366 def getgid(self):
1092 if isinstance(self._id, basestring):
1367 if isinstance(self._id, basestring):
1093 return self._getentry().gr_gid
1368 return self._getentry().gr_gid
1094 else:
1369 else:
1095 return self._id
1370 return self._id
1096 gid = property(getgid, None, None, "Group id")
1371 gid = property(getgid, None, None, "Group id")
1097
1372
1098 def getmem(self):
1373 def getmem(self):
1099 return self._getentry().gr_mem
1374 return self._getentry().gr_mem
1100 mem = property(getmem, None, None, "Members")
1375 mem = property(getmem, None, None, "Members")
1101
1376
1102 def __xattrs__(self, mode):
1377 def __xattrs__(self, mode):
1103 return ("name", "passwd", "gid", "mem")
1378 return ("name", "passwd", "gid", "mem")
1104
1379
1105 def __xrepr__(self, mode):
1380 def __xrepr__(self, mode):
1106 if mode == "header" or mode == "footer" or mode == "cell":
1381 if mode == "header" or mode == "footer" or mode == "cell":
1107 yield (astyle.style_default, "group ")
1382 yield (astyle.style_default, "group ")
1108 try:
1383 try:
1109 yield (astyle.style_default, self.name)
1384 yield (astyle.style_default, self.name)
1110 except KeyError:
1385 except KeyError:
1111 if isinstance(self._id, basestring):
1386 if isinstance(self._id, basestring):
1112 yield (astyle.style_default, self.name_id)
1387 yield (astyle.style_default, self.name_id)
1113 else:
1388 else:
1114 yield (astyle.style_type_number, str(self._id))
1389 yield (astyle.style_type_number, str(self._id))
1115 else:
1390 else:
1116 yield (astyle.style_default, repr(self))
1391 yield (astyle.style_default, repr(self))
1117
1392
1118 def __xiter__(self, mode):
1393 def __iter__(self):
1119 for member in self.mem:
1394 for member in self.mem:
1120 yield ipwdentry(member)
1395 yield ipwdentry(member)
1121
1396
1122 def __repr__(self):
1397 def __repr__(self):
1123 return "%s.%s(%r)" % \
1398 return "%s.%s(%r)" % \
1124 (self.__class__.__module__, self.__class__.__name__, self._id)
1399 (self.__class__.__module__, self.__class__.__name__, self._id)
1125
1400
1126
1401
1127 class igrp(Table):
1402 class igrp(Table):
1128 """
1403 """
1129 This ``Table`` lists all entries in the Unix group database.
1404 This ``Table`` lists all entries in the Unix group database.
1130 """
1405 """
1131 def __xiter__(self, mode):
1406 def __iter__(self):
1132 for entry in grp.getgrall():
1407 for entry in grp.getgrall():
1133 yield igrpentry(entry.gr_name)
1408 yield igrpentry(entry.gr_name)
1134
1409
1135 def __xrepr__(self, mode):
1410 def __xrepr__(self, mode):
1136 if mode == "header" or mode == "footer":
1411 if mode == "header" or mode == "footer":
1137 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1412 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1138 else:
1413 else:
1139 yield (astyle.style_default, repr(self))
1414 yield (astyle.style_default, repr(self))
1140
1415
1141
1416
1142 class Fields(object):
1417 class Fields(object):
1143 def __init__(self, fieldnames, **fields):
1418 def __init__(self, fieldnames, **fields):
1144 self.__fieldnames = fieldnames
1419 self.__fieldnames = [upgradexattr(fieldname) for fieldname in fieldnames]
1145 for (key, value) in fields.iteritems():
1420 for (key, value) in fields.iteritems():
1146 setattr(self, key, value)
1421 setattr(self, key, value)
1147
1422
1148 def __xattrs__(self, mode):
1423 def __xattrs__(self, mode):
1149 return self.__fieldnames
1424 return self.__fieldnames
1150
1425
1151 def __xrepr__(self, mode):
1426 def __xrepr__(self, mode):
1152 yield (-1, False)
1427 yield (-1, False)
1153 if mode == "header" or mode == "cell":
1428 if mode == "header" or mode == "cell":
1154 yield (astyle.style_default, self.__class__.__name__)
1429 yield (astyle.style_default, self.__class__.__name__)
1155 yield (astyle.style_default, "(")
1430 yield (astyle.style_default, "(")
1156 for (i, f) in enumerate(self.__fieldnames):
1431 for (i, f) in enumerate(self.__fieldnames):
1157 if i:
1432 if i:
1158 yield (astyle.style_default, ", ")
1433 yield (astyle.style_default, ", ")
1159 yield (astyle.style_default, f)
1434 yield (astyle.style_default, f.name())
1160 yield (astyle.style_default, "=")
1435 yield (astyle.style_default, "=")
1161 for part in xrepr(getattr(self, f), "default"):
1436 for part in xrepr(getattr(self, f), "default"):
1162 yield part
1437 yield part
1163 yield (astyle.style_default, ")")
1438 yield (astyle.style_default, ")")
1164 elif mode == "footer":
1439 elif mode == "footer":
1165 yield (astyle.style_default, self.__class__.__name__)
1440 yield (astyle.style_default, self.__class__.__name__)
1166 yield (astyle.style_default, "(")
1441 yield (astyle.style_default, "(")
1167 for (i, f) in enumerate(self.__fieldnames):
1442 for (i, f) in enumerate(self.__fieldnames):
1168 if i:
1443 if i:
1169 yield (astyle.style_default, ", ")
1444 yield (astyle.style_default, ", ")
1170 yield (astyle.style_default, f)
1445 yield (astyle.style_default, f.name())
1171 yield (astyle.style_default, ")")
1446 yield (astyle.style_default, ")")
1172 else:
1447 else:
1173 yield (astyle.style_default, repr(self))
1448 yield (astyle.style_default, repr(self))
1174
1449
1175
1450
1176 class FieldTable(Table, list):
1451 class FieldTable(Table, list):
1177 def __init__(self, *fields):
1452 def __init__(self, *fields):
1178 Table.__init__(self)
1453 Table.__init__(self)
1179 list.__init__(self)
1454 list.__init__(self)
1180 self.fields = fields
1455 self.fields = fields
1181
1456
1182 def add(self, **fields):
1457 def add(self, **fields):
1183 self.append(Fields(self.fields, **fields))
1458 self.append(Fields(self.fields, **fields))
1184
1459
1185 def __xiter__(self, mode):
1186 return list.__iter__(self)
1187
1188 def __xrepr__(self, mode):
1460 def __xrepr__(self, mode):
1189 yield (-1, False)
1461 yield (-1, False)
1190 if mode == "header" or mode == "footer":
1462 if mode == "header" or mode == "footer":
1191 yield (astyle.style_default, self.__class__.__name__)
1463 yield (astyle.style_default, self.__class__.__name__)
1192 yield (astyle.style_default, "(")
1464 yield (astyle.style_default, "(")
1193 for (i, f) in enumerate(self.__fieldnames):
1465 for (i, f) in enumerate(self.__fieldnames):
1194 if i:
1466 if i:
1195 yield (astyle.style_default, ", ")
1467 yield (astyle.style_default, ", ")
1196 yield (astyle.style_default, f)
1468 yield (astyle.style_default, f)
1197 yield (astyle.style_default, ")")
1469 yield (astyle.style_default, ")")
1198 else:
1470 else:
1199 yield (astyle.style_default, repr(self))
1471 yield (astyle.style_default, repr(self))
1200
1472
1201 def __repr__(self):
1473 def __repr__(self):
1202 return "<%s.%s object with fields=%r at 0x%x>" % \
1474 return "<%s.%s object with fields=%r at 0x%x>" % \
1203 (self.__class__.__module__, self.__class__.__name__,
1475 (self.__class__.__module__, self.__class__.__name__,
1204 ", ".join(map(repr, self.fields)), id(self))
1476 ", ".join(map(repr, self.fields)), id(self))
1205
1477
1206
1478
1207 class List(list):
1479 class List(list):
1208 def __xattrs__(self, mode):
1480 def __xattrs__(self, mode):
1209 return xrange(len(self))
1481 return xrange(len(self))
1210
1482
1211 def __xrepr__(self, mode):
1483 def __xrepr__(self, mode):
1212 yield (-1, False)
1484 yield (-1, False)
1213 if mode == "header" or mode == "cell" or mode == "footer" or mode == "default":
1485 if mode == "header" or mode == "cell" or mode == "footer" or mode == "default":
1214 yield (astyle.style_default, self.__class__.__name__)
1486 yield (astyle.style_default, self.__class__.__name__)
1215 yield (astyle.style_default, "(")
1487 yield (astyle.style_default, "(")
1216 for (i, item) in enumerate(self):
1488 for (i, item) in enumerate(self):
1217 if i:
1489 if i:
1218 yield (astyle.style_default, ", ")
1490 yield (astyle.style_default, ", ")
1219 for part in xrepr(item, "default"):
1491 for part in xrepr(item, "default"):
1220 yield part
1492 yield part
1221 yield (astyle.style_default, ")")
1493 yield (astyle.style_default, ")")
1222 else:
1494 else:
1223 yield (astyle.style_default, repr(self))
1495 yield (astyle.style_default, repr(self))
1224
1496
1225
1497
1226 class ienv(Table):
1498 class ienv(Table):
1227 """
1499 """
1228 List environment variables.
1500 List environment variables.
1229
1501
1230 Example:
1502 Example:
1231
1503
1232 >>> ienv
1504 >>> ienv
1233 """
1505 """
1234
1506
1235 def __xiter__(self, mode):
1507 def __iter__(self):
1236 fields = ("key", "value")
1508 fields = ("key", "value")
1237 for (key, value) in os.environ.iteritems():
1509 for (key, value) in os.environ.iteritems():
1238 yield Fields(fields, key=key, value=value)
1510 yield Fields(fields, key=key, value=value)
1239
1511
1240 def __xrepr__(self, mode):
1512 def __xrepr__(self, mode):
1241 if mode == "header" or mode == "cell":
1513 if mode == "header" or mode == "cell":
1242 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1514 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1243 else:
1515 else:
1244 yield (astyle.style_default, repr(self))
1516 yield (astyle.style_default, repr(self))
1245
1517
1246
1518
1247 class icsv(Pipe):
1519 class icsv(Pipe):
1248 """
1520 """
1249 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
1521 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
1250 or an ``ifile``) into lines of CVS columns.
1522 or an ``ifile``) into lines of CVS columns.
1251 """
1523 """
1252 def __init__(self, **csvargs):
1524 def __init__(self, **csvargs):
1253 """
1525 """
1254 Create an ``icsv`` object. ``cvsargs`` will be passed through as
1526 Create an ``icsv`` object. ``cvsargs`` will be passed through as
1255 keyword arguments to ``cvs.reader()``.
1527 keyword arguments to ``cvs.reader()``.
1256 """
1528 """
1257 self.csvargs = csvargs
1529 self.csvargs = csvargs
1258
1530
1259 def __xiter__(self, mode):
1531 def __iter__(self):
1260 input = self.input
1532 input = self.input
1261 if isinstance(input, ifile):
1533 if isinstance(input, ifile):
1262 input = input.open("rb")
1534 input = input.open("rb")
1263 reader = csv.reader(input, **self.csvargs)
1535 reader = csv.reader(input, **self.csvargs)
1264 for line in reader:
1536 for line in reader:
1265 yield List(line)
1537 yield List(line)
1266
1538
1267 def __xrepr__(self, mode):
1539 def __xrepr__(self, mode):
1268 yield (-1, False)
1540 yield (-1, False)
1269 if mode == "header" or mode == "footer":
1541 if mode == "header" or mode == "footer":
1270 input = getattr(self, "input", None)
1542 input = getattr(self, "input", None)
1271 if input is not None:
1543 if input is not None:
1272 for part in xrepr(input, mode):
1544 for part in xrepr(input, mode):
1273 yield part
1545 yield part
1274 yield (astyle.style_default, " | ")
1546 yield (astyle.style_default, " | ")
1275 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1547 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1276 for (i, (name, value)) in enumerate(self.csvargs.iteritems()):
1548 for (i, (name, value)) in enumerate(self.csvargs.iteritems()):
1277 if i:
1549 if i:
1278 yield (astyle.style_default, ", ")
1550 yield (astyle.style_default, ", ")
1279 yield (astyle.style_default, name)
1551 yield (astyle.style_default, name)
1280 yield (astyle.style_default, "=")
1552 yield (astyle.style_default, "=")
1281 for part in xrepr(value, "default"):
1553 for part in xrepr(value, "default"):
1282 yield part
1554 yield part
1283 yield (astyle.style_default, ")")
1555 yield (astyle.style_default, ")")
1284 else:
1556 else:
1285 yield (astyle.style_default, repr(self))
1557 yield (astyle.style_default, repr(self))
1286
1558
1287 def __repr__(self):
1559 def __repr__(self):
1288 args = ", ".join(["%s=%r" % item for item in self.csvargs.iteritems()])
1560 args = ", ".join(["%s=%r" % item for item in self.csvargs.iteritems()])
1289 return "<%s.%s %s at 0x%x>" % \
1561 return "<%s.%s %s at 0x%x>" % \
1290 (self.__class__.__module__, self.__class__.__name__, args, id(self))
1562 (self.__class__.__module__, self.__class__.__name__, args, id(self))
1291
1563
1292
1564
1293 class ix(Table):
1565 class ix(Table):
1294 """
1566 """
1295 Execute a system command and list its output as lines
1567 Execute a system command and list its output as lines
1296 (similar to ``os.popen()``).
1568 (similar to ``os.popen()``).
1297
1569
1298 Examples:
1570 Examples:
1299
1571
1300 >>> ix("ps x")
1572 >>> ix("ps x")
1301 >>> ix("find .") | ifile
1573 >>> ix("find .") | ifile
1302 """
1574 """
1303 def __init__(self, cmd):
1575 def __init__(self, cmd):
1304 self.cmd = cmd
1576 self.cmd = cmd
1305 self._pipeout = None
1577 self._pipeout = None
1306
1578
1307 def __xiter__(self, mode="default"):
1579 def __iter__(self):
1308 (_pipein, self._pipeout) = os.popen4(self.cmd)
1580 (_pipein, self._pipeout) = os.popen4(self.cmd)
1309 _pipein.close()
1581 _pipein.close()
1310 for l in self._pipeout:
1582 for l in self._pipeout:
1311 yield l.rstrip("\r\n")
1583 yield l.rstrip("\r\n")
1312 self._pipeout.close()
1584 self._pipeout.close()
1313 self._pipeout = None
1585 self._pipeout = None
1314
1586
1315 def __del__(self):
1587 def __del__(self):
1316 if self._pipeout is not None and not self._pipeout.closed:
1588 if self._pipeout is not None and not self._pipeout.closed:
1317 self._pipeout.close()
1589 self._pipeout.close()
1318 self._pipeout = None
1590 self._pipeout = None
1319
1591
1320 def __xrepr__(self, mode):
1592 def __xrepr__(self, mode):
1321 if mode == "header" or mode == "footer":
1593 if mode == "header" or mode == "footer":
1322 yield (astyle.style_default,
1594 yield (astyle.style_default,
1323 "%s(%r)" % (self.__class__.__name__, self.cmd))
1595 "%s(%r)" % (self.__class__.__name__, self.cmd))
1324 else:
1596 else:
1325 yield (astyle.style_default, repr(self))
1597 yield (astyle.style_default, repr(self))
1326
1598
1327 def __repr__(self):
1599 def __repr__(self):
1328 return "%s.%s(%r)" % \
1600 return "%s.%s(%r)" % \
1329 (self.__class__.__module__, self.__class__.__name__, self.cmd)
1601 (self.__class__.__module__, self.__class__.__name__, self.cmd)
1330
1602
1331
1603
1332 class ifilter(Pipe):
1604 class ifilter(Pipe):
1333 """
1605 """
1334 Filter an input pipe. Only objects where an expression evaluates to true
1606 Filter an input pipe. Only objects where an expression evaluates to true
1335 (and doesn't raise an exception) are listed.
1607 (and doesn't raise an exception) are listed.
1336
1608
1337 Examples:
1609 Examples:
1338
1610
1339 >>> ils | ifilter("_.isfile() and size>1000")
1611 >>> ils | ifilter("_.isfile() and size>1000")
1340 >>> igrp | ifilter("len(mem)")
1612 >>> igrp | ifilter("len(mem)")
1341 >>> sys.modules | ifilter(lambda _:_.value is not None)
1613 >>> sys.modules | ifilter(lambda _:_.value is not None)
1342 """
1614 """
1343
1615
1344 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1616 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1345 """
1617 """
1346 Create an ``ifilter`` object. ``expr`` can be a callable or a string
1618 Create an ``ifilter`` object. ``expr`` can be a callable or a string
1347 containing an expression. ``globals`` will be used as the global
1619 containing an expression. ``globals`` will be used as the global
1348 namespace for calling string expressions (defaulting to IPython's
1620 namespace for calling string expressions (defaulting to IPython's
1349 user namespace). ``errors`` specifies how exception during evaluation
1621 user namespace). ``errors`` specifies how exception during evaluation
1350 of ``expr`` are handled:
1622 of ``expr`` are handled:
1351
1623
1352 * ``drop``: drop all items that have errors;
1624 * ``drop``: drop all items that have errors;
1353
1625
1354 * ``keep``: keep all items that have errors;
1626 * ``keep``: keep all items that have errors;
1355
1627
1356 * ``keeperror``: keep the exception of all items that have errors;
1628 * ``keeperror``: keep the exception of all items that have errors;
1357
1629
1358 * ``raise``: raise the exception;
1630 * ``raise``: raise the exception;
1359
1631
1360 * ``raiseifallfail``: raise the first exception if all items have errors;
1632 * ``raiseifallfail``: raise the first exception if all items have errors;
1361 otherwise drop those with errors (this is the default).
1633 otherwise drop those with errors (this is the default).
1362 """
1634 """
1363 self.expr = expr
1635 self.expr = expr
1364 self.globals = globals
1636 self.globals = globals
1365 self.errors = errors
1637 self.errors = errors
1366
1638
1367 def __xiter__(self, mode):
1639 def __iter__(self):
1368 if callable(self.expr):
1640 if callable(self.expr):
1369 test = self.expr
1641 test = self.expr
1370 else:
1642 else:
1371 g = getglobals(self.globals)
1643 g = getglobals(self.globals)
1372 expr = compile(self.expr, "ipipe-expression", "eval")
1644 expr = compile(self.expr, "ipipe-expression", "eval")
1373 def test(item):
1645 def test(item):
1374 return eval(expr, g, AttrNamespace(item))
1646 return eval(expr, g, AttrNamespace(item))
1375
1647
1376 ok = 0
1648 ok = 0
1377 exc_info = None
1649 exc_info = None
1378 for item in xiter(self.input, mode):
1650 for item in xiter(self.input):
1379 try:
1651 try:
1380 if test(item):
1652 if test(item):
1381 yield item
1653 yield item
1382 ok += 1
1654 ok += 1
1383 except (KeyboardInterrupt, SystemExit):
1655 except (KeyboardInterrupt, SystemExit):
1384 raise
1656 raise
1385 except Exception, exc:
1657 except Exception, exc:
1386 if self.errors == "drop":
1658 if self.errors == "drop":
1387 pass # Ignore errors
1659 pass # Ignore errors
1388 elif self.errors == "keep":
1660 elif self.errors == "keep":
1389 yield item
1661 yield item
1390 elif self.errors == "keeperror":
1662 elif self.errors == "keeperror":
1391 yield exc
1663 yield exc
1392 elif self.errors == "raise":
1664 elif self.errors == "raise":
1393 raise
1665 raise
1394 elif self.errors == "raiseifallfail":
1666 elif self.errors == "raiseifallfail":
1395 if exc_info is None:
1667 if exc_info is None:
1396 exc_info = sys.exc_info()
1668 exc_info = sys.exc_info()
1397 if not ok and exc_info is not None:
1669 if not ok and exc_info is not None:
1398 raise exc_info[0], exc_info[1], exc_info[2]
1670 raise exc_info[0], exc_info[1], exc_info[2]
1399
1671
1400 def __xrepr__(self, mode):
1672 def __xrepr__(self, mode):
1401 if mode == "header" or mode == "footer":
1673 if mode == "header" or mode == "footer":
1402 input = getattr(self, "input", None)
1674 input = getattr(self, "input", None)
1403 if input is not None:
1675 if input is not None:
1404 for part in xrepr(input, mode):
1676 for part in xrepr(input, mode):
1405 yield part
1677 yield part
1406 yield (astyle.style_default, " | ")
1678 yield (astyle.style_default, " | ")
1407 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1679 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1408 for part in xrepr(self.expr, "default"):
1680 for part in xrepr(self.expr, "default"):
1409 yield part
1681 yield part
1410 yield (astyle.style_default, ")")
1682 yield (astyle.style_default, ")")
1411 else:
1683 else:
1412 yield (astyle.style_default, repr(self))
1684 yield (astyle.style_default, repr(self))
1413
1685
1414 def __repr__(self):
1686 def __repr__(self):
1415 return "<%s.%s expr=%r at 0x%x>" % \
1687 return "<%s.%s expr=%r at 0x%x>" % \
1416 (self.__class__.__module__, self.__class__.__name__,
1688 (self.__class__.__module__, self.__class__.__name__,
1417 self.expr, id(self))
1689 self.expr, id(self))
1418
1690
1419
1691
1420 class ieval(Pipe):
1692 class ieval(Pipe):
1421 """
1693 """
1422 Evaluate an expression for each object in the input pipe.
1694 Evaluate an expression for each object in the input pipe.
1423
1695
1424 Examples:
1696 Examples:
1425
1697
1426 >>> ils | ieval("_.abspath()")
1698 >>> ils | ieval("_.abspath()")
1427 >>> sys.path | ieval(ifile)
1699 >>> sys.path | ieval(ifile)
1428 """
1700 """
1429
1701
1430 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1702 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1431 """
1703 """
1432 Create an ``ieval`` object. ``expr`` can be a callable or a string
1704 Create an ``ieval`` object. ``expr`` can be a callable or a string
1433 containing an expression. For the meaning of ``globals`` and
1705 containing an expression. For the meaning of ``globals`` and
1434 ``errors`` see ``ifilter``.
1706 ``errors`` see ``ifilter``.
1435 """
1707 """
1436 self.expr = expr
1708 self.expr = expr
1437 self.globals = globals
1709 self.globals = globals
1438 self.errors = errors
1710 self.errors = errors
1439
1711
1440 def __xiter__(self, mode):
1712 def __iter__(self):
1441 if callable(self.expr):
1713 if callable(self.expr):
1442 do = self.expr
1714 do = self.expr
1443 else:
1715 else:
1444 g = getglobals(self.globals)
1716 g = getglobals(self.globals)
1445 expr = compile(self.expr, "ipipe-expression", "eval")
1717 expr = compile(self.expr, "ipipe-expression", "eval")
1446 def do(item):
1718 def do(item):
1447 return eval(expr, g, AttrNamespace(item))
1719 return eval(expr, g, AttrNamespace(item))
1448
1720
1449 ok = 0
1721 ok = 0
1450 exc_info = None
1722 exc_info = None
1451 for item in xiter(self.input, mode):
1723 for item in xiter(self.input):
1452 try:
1724 try:
1453 yield do(item)
1725 yield do(item)
1454 except (KeyboardInterrupt, SystemExit):
1726 except (KeyboardInterrupt, SystemExit):
1455 raise
1727 raise
1456 except Exception, exc:
1728 except Exception, exc:
1457 if self.errors == "drop":
1729 if self.errors == "drop":
1458 pass # Ignore errors
1730 pass # Ignore errors
1459 elif self.errors == "keep":
1731 elif self.errors == "keep":
1460 yield item
1732 yield item
1461 elif self.errors == "keeperror":
1733 elif self.errors == "keeperror":
1462 yield exc
1734 yield exc
1463 elif self.errors == "raise":
1735 elif self.errors == "raise":
1464 raise
1736 raise
1465 elif self.errors == "raiseifallfail":
1737 elif self.errors == "raiseifallfail":
1466 if exc_info is None:
1738 if exc_info is None:
1467 exc_info = sys.exc_info()
1739 exc_info = sys.exc_info()
1468 if not ok and exc_info is not None:
1740 if not ok and exc_info is not None:
1469 raise exc_info[0], exc_info[1], exc_info[2]
1741 raise exc_info[0], exc_info[1], exc_info[2]
1470
1742
1471 def __xrepr__(self, mode):
1743 def __xrepr__(self, mode):
1472 if mode == "header" or mode == "footer":
1744 if mode == "header" or mode == "footer":
1473 input = getattr(self, "input", None)
1745 input = getattr(self, "input", None)
1474 if input is not None:
1746 if input is not None:
1475 for part in xrepr(input, mode):
1747 for part in xrepr(input, mode):
1476 yield part
1748 yield part
1477 yield (astyle.style_default, " | ")
1749 yield (astyle.style_default, " | ")
1478 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1750 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1479 for part in xrepr(self.expr, "default"):
1751 for part in xrepr(self.expr, "default"):
1480 yield part
1752 yield part
1481 yield (astyle.style_default, ")")
1753 yield (astyle.style_default, ")")
1482 else:
1754 else:
1483 yield (astyle.style_default, repr(self))
1755 yield (astyle.style_default, repr(self))
1484
1756
1485 def __repr__(self):
1757 def __repr__(self):
1486 return "<%s.%s expr=%r at 0x%x>" % \
1758 return "<%s.%s expr=%r at 0x%x>" % \
1487 (self.__class__.__module__, self.__class__.__name__,
1759 (self.__class__.__module__, self.__class__.__name__,
1488 self.expr, id(self))
1760 self.expr, id(self))
1489
1761
1490
1762
1491 class ienum(Pipe):
1763 class ienum(Pipe):
1492 """
1764 """
1493 Enumerate the input pipe (i.e. wrap each input object in an object
1765 Enumerate the input pipe (i.e. wrap each input object in an object
1494 with ``index`` and ``object`` attributes).
1766 with ``index`` and ``object`` attributes).
1495
1767
1496 Examples:
1768 Examples:
1497
1769
1498 >>> xrange(20) | ieval("_,_*_") | ienum | ifilter("index % 2 == 0") | ieval("object")
1770 >>> xrange(20) | ieval("_,_*_") | ienum | ifilter("index % 2 == 0") | ieval("object")
1499 """
1771 """
1500 def __xiter__(self, mode):
1772 def __iter__(self):
1501 fields = ("index", "object")
1773 fields = ("index", "object")
1502 for (index, object) in enumerate(xiter(self.input, mode)):
1774 for (index, object) in enumerate(xiter(self.input)):
1503 yield Fields(fields, index=index, object=object)
1775 yield Fields(fields, index=index, object=object)
1504
1776
1505
1777
1506 class isort(Pipe):
1778 class isort(Pipe):
1507 """
1779 """
1508 Sorts the input pipe.
1780 Sorts the input pipe.
1509
1781
1510 Examples:
1782 Examples:
1511
1783
1512 >>> ils | isort("size")
1784 >>> ils | isort("size")
1513 >>> ils | isort("_.isdir(), _.lower()", reverse=True)
1785 >>> ils | isort("_.isdir(), _.lower()", reverse=True)
1514 """
1786 """
1515
1787
1516 def __init__(self, key=None, globals=None, reverse=False):
1788 def __init__(self, key=None, globals=None, reverse=False):
1517 """
1789 """
1518 Create an ``isort`` object. ``key`` can be a callable or a string
1790 Create an ``isort`` object. ``key`` can be a callable or a string
1519 containing an expression (or ``None`` in which case the items
1791 containing an expression (or ``None`` in which case the items
1520 themselves will be sorted). If ``reverse`` is true the sort order
1792 themselves will be sorted). If ``reverse`` is true the sort order
1521 will be reversed. For the meaning of ``globals`` see ``ifilter``.
1793 will be reversed. For the meaning of ``globals`` see ``ifilter``.
1522 """
1794 """
1523 self.key = key
1795 self.key = key
1524 self.globals = globals
1796 self.globals = globals
1525 self.reverse = reverse
1797 self.reverse = reverse
1526
1798
1527 def __xiter__(self, mode):
1799 def __iter__(self):
1528 if self.key is None:
1800 if self.key is None:
1529 items = sorted(
1801 items = sorted(xiter(self.input), reverse=self.reverse)
1530 xiter(self.input, mode),
1531 reverse=self.reverse
1532 )
1533 elif callable(self.key):
1802 elif callable(self.key):
1534 items = sorted(
1803 items = sorted(xiter(self.input), key=self.key, reverse=self.reverse)
1535 xiter(self.input, mode),
1536 key=self.key,
1537 reverse=self.reverse
1538 )
1539 else:
1804 else:
1540 g = getglobals(self.globals)
1805 g = getglobals(self.globals)
1541 key = compile(self.key, "ipipe-expression", "eval")
1806 key = compile(self.key, "ipipe-expression", "eval")
1542 def realkey(item):
1807 def realkey(item):
1543 return eval(key, g, AttrNamespace(item))
1808 return eval(key, g, AttrNamespace(item))
1544 items = sorted(
1809 items = sorted(
1545 xiter(self.input, mode),
1810 xiter(self.input, mode),
1546 key=realkey,
1811 key=realkey,
1547 reverse=self.reverse
1812 reverse=self.reverse
1548 )
1813 )
1549 for item in items:
1814 for item in items:
1550 yield item
1815 yield item
1551
1816
1552 def __xrepr__(self, mode):
1817 def __xrepr__(self, mode):
1553 if mode == "header" or mode == "footer":
1818 if mode == "header" or mode == "footer":
1554 input = getattr(self, "input", None)
1819 input = getattr(self, "input", None)
1555 if input is not None:
1820 if input is not None:
1556 for part in xrepr(input, mode):
1821 for part in xrepr(input, mode):
1557 yield part
1822 yield part
1558 yield (astyle.style_default, " | ")
1823 yield (astyle.style_default, " | ")
1559 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1824 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1560 for part in xrepr(self.key, "default"):
1825 for part in xrepr(self.key, "default"):
1561 yield part
1826 yield part
1562 if self.reverse:
1827 if self.reverse:
1563 yield (astyle.style_default, ", ")
1828 yield (astyle.style_default, ", ")
1564 for part in xrepr(True, "default"):
1829 for part in xrepr(True, "default"):
1565 yield part
1830 yield part
1566 yield (astyle.style_default, ")")
1831 yield (astyle.style_default, ")")
1567 else:
1832 else:
1568 yield (astyle.style_default, repr(self))
1833 yield (astyle.style_default, repr(self))
1569
1834
1570 def __repr__(self):
1835 def __repr__(self):
1571 return "<%s.%s key=%r reverse=%r at 0x%x>" % \
1836 return "<%s.%s key=%r reverse=%r at 0x%x>" % \
1572 (self.__class__.__module__, self.__class__.__name__,
1837 (self.__class__.__module__, self.__class__.__name__,
1573 self.key, self.reverse, id(self))
1838 self.key, self.reverse, id(self))
1574
1839
1575
1840
1576 tab = 3 # for expandtabs()
1841 tab = 3 # for expandtabs()
1577
1842
1578 def _format(field):
1843 def _format(field):
1579 if isinstance(field, str):
1844 if isinstance(field, str):
1580 text = repr(field.expandtabs(tab))[1:-1]
1845 text = repr(field.expandtabs(tab))[1:-1]
1581 elif isinstance(field, unicode):
1846 elif isinstance(field, unicode):
1582 text = repr(field.expandtabs(tab))[2:-1]
1847 text = repr(field.expandtabs(tab))[2:-1]
1583 elif isinstance(field, datetime.datetime):
1848 elif isinstance(field, datetime.datetime):
1584 # Don't use strftime() here, as this requires year >= 1900
1849 # Don't use strftime() here, as this requires year >= 1900
1585 text = "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
1850 text = "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
1586 (field.year, field.month, field.day,
1851 (field.year, field.month, field.day,
1587 field.hour, field.minute, field.second, field.microsecond)
1852 field.hour, field.minute, field.second, field.microsecond)
1588 elif isinstance(field, datetime.date):
1853 elif isinstance(field, datetime.date):
1589 text = "%04d-%02d-%02d" % (field.year, field.month, field.day)
1854 text = "%04d-%02d-%02d" % (field.year, field.month, field.day)
1590 else:
1855 else:
1591 text = repr(field)
1856 text = repr(field)
1592 return text
1857 return text
1593
1858
1594
1859
1595 class Display(object):
1860 class Display(object):
1596 class __metaclass__(type):
1861 class __metaclass__(type):
1597 def __ror__(self, input):
1862 def __ror__(self, input):
1598 return input | self()
1863 return input | self()
1599
1864
1600 def __ror__(self, input):
1865 def __ror__(self, input):
1601 self.input = input
1866 self.input = input
1602 return self
1867 return self
1603
1868
1604 def display(self):
1869 def display(self):
1605 pass
1870 pass
1606
1871
1607
1872
1608 class iless(Display):
1873 class iless(Display):
1609 cmd = "less --quit-if-one-screen --LONG-PROMPT --LINE-NUMBERS --chop-long-lines --shift=8 --RAW-CONTROL-CHARS"
1874 cmd = "less --quit-if-one-screen --LONG-PROMPT --LINE-NUMBERS --chop-long-lines --shift=8 --RAW-CONTROL-CHARS"
1610
1875
1611 def display(self):
1876 def display(self):
1612 try:
1877 try:
1613 pager = os.popen(self.cmd, "w")
1878 pager = os.popen(self.cmd, "w")
1614 try:
1879 try:
1615 for item in xiter(self.input, "default"):
1880 for item in xiter(self.input, "default"):
1616 attrs = xattrs(item, "default")
1881 attrs = tuple(_upgradexattrs(item, "default"))
1617 attrs = ["%s=%s" % (a, _format(_getattr(item, a))) for a in attrs]
1882 attrs = ["%s=%s" % (a.name(item), a.value(item)) for a in attrs]
1618 pager.write(" ".join(attrs))
1883 pager.write(" ".join(attrs))
1619 pager.write("\n")
1884 pager.write("\n")
1620 finally:
1885 finally:
1621 pager.close()
1886 pager.close()
1622 except Exception, exc:
1887 except Exception, exc:
1623 print "%s: %s" % (exc.__class__.__name__, str(exc))
1888 print "%s: %s" % (exc.__class__.__name__, str(exc))
1624
1889
1625
1890
1626 def xformat(value, mode, maxlength):
1891 def xformat(value, mode, maxlength):
1627 align = None
1892 align = None
1628 full = True
1893 full = True
1629 width = 0
1894 width = 0
1630 text = astyle.Text()
1895 text = astyle.Text()
1631 for (style, part) in xrepr(value, mode):
1896 for (style, part) in xrepr(value, mode):
1632 # only consider the first result
1897 # only consider the first result
1633 if align is None:
1898 if align is None:
1634 if isinstance(style, int):
1899 if isinstance(style, int):
1635 # (style, text) really is (alignment, stop)
1900 # (style, text) really is (alignment, stop)
1636 align = style
1901 align = style
1637 full = part
1902 full = part
1638 continue
1903 continue
1639 else:
1904 else:
1640 align = -1
1905 align = -1
1641 full = True
1906 full = True
1642 if not isinstance(style, int):
1907 if not isinstance(style, int):
1643 text.append((style, part))
1908 text.append((style, part))
1644 width += len(part)
1909 width += len(part)
1645 if width >= maxlength and not full:
1910 if width >= maxlength and not full:
1646 text.append((astyle.style_ellisis, "..."))
1911 text.append((astyle.style_ellisis, "..."))
1647 width += 3
1912 width += 3
1648 break
1913 break
1649 if align is None: # default to left alignment
1914 if align is None: # default to left alignment
1650 align = -1
1915 align = -1
1651 return (align, width, text)
1916 return (align, width, text)
1652
1917
1653
1918
1654 class idump(Display):
1919 class idump(Display):
1655 # The approximate maximum length of a column entry
1920 # The approximate maximum length of a column entry
1656 maxattrlength = 200
1921 maxattrlength = 200
1657
1922
1658 # Style for column names
1923 # Style for column names
1659 style_header = astyle.Style.fromstr("white:black:bold")
1924 style_header = astyle.Style.fromstr("white:black:bold")
1660
1925
1661 def __init__(self, *attrs):
1926 def __init__(self, *attrs):
1662 self.attrs = attrs
1927 self.attrs = [upgradexattr(attr) for attr in attrs]
1663 self.headerpadchar = " "
1928 self.headerpadchar = " "
1664 self.headersepchar = "|"
1929 self.headersepchar = "|"
1665 self.datapadchar = " "
1930 self.datapadchar = " "
1666 self.datasepchar = "|"
1931 self.datasepchar = "|"
1667
1932
1668 def display(self):
1933 def display(self):
1669 stream = genutils.Term.cout
1934 stream = genutils.Term.cout
1670 allattrs = []
1935 allattrs = []
1671 allattrset = set()
1936 attrset = set()
1672 colwidths = {}
1937 colwidths = {}
1673 rows = []
1938 rows = []
1674 for item in xiter(self.input, "default"):
1939 for item in xiter(self.input, "default"):
1675 row = {}
1940 row = {}
1676 attrs = self.attrs
1941 attrs = self.attrs
1677 if not attrs:
1942 if not attrs:
1678 attrs = xattrs(item, "default")
1943 attrs = xattrs(item, "default")
1679 for attrname in attrs:
1944 for attr in attrs:
1680 if attrname not in allattrset:
1945 if attr not in attrset:
1681 allattrs.append(attrname)
1946 allattrs.append(attr)
1682 allattrset.add(attrname)
1947 attrset.add(attr)
1683 colwidths[attrname] = len(_attrname(attrname))
1948 colwidths[attr] = len(attr.name())
1684 try:
1949 try:
1685 value = _getattr(item, attrname, None)
1950 value = attr.value(item)
1686 except (KeyboardInterrupt, SystemExit):
1951 except (KeyboardInterrupt, SystemExit):
1687 raise
1952 raise
1688 except Exception, exc:
1953 except Exception, exc:
1689 value = exc
1954 value = exc
1690 (align, width, text) = xformat(value, "cell", self.maxattrlength)
1955 (align, width, text) = xformat(value, "cell", self.maxattrlength)
1691 colwidths[attrname] = max(colwidths[attrname], width)
1956 colwidths[attr] = max(colwidths[attr], width)
1692 # remember alignment, length and colored parts
1957 # remember alignment, length and colored parts
1693 row[attrname] = (align, width, text)
1958 row[attr] = (align, width, text)
1694 rows.append(row)
1959 rows.append(row)
1695
1960
1696 stream.write("\n")
1961 stream.write("\n")
1697 for (i, attrname) in enumerate(allattrs):
1962 for (i, attr) in enumerate(allattrs):
1698 self.style_header(_attrname(attrname)).write(stream)
1963 attrname = attr.name()
1699 spc = colwidths[attrname] - len(_attrname(attrname))
1964 self.style_header(attrname).write(stream)
1965 spc = colwidths[attr] - len(attrname)
1700 if i < len(colwidths)-1:
1966 if i < len(colwidths)-1:
1701 stream.write(self.headerpadchar*spc)
1967 stream.write(self.headerpadchar*spc)
1702 stream.write(self.headersepchar)
1968 stream.write(self.headersepchar)
1703 stream.write("\n")
1969 stream.write("\n")
1704
1970
1705 for row in rows:
1971 for row in rows:
1706 for (i, attrname) in enumerate(allattrs):
1972 for (i, attr) in enumerate(allattrs):
1707 (align, width, text) = row[attrname]
1973 (align, width, text) = row[attr]
1708 spc = colwidths[attrname] - width
1974 spc = colwidths[attr] - width
1709 if align == -1:
1975 if align == -1:
1710 text.write(stream)
1976 text.write(stream)
1711 if i < len(colwidths)-1:
1977 if i < len(colwidths)-1:
1712 stream.write(self.datapadchar*spc)
1978 stream.write(self.datapadchar*spc)
1713 elif align == 0:
1979 elif align == 0:
1714 spc = colwidths[attrname] - width
1980 spc = colwidths[attr] - width
1715 spc1 = spc//2
1981 spc1 = spc//2
1716 spc2 = spc-spc1
1982 spc2 = spc-spc1
1717 stream.write(self.datapadchar*spc1)
1983 stream.write(self.datapadchar*spc1)
1718 text.write(stream)
1984 text.write(stream)
1719 if i < len(colwidths)-1:
1985 if i < len(colwidths)-1:
1720 stream.write(self.datapadchar*spc2)
1986 stream.write(self.datapadchar*spc2)
1721 else:
1987 else:
1722 stream.write(self.datapadchar*spc)
1988 stream.write(self.datapadchar*spc)
1723 text.write(stream)
1989 text.write(stream)
1724 if i < len(colwidths)-1:
1990 if i < len(colwidths)-1:
1725 stream.write(self.datasepchar)
1991 stream.write(self.datasepchar)
1726 stream.write("\n")
1992 stream.write("\n")
1727
1993
1728
1994
1729 class XMode(object):
1995 class XMode(object):
1730 """
1996 """
1731 An ``XMode`` object describes one enter mode available for an object
1997 An ``XMode`` object describes one enter mode available for an object
1732 """
1998 """
1733 def __init__(self, object, mode, title=None, description=None):
1999 def __init__(self, object, mode, title=None, description=None):
1734 """
2000 """
1735 Create a new ``XMode`` object for the object ``object``. This object
2001 Create a new ``XMode`` object for the object ``object``. This object
1736 must support the enter mode ``mode`` (i.e. ``object.__xiter__(mode)``
2002 must support the enter mode ``mode`` (i.e. ``object.__xiter__(mode)``
1737 must return an iterable). ``title`` and ``description`` will be
2003 must return an iterable). ``title`` and ``description`` will be
1738 displayed in the browser when selecting among the available modes.
2004 displayed in the browser when selecting among the available modes.
1739 """
2005 """
1740 self.object = object
2006 self.object = object
1741 self.mode = mode
2007 self.mode = mode
1742 self.title = title
2008 self.title = title
1743 self.description = description
2009 self.description = description
1744
2010
1745 def __repr__(self):
2011 def __repr__(self):
1746 return "<%s.%s object mode=%r at 0x%x>" % \
2012 return "<%s.%s object mode=%r at 0x%x>" % \
1747 (self.__class__.__module__, self.__class__.__name__,
2013 (self.__class__.__module__, self.__class__.__name__,
1748 self.mode, id(self))
2014 self.mode, id(self))
1749
2015
1750 def __xrepr__(self, mode):
2016 def __xrepr__(self, mode):
1751 if mode == "header" or mode == "footer":
2017 if mode == "header" or mode == "footer":
1752 yield (astyle.style_default, self.title)
2018 yield (astyle.style_default, self.title)
1753 else:
2019 else:
1754 yield (astyle.style_default, repr(self))
2020 yield (astyle.style_default, repr(self))
1755
2021
1756 def __xattrs__(self, mode):
2022 def __xattrs__(self, mode):
1757 if mode == "detail":
2023 if mode == "detail":
2024 return ("object", "mode")
2025 else:
1758 return ("object", "mode", "title", "description")
2026 return ("object", "mode", "title", "description")
1759 return ("title", "description")
1760
2027
1761 def __xiter__(self, mode):
2028 def __xiter__(self, mode):
1762 return xiter(self.object, self.mode)
2029 return xiter(self.object, self.mode)
1763
2030
1764
2031
1765 class XAttr(object):
2032 class AttributeDetail(Table):
1766 def __init__(self, object, name):
2033 def __init__(self, object, descriptor):
1767 self.name = _attrname(name)
2034 self.object = object
2035 self.descriptor = descriptor
1768
2036
1769 try:
2037 def __iter__(self):
1770 self.value = _getattr(object, name)
2038 return self.descriptor.iter(self.object)
1771 except (KeyboardInterrupt, SystemExit):
1772 raise
1773 except Exception, exc:
1774 if exc.__class__.__module__ == "exceptions":
1775 self.value = exc.__class__.__name__
1776 else:
1777 self.value = "%s.%s" % \
1778 (exc.__class__.__module__, exc.__class__.__name__)
1779 self.type = self.value
1780 else:
1781 t = type(self.value)
1782 if t.__module__ == "__builtin__":
1783 self.type = t.__name__
1784 else:
1785 self.type = "%s.%s" % (t.__module__, t.__name__)
1786
2039
1787 doc = None
2040 def name(self):
1788 if isinstance(name, basestring):
2041 return self.descriptor.name()
1789 if name.endswith("()"):
2042
1790 doc = getattr(getattr(object, name[:-2]), "__doc__", None)
2043 def attrtype(self):
1791 else:
2044 return self.descriptor.attrtype(self.object)
1792 try:
2045
1793 meta = getattr(type(object), name)
2046 def valuetype(self):
1794 except AttributeError:
2047 return self.descriptor.valuetype(self.object)
1795 pass
2048
1796 else:
2049 def doc(self):
1797 if isinstance(meta, property):
2050 return self.descriptor.doc(self.object)
1798 doc = getattr(meta, "__doc__", None)
2051
1799 elif callable(name):
2052 def shortdoc(self):
1800 doc = getattr(name, "__doc__", None)
2053 return self.descriptor.shortdoc(self.object)
1801 if isinstance(doc, basestring):
2054
1802 doc = doc.strip()
2055 def value(self):
1803 self.doc = doc
2056 return self.descriptor.value(self.object)
1804
2057
1805 def __xattrs__(self, mode):
2058 def __xattrs__(self, mode):
1806 return ("name", "type", "doc", "value")
2059 attrs = ("name()", "attrtype()", "valuetype()", "value()", "shortdoc()")
2060 if mode == "detail":
2061 attrs += ("doc()",)
2062 return attrs
2063
2064 def __xrepr__(self, mode):
2065 yield (-1, True)
2066 yield (astyle.style_default, self.attrtype())
2067 yield (astyle.style_default, "(")
2068 for part in xrepr(self.valuetype()):
2069 yield part
2070 yield (astyle.style_default, ") ")
2071 yield (astyle.style_default, self.name())
2072 yield (astyle.style_default, " of ")
2073 for part in xrepr(self.object):
2074 yield part
1807
2075
1808
2076
1809 try:
2077 try:
1810 from ibrowse import ibrowse
2078 from ibrowse import ibrowse
1811 except ImportError:
2079 except ImportError:
1812 # No curses (probably Windows) => use ``idump`` as the default display.
2080 # No curses (probably Windows) => use ``idump`` as the default display.
1813 defaultdisplay = idump
2081 defaultdisplay = idump
1814 else:
2082 else:
1815 defaultdisplay = ibrowse
2083 defaultdisplay = ibrowse
1816 __all__.append("ibrowse")
2084 __all__.append("ibrowse")
1817
2085
1818
2086
1819 # If we're running under IPython, install an IPython displayhook that
2087 # If we're running under IPython, install an IPython displayhook that
1820 # returns the object from Display.display(), else install a displayhook
2088 # returns the object from Display.display(), else install a displayhook
1821 # directly as sys.displayhook
2089 # directly as sys.displayhook
1822 api = None
2090 api = None
1823 if ipapi is not None:
2091 if ipapi is not None:
1824 try:
2092 try:
1825 api = ipapi.get()
2093 api = ipapi.get()
1826 except AttributeError:
2094 except AttributeError:
1827 pass
2095 pass
1828
2096
1829 if api is not None:
2097 if api is not None:
1830 def displayhook(self, obj):
2098 def displayhook(self, obj):
1831 if isinstance(obj, type) and issubclass(obj, Table):
2099 if isinstance(obj, type) and issubclass(obj, Table):
1832 obj = obj()
2100 obj = obj()
1833 if isinstance(obj, Table):
2101 if isinstance(obj, Table):
1834 obj = obj | defaultdisplay
2102 obj = obj | defaultdisplay
1835 if isinstance(obj, Display):
2103 if isinstance(obj, Display):
1836 return obj.display()
2104 return obj.display()
1837 else:
2105 else:
1838 raise ipapi.TryNext
2106 raise ipapi.TryNext
1839 api.set_hook("result_display", displayhook)
2107 api.set_hook("result_display", displayhook)
1840 else:
2108 else:
1841 def installdisplayhook():
2109 def installdisplayhook():
1842 _originalhook = sys.displayhook
2110 _originalhook = sys.displayhook
1843 def displayhook(obj):
2111 def displayhook(obj):
1844 if isinstance(obj, type) and issubclass(obj, Table):
2112 if isinstance(obj, type) and issubclass(obj, Table):
1845 obj = obj()
2113 obj = obj()
1846 if isinstance(obj, Table):
2114 if isinstance(obj, Table):
1847 obj = obj | defaultdisplay
2115 obj = obj | defaultdisplay
1848 if isinstance(obj, Display):
2116 if isinstance(obj, Display):
1849 return obj.display()
2117 return obj.display()
1850 else:
2118 else:
1851 _originalhook(obj)
2119 _originalhook(obj)
1852 sys.displayhook = displayhook
2120 sys.displayhook = displayhook
1853 installdisplayhook()
2121 installdisplayhook()
@@ -1,5673 +1,5694 b''
1 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1 2006-07-27 Walter Doerwald <walter@livinglogic.de>
2
2
3 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
3 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
4 not running under IPython.
4 not running under IPython.
5
5
6 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
7 and make it iterable (iterating over the attribute itself). Add two new
8 magic strings for __xattrs__(): If the string starts with "-", the attribute
9 will not be displayed in ibrowse's detail view (but it can still be
10 iterated over). This makes it possible to add attributes that are large
11 lists or generator methods to the detail view. Replace magic attribute names
12 and _attrname() and _getattr() with "descriptors": For each type of magic
13 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
14 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
15 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
16 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
17 are still supported.
18
19 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
20 fails in ibrowse.fetch(), the exception object is added as the last item
21 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
22 a generator throws an exception midway through execution.
23
24 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
25 encoding into methods.
26
6 2006-07-26 Ville Vainio <vivainio@gmail.com>
27 2006-07-26 Ville Vainio <vivainio@gmail.com>
7
28
8 * iplib.py: history now stores multiline input as single
29 * iplib.py: history now stores multiline input as single
9 history entries. Patch by Jorgen Cederlof.
30 history entries. Patch by Jorgen Cederlof.
10
31
11 2006-07-18 Walter Doerwald <walter@livinglogic.de>
32 2006-07-18 Walter Doerwald <walter@livinglogic.de>
12
33
13 * IPython/Extensions/ibrowse.py: Make cursor visible over
34 * IPython/Extensions/ibrowse.py: Make cursor visible over
14 non existing attributes.
35 non existing attributes.
15
36
16 2006-07-14 Walter Doerwald <walter@livinglogic.de>
37 2006-07-14 Walter Doerwald <walter@livinglogic.de>
17
38
18 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
39 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
19 error output of the running command doesn't mess up the screen.
40 error output of the running command doesn't mess up the screen.
20
41
21 2006-07-13 Walter Doerwald <walter@livinglogic.de>
42 2006-07-13 Walter Doerwald <walter@livinglogic.de>
22
43
23 * IPython/Extensions/ipipe.py (isort): Make isort usable without
44 * IPython/Extensions/ipipe.py (isort): Make isort usable without
24 argument. This sorts the items themselves.
45 argument. This sorts the items themselves.
25
46
26 2006-07-12 Walter Doerwald <walter@livinglogic.de>
47 2006-07-12 Walter Doerwald <walter@livinglogic.de>
27
48
28 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
49 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
29 Compile expression strings into code objects. This should speed
50 Compile expression strings into code objects. This should speed
30 up ifilter and friends somewhat.
51 up ifilter and friends somewhat.
31
52
32 2006-07-08 Ville Vainio <vivainio@gmail.com>
53 2006-07-08 Ville Vainio <vivainio@gmail.com>
33
54
34 * Magic.py: %cpaste now strips > from the beginning of lines
55 * Magic.py: %cpaste now strips > from the beginning of lines
35 to ease pasting quoted code from emails. Contributed by
56 to ease pasting quoted code from emails. Contributed by
36 Stefan van der Walt.
57 Stefan van der Walt.
37
58
38 2006-06-29 Ville Vainio <vivainio@gmail.com>
59 2006-06-29 Ville Vainio <vivainio@gmail.com>
39
60
40 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
61 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
41 mode, patch contributed by Darren Dale. NEEDS TESTING!
62 mode, patch contributed by Darren Dale. NEEDS TESTING!
42
63
43 2006-06-28 Walter Doerwald <walter@livinglogic.de>
64 2006-06-28 Walter Doerwald <walter@livinglogic.de>
44
65
45 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
66 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
46 a blue background. Fix fetching new display rows when the browser
67 a blue background. Fix fetching new display rows when the browser
47 scrolls more than a screenful (e.g. by using the goto command).
68 scrolls more than a screenful (e.g. by using the goto command).
48
69
49 2006-06-27 Ville Vainio <vivainio@gmail.com>
70 2006-06-27 Ville Vainio <vivainio@gmail.com>
50
71
51 * Magic.py (_inspect, _ofind) Apply David Huard's
72 * Magic.py (_inspect, _ofind) Apply David Huard's
52 patch for displaying the correct docstring for 'property'
73 patch for displaying the correct docstring for 'property'
53 attributes.
74 attributes.
54
75
55 2006-06-23 Walter Doerwald <walter@livinglogic.de>
76 2006-06-23 Walter Doerwald <walter@livinglogic.de>
56
77
57 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
78 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
58 commands into the methods implementing them.
79 commands into the methods implementing them.
59
80
60 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
81 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
61
82
62 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
83 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
63 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
84 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
64 autoindent support was authored by Jin Liu.
85 autoindent support was authored by Jin Liu.
65
86
66 2006-06-22 Walter Doerwald <walter@livinglogic.de>
87 2006-06-22 Walter Doerwald <walter@livinglogic.de>
67
88
68 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
89 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
69 for keymaps with a custom class that simplifies handling.
90 for keymaps with a custom class that simplifies handling.
70
91
71 2006-06-19 Walter Doerwald <walter@livinglogic.de>
92 2006-06-19 Walter Doerwald <walter@livinglogic.de>
72
93
73 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
94 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
74 resizing. This requires Python 2.5 to work.
95 resizing. This requires Python 2.5 to work.
75
96
76 2006-06-16 Walter Doerwald <walter@livinglogic.de>
97 2006-06-16 Walter Doerwald <walter@livinglogic.de>
77
98
78 * IPython/Extensions/ibrowse.py: Add two new commands to
99 * IPython/Extensions/ibrowse.py: Add two new commands to
79 ibrowse: "hideattr" (mapped to "h") hides the attribute under
100 ibrowse: "hideattr" (mapped to "h") hides the attribute under
80 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
101 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
81 attributes again. Remapped the help command to "?". Display
102 attributes again. Remapped the help command to "?". Display
82 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
103 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
83 as keys for the "home" and "end" commands. Add three new commands
104 as keys for the "home" and "end" commands. Add three new commands
84 to the input mode for "find" and friends: "delend" (CTRL-K)
105 to the input mode for "find" and friends: "delend" (CTRL-K)
85 deletes to the end of line. "incsearchup" searches upwards in the
106 deletes to the end of line. "incsearchup" searches upwards in the
86 command history for an input that starts with the text before the cursor.
107 command history for an input that starts with the text before the cursor.
87 "incsearchdown" does the same downwards. Removed a bogus mapping of
108 "incsearchdown" does the same downwards. Removed a bogus mapping of
88 the x key to "delete".
109 the x key to "delete".
89
110
90 2006-06-15 Ville Vainio <vivainio@gmail.com>
111 2006-06-15 Ville Vainio <vivainio@gmail.com>
91
112
92 * iplib.py, hooks.py: Added new generate_prompt hook that can be
113 * iplib.py, hooks.py: Added new generate_prompt hook that can be
93 used to create prompts dynamically, instead of the "old" way of
114 used to create prompts dynamically, instead of the "old" way of
94 assigning "magic" strings to prompt_in1 and prompt_in2. The old
115 assigning "magic" strings to prompt_in1 and prompt_in2. The old
95 way still works (it's invoked by the default hook), of course.
116 way still works (it's invoked by the default hook), of course.
96
117
97 * Prompts.py: added generate_output_prompt hook for altering output
118 * Prompts.py: added generate_output_prompt hook for altering output
98 prompt
119 prompt
99
120
100 * Release.py: Changed version string to 0.7.3.svn.
121 * Release.py: Changed version string to 0.7.3.svn.
101
122
102 2006-06-15 Walter Doerwald <walter@livinglogic.de>
123 2006-06-15 Walter Doerwald <walter@livinglogic.de>
103
124
104 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
125 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
105 the call to fetch() always tries to fetch enough data for at least one
126 the call to fetch() always tries to fetch enough data for at least one
106 full screen. This makes it possible to simply call moveto(0,0,True) in
127 full screen. This makes it possible to simply call moveto(0,0,True) in
107 the constructor. Fix typos and removed the obsolete goto attribute.
128 the constructor. Fix typos and removed the obsolete goto attribute.
108
129
109 2006-06-12 Ville Vainio <vivainio@gmail.com>
130 2006-06-12 Ville Vainio <vivainio@gmail.com>
110
131
111 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
132 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
112 allowing $variable interpolation within multiline statements,
133 allowing $variable interpolation within multiline statements,
113 though so far only with "sh" profile for a testing period.
134 though so far only with "sh" profile for a testing period.
114 The patch also enables splitting long commands with \ but it
135 The patch also enables splitting long commands with \ but it
115 doesn't work properly yet.
136 doesn't work properly yet.
116
137
117 2006-06-12 Walter Doerwald <walter@livinglogic.de>
138 2006-06-12 Walter Doerwald <walter@livinglogic.de>
118
139
119 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
140 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
120 input history and the position of the cursor in the input history for
141 input history and the position of the cursor in the input history for
121 the find, findbackwards and goto command.
142 the find, findbackwards and goto command.
122
143
123 2006-06-10 Walter Doerwald <walter@livinglogic.de>
144 2006-06-10 Walter Doerwald <walter@livinglogic.de>
124
145
125 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
146 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
126 implements the basic functionality of browser commands that require
147 implements the basic functionality of browser commands that require
127 input. Reimplement the goto, find and findbackwards commands as
148 input. Reimplement the goto, find and findbackwards commands as
128 subclasses of _CommandInput. Add an input history and keymaps to those
149 subclasses of _CommandInput. Add an input history and keymaps to those
129 commands. Add "\r" as a keyboard shortcut for the enterdefault and
150 commands. Add "\r" as a keyboard shortcut for the enterdefault and
130 execute commands.
151 execute commands.
131
152
132 2006-06-07 Ville Vainio <vivainio@gmail.com>
153 2006-06-07 Ville Vainio <vivainio@gmail.com>
133
154
134 * iplib.py: ipython mybatch.ipy exits ipython immediately after
155 * iplib.py: ipython mybatch.ipy exits ipython immediately after
135 running the batch files instead of leaving the session open.
156 running the batch files instead of leaving the session open.
136
157
137 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
158 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
138
159
139 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
160 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
140 the original fix was incomplete. Patch submitted by W. Maier.
161 the original fix was incomplete. Patch submitted by W. Maier.
141
162
142 2006-06-07 Ville Vainio <vivainio@gmail.com>
163 2006-06-07 Ville Vainio <vivainio@gmail.com>
143
164
144 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
165 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
145 Confirmation prompts can be supressed by 'quiet' option.
166 Confirmation prompts can be supressed by 'quiet' option.
146 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
167 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
147
168
148 2006-06-06 *** Released version 0.7.2
169 2006-06-06 *** Released version 0.7.2
149
170
150 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
171 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
151
172
152 * IPython/Release.py (version): Made 0.7.2 final for release.
173 * IPython/Release.py (version): Made 0.7.2 final for release.
153 Repo tagged and release cut.
174 Repo tagged and release cut.
154
175
155 2006-06-05 Ville Vainio <vivainio@gmail.com>
176 2006-06-05 Ville Vainio <vivainio@gmail.com>
156
177
157 * Magic.py (magic_rehashx): Honor no_alias list earlier in
178 * Magic.py (magic_rehashx): Honor no_alias list earlier in
158 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
179 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
159
180
160 * upgrade_dir.py: try import 'path' module a bit harder
181 * upgrade_dir.py: try import 'path' module a bit harder
161 (for %upgrade)
182 (for %upgrade)
162
183
163 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
184 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
164
185
165 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
186 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
166 instead of looping 20 times.
187 instead of looping 20 times.
167
188
168 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
189 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
169 correctly at initialization time. Bug reported by Krishna Mohan
190 correctly at initialization time. Bug reported by Krishna Mohan
170 Gundu <gkmohan-AT-gmail.com> on the user list.
191 Gundu <gkmohan-AT-gmail.com> on the user list.
171
192
172 * IPython/Release.py (version): Mark 0.7.2 version to start
193 * IPython/Release.py (version): Mark 0.7.2 version to start
173 testing for release on 06/06.
194 testing for release on 06/06.
174
195
175 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
196 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
176
197
177 * scripts/irunner: thin script interface so users don't have to
198 * scripts/irunner: thin script interface so users don't have to
178 find the module and call it as an executable, since modules rarely
199 find the module and call it as an executable, since modules rarely
179 live in people's PATH.
200 live in people's PATH.
180
201
181 * IPython/irunner.py (InteractiveRunner.__init__): added
202 * IPython/irunner.py (InteractiveRunner.__init__): added
182 delaybeforesend attribute to control delays with newer versions of
203 delaybeforesend attribute to control delays with newer versions of
183 pexpect. Thanks to detailed help from pexpect's author, Noah
204 pexpect. Thanks to detailed help from pexpect's author, Noah
184 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
205 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
185 correctly (it works in NoColor mode).
206 correctly (it works in NoColor mode).
186
207
187 * IPython/iplib.py (handle_normal): fix nasty crash reported on
208 * IPython/iplib.py (handle_normal): fix nasty crash reported on
188 SAGE list, from improper log() calls.
209 SAGE list, from improper log() calls.
189
210
190 2006-05-31 Ville Vainio <vivainio@gmail.com>
211 2006-05-31 Ville Vainio <vivainio@gmail.com>
191
212
192 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
213 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
193 with args in parens to work correctly with dirs that have spaces.
214 with args in parens to work correctly with dirs that have spaces.
194
215
195 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
216 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
196
217
197 * IPython/Logger.py (Logger.logstart): add option to log raw input
218 * IPython/Logger.py (Logger.logstart): add option to log raw input
198 instead of the processed one. A -r flag was added to the
219 instead of the processed one. A -r flag was added to the
199 %logstart magic used for controlling logging.
220 %logstart magic used for controlling logging.
200
221
201 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
222 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
202
223
203 * IPython/iplib.py (InteractiveShell.__init__): add check for the
224 * IPython/iplib.py (InteractiveShell.__init__): add check for the
204 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
225 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
205 recognize the option. After a bug report by Will Maier. This
226 recognize the option. After a bug report by Will Maier. This
206 closes #64 (will do it after confirmation from W. Maier).
227 closes #64 (will do it after confirmation from W. Maier).
207
228
208 * IPython/irunner.py: New module to run scripts as if manually
229 * IPython/irunner.py: New module to run scripts as if manually
209 typed into an interactive environment, based on pexpect. After a
230 typed into an interactive environment, based on pexpect. After a
210 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
231 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
211 ipython-user list. Simple unittests in the tests/ directory.
232 ipython-user list. Simple unittests in the tests/ directory.
212
233
213 * tools/release: add Will Maier, OpenBSD port maintainer, to
234 * tools/release: add Will Maier, OpenBSD port maintainer, to
214 recepients list. We are now officially part of the OpenBSD ports:
235 recepients list. We are now officially part of the OpenBSD ports:
215 http://www.openbsd.org/ports.html ! Many thanks to Will for the
236 http://www.openbsd.org/ports.html ! Many thanks to Will for the
216 work.
237 work.
217
238
218 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
239 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
219
240
220 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
241 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
221 so that it doesn't break tkinter apps.
242 so that it doesn't break tkinter apps.
222
243
223 * IPython/iplib.py (_prefilter): fix bug where aliases would
244 * IPython/iplib.py (_prefilter): fix bug where aliases would
224 shadow variables when autocall was fully off. Reported by SAGE
245 shadow variables when autocall was fully off. Reported by SAGE
225 author William Stein.
246 author William Stein.
226
247
227 * IPython/OInspect.py (Inspector.__init__): add a flag to control
248 * IPython/OInspect.py (Inspector.__init__): add a flag to control
228 at what detail level strings are computed when foo? is requested.
249 at what detail level strings are computed when foo? is requested.
229 This allows users to ask for example that the string form of an
250 This allows users to ask for example that the string form of an
230 object is only computed when foo?? is called, or even never, by
251 object is only computed when foo?? is called, or even never, by
231 setting the object_info_string_level >= 2 in the configuration
252 setting the object_info_string_level >= 2 in the configuration
232 file. This new option has been added and documented. After a
253 file. This new option has been added and documented. After a
233 request by SAGE to be able to control the printing of very large
254 request by SAGE to be able to control the printing of very large
234 objects more easily.
255 objects more easily.
235
256
236 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
257 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
237
258
238 * IPython/ipmaker.py (make_IPython): remove the ipython call path
259 * IPython/ipmaker.py (make_IPython): remove the ipython call path
239 from sys.argv, to be 100% consistent with how Python itself works
260 from sys.argv, to be 100% consistent with how Python itself works
240 (as seen for example with python -i file.py). After a bug report
261 (as seen for example with python -i file.py). After a bug report
241 by Jeffrey Collins.
262 by Jeffrey Collins.
242
263
243 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
264 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
244 nasty bug which was preventing custom namespaces with -pylab,
265 nasty bug which was preventing custom namespaces with -pylab,
245 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
266 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
246 compatibility (long gone from mpl).
267 compatibility (long gone from mpl).
247
268
248 * IPython/ipapi.py (make_session): name change: create->make. We
269 * IPython/ipapi.py (make_session): name change: create->make. We
249 use make in other places (ipmaker,...), it's shorter and easier to
270 use make in other places (ipmaker,...), it's shorter and easier to
250 type and say, etc. I'm trying to clean things before 0.7.2 so
271 type and say, etc. I'm trying to clean things before 0.7.2 so
251 that I can keep things stable wrt to ipapi in the chainsaw branch.
272 that I can keep things stable wrt to ipapi in the chainsaw branch.
252
273
253 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
274 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
254 python-mode recognizes our debugger mode. Add support for
275 python-mode recognizes our debugger mode. Add support for
255 autoindent inside (X)emacs. After a patch sent in by Jin Liu
276 autoindent inside (X)emacs. After a patch sent in by Jin Liu
256 <m.liu.jin-AT-gmail.com> originally written by
277 <m.liu.jin-AT-gmail.com> originally written by
257 doxgen-AT-newsmth.net (with minor modifications for xemacs
278 doxgen-AT-newsmth.net (with minor modifications for xemacs
258 compatibility)
279 compatibility)
259
280
260 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
281 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
261 tracebacks when walking the stack so that the stack tracking system
282 tracebacks when walking the stack so that the stack tracking system
262 in emacs' python-mode can identify the frames correctly.
283 in emacs' python-mode can identify the frames correctly.
263
284
264 * IPython/ipmaker.py (make_IPython): make the internal (and
285 * IPython/ipmaker.py (make_IPython): make the internal (and
265 default config) autoedit_syntax value false by default. Too many
286 default config) autoedit_syntax value false by default. Too many
266 users have complained to me (both on and off-list) about problems
287 users have complained to me (both on and off-list) about problems
267 with this option being on by default, so I'm making it default to
288 with this option being on by default, so I'm making it default to
268 off. It can still be enabled by anyone via the usual mechanisms.
289 off. It can still be enabled by anyone via the usual mechanisms.
269
290
270 * IPython/completer.py (Completer.attr_matches): add support for
291 * IPython/completer.py (Completer.attr_matches): add support for
271 PyCrust-style _getAttributeNames magic method. Patch contributed
292 PyCrust-style _getAttributeNames magic method. Patch contributed
272 by <mscott-AT-goldenspud.com>. Closes #50.
293 by <mscott-AT-goldenspud.com>. Closes #50.
273
294
274 * IPython/iplib.py (InteractiveShell.__init__): remove the
295 * IPython/iplib.py (InteractiveShell.__init__): remove the
275 deletion of exit/quit from __builtin__, which can break
296 deletion of exit/quit from __builtin__, which can break
276 third-party tools like the Zope debugging console. The
297 third-party tools like the Zope debugging console. The
277 %exit/%quit magics remain. In general, it's probably a good idea
298 %exit/%quit magics remain. In general, it's probably a good idea
278 not to delete anything from __builtin__, since we never know what
299 not to delete anything from __builtin__, since we never know what
279 that will break. In any case, python now (for 2.5) will support
300 that will break. In any case, python now (for 2.5) will support
280 'real' exit/quit, so this issue is moot. Closes #55.
301 'real' exit/quit, so this issue is moot. Closes #55.
281
302
282 * IPython/genutils.py (with_obj): rename the 'with' function to
303 * IPython/genutils.py (with_obj): rename the 'with' function to
283 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
304 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
284 becomes a language keyword. Closes #53.
305 becomes a language keyword. Closes #53.
285
306
286 * IPython/FakeModule.py (FakeModule.__init__): add a proper
307 * IPython/FakeModule.py (FakeModule.__init__): add a proper
287 __file__ attribute to this so it fools more things into thinking
308 __file__ attribute to this so it fools more things into thinking
288 it is a real module. Closes #59.
309 it is a real module. Closes #59.
289
310
290 * IPython/Magic.py (magic_edit): add -n option to open the editor
311 * IPython/Magic.py (magic_edit): add -n option to open the editor
291 at a specific line number. After a patch by Stefan van der Walt.
312 at a specific line number. After a patch by Stefan van der Walt.
292
313
293 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
314 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
294
315
295 * IPython/iplib.py (edit_syntax_error): fix crash when for some
316 * IPython/iplib.py (edit_syntax_error): fix crash when for some
296 reason the file could not be opened. After automatic crash
317 reason the file could not be opened. After automatic crash
297 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
318 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
298 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
319 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
299 (_should_recompile): Don't fire editor if using %bg, since there
320 (_should_recompile): Don't fire editor if using %bg, since there
300 is no file in the first place. From the same report as above.
321 is no file in the first place. From the same report as above.
301 (raw_input): protect against faulty third-party prefilters. After
322 (raw_input): protect against faulty third-party prefilters. After
302 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
323 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
303 while running under SAGE.
324 while running under SAGE.
304
325
305 2006-05-23 Ville Vainio <vivainio@gmail.com>
326 2006-05-23 Ville Vainio <vivainio@gmail.com>
306
327
307 * ipapi.py: Stripped down ip.to_user_ns() to work only as
328 * ipapi.py: Stripped down ip.to_user_ns() to work only as
308 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
329 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
309 now returns None (again), unless dummy is specifically allowed by
330 now returns None (again), unless dummy is specifically allowed by
310 ipapi.get(allow_dummy=True).
331 ipapi.get(allow_dummy=True).
311
332
312 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
333 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
313
334
314 * IPython: remove all 2.2-compatibility objects and hacks from
335 * IPython: remove all 2.2-compatibility objects and hacks from
315 everywhere, since we only support 2.3 at this point. Docs
336 everywhere, since we only support 2.3 at this point. Docs
316 updated.
337 updated.
317
338
318 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
339 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
319 Anything requiring extra validation can be turned into a Python
340 Anything requiring extra validation can be turned into a Python
320 property in the future. I used a property for the db one b/c
341 property in the future. I used a property for the db one b/c
321 there was a nasty circularity problem with the initialization
342 there was a nasty circularity problem with the initialization
322 order, which right now I don't have time to clean up.
343 order, which right now I don't have time to clean up.
323
344
324 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
345 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
325 another locking bug reported by Jorgen. I'm not 100% sure though,
346 another locking bug reported by Jorgen. I'm not 100% sure though,
326 so more testing is needed...
347 so more testing is needed...
327
348
328 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
349 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
329
350
330 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
351 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
331 local variables from any routine in user code (typically executed
352 local variables from any routine in user code (typically executed
332 with %run) directly into the interactive namespace. Very useful
353 with %run) directly into the interactive namespace. Very useful
333 when doing complex debugging.
354 when doing complex debugging.
334 (IPythonNotRunning): Changed the default None object to a dummy
355 (IPythonNotRunning): Changed the default None object to a dummy
335 whose attributes can be queried as well as called without
356 whose attributes can be queried as well as called without
336 exploding, to ease writing code which works transparently both in
357 exploding, to ease writing code which works transparently both in
337 and out of ipython and uses some of this API.
358 and out of ipython and uses some of this API.
338
359
339 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
360 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
340
361
341 * IPython/hooks.py (result_display): Fix the fact that our display
362 * IPython/hooks.py (result_display): Fix the fact that our display
342 hook was using str() instead of repr(), as the default python
363 hook was using str() instead of repr(), as the default python
343 console does. This had gone unnoticed b/c it only happened if
364 console does. This had gone unnoticed b/c it only happened if
344 %Pprint was off, but the inconsistency was there.
365 %Pprint was off, but the inconsistency was there.
345
366
346 2006-05-15 Ville Vainio <vivainio@gmail.com>
367 2006-05-15 Ville Vainio <vivainio@gmail.com>
347
368
348 * Oinspect.py: Only show docstring for nonexisting/binary files
369 * Oinspect.py: Only show docstring for nonexisting/binary files
349 when doing object??, closing ticket #62
370 when doing object??, closing ticket #62
350
371
351 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
372 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
352
373
353 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
374 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
354 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
375 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
355 was being released in a routine which hadn't checked if it had
376 was being released in a routine which hadn't checked if it had
356 been the one to acquire it.
377 been the one to acquire it.
357
378
358 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
379 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
359
380
360 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
381 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
361
382
362 2006-04-11 Ville Vainio <vivainio@gmail.com>
383 2006-04-11 Ville Vainio <vivainio@gmail.com>
363
384
364 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
385 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
365 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
386 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
366 prefilters, allowing stuff like magics and aliases in the file.
387 prefilters, allowing stuff like magics and aliases in the file.
367
388
368 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
389 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
369 added. Supported now are "%clear in" and "%clear out" (clear input and
390 added. Supported now are "%clear in" and "%clear out" (clear input and
370 output history, respectively). Also fixed CachedOutput.flush to
391 output history, respectively). Also fixed CachedOutput.flush to
371 properly flush the output cache.
392 properly flush the output cache.
372
393
373 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
394 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
374 half-success (and fail explicitly).
395 half-success (and fail explicitly).
375
396
376 2006-03-28 Ville Vainio <vivainio@gmail.com>
397 2006-03-28 Ville Vainio <vivainio@gmail.com>
377
398
378 * iplib.py: Fix quoting of aliases so that only argless ones
399 * iplib.py: Fix quoting of aliases so that only argless ones
379 are quoted
400 are quoted
380
401
381 2006-03-28 Ville Vainio <vivainio@gmail.com>
402 2006-03-28 Ville Vainio <vivainio@gmail.com>
382
403
383 * iplib.py: Quote aliases with spaces in the name.
404 * iplib.py: Quote aliases with spaces in the name.
384 "c:\program files\blah\bin" is now legal alias target.
405 "c:\program files\blah\bin" is now legal alias target.
385
406
386 * ext_rehashdir.py: Space no longer allowed as arg
407 * ext_rehashdir.py: Space no longer allowed as arg
387 separator, since space is legal in path names.
408 separator, since space is legal in path names.
388
409
389 2006-03-16 Ville Vainio <vivainio@gmail.com>
410 2006-03-16 Ville Vainio <vivainio@gmail.com>
390
411
391 * upgrade_dir.py: Take path.py from Extensions, correcting
412 * upgrade_dir.py: Take path.py from Extensions, correcting
392 %upgrade magic
413 %upgrade magic
393
414
394 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
415 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
395
416
396 * hooks.py: Only enclose editor binary in quotes if legal and
417 * hooks.py: Only enclose editor binary in quotes if legal and
397 necessary (space in the name, and is an existing file). Fixes a bug
418 necessary (space in the name, and is an existing file). Fixes a bug
398 reported by Zachary Pincus.
419 reported by Zachary Pincus.
399
420
400 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
421 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
401
422
402 * Manual: thanks to a tip on proper color handling for Emacs, by
423 * Manual: thanks to a tip on proper color handling for Emacs, by
403 Eric J Haywiser <ejh1-AT-MIT.EDU>.
424 Eric J Haywiser <ejh1-AT-MIT.EDU>.
404
425
405 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
426 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
406 by applying the provided patch. Thanks to Liu Jin
427 by applying the provided patch. Thanks to Liu Jin
407 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
428 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
408 XEmacs/Linux, I'm trusting the submitter that it actually helps
429 XEmacs/Linux, I'm trusting the submitter that it actually helps
409 under win32/GNU Emacs. Will revisit if any problems are reported.
430 under win32/GNU Emacs. Will revisit if any problems are reported.
410
431
411 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
432 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
412
433
413 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
434 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
414 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
435 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
415
436
416 2006-03-12 Ville Vainio <vivainio@gmail.com>
437 2006-03-12 Ville Vainio <vivainio@gmail.com>
417
438
418 * Magic.py (magic_timeit): Added %timeit magic, contributed by
439 * Magic.py (magic_timeit): Added %timeit magic, contributed by
419 Torsten Marek.
440 Torsten Marek.
420
441
421 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
442 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
422
443
423 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
444 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
424 line ranges works again.
445 line ranges works again.
425
446
426 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
447 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
427
448
428 * IPython/iplib.py (showtraceback): add back sys.last_traceback
449 * IPython/iplib.py (showtraceback): add back sys.last_traceback
429 and friends, after a discussion with Zach Pincus on ipython-user.
450 and friends, after a discussion with Zach Pincus on ipython-user.
430 I'm not 100% sure, but after thinking about it quite a bit, it may
451 I'm not 100% sure, but after thinking about it quite a bit, it may
431 be OK. Testing with the multithreaded shells didn't reveal any
452 be OK. Testing with the multithreaded shells didn't reveal any
432 problems, but let's keep an eye out.
453 problems, but let's keep an eye out.
433
454
434 In the process, I fixed a few things which were calling
455 In the process, I fixed a few things which were calling
435 self.InteractiveTB() directly (like safe_execfile), which is a
456 self.InteractiveTB() directly (like safe_execfile), which is a
436 mistake: ALL exception reporting should be done by calling
457 mistake: ALL exception reporting should be done by calling
437 self.showtraceback(), which handles state and tab-completion and
458 self.showtraceback(), which handles state and tab-completion and
438 more.
459 more.
439
460
440 2006-03-01 Ville Vainio <vivainio@gmail.com>
461 2006-03-01 Ville Vainio <vivainio@gmail.com>
441
462
442 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
463 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
443 To use, do "from ipipe import *".
464 To use, do "from ipipe import *".
444
465
445 2006-02-24 Ville Vainio <vivainio@gmail.com>
466 2006-02-24 Ville Vainio <vivainio@gmail.com>
446
467
447 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
468 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
448 "cleanly" and safely than the older upgrade mechanism.
469 "cleanly" and safely than the older upgrade mechanism.
449
470
450 2006-02-21 Ville Vainio <vivainio@gmail.com>
471 2006-02-21 Ville Vainio <vivainio@gmail.com>
451
472
452 * Magic.py: %save works again.
473 * Magic.py: %save works again.
453
474
454 2006-02-15 Ville Vainio <vivainio@gmail.com>
475 2006-02-15 Ville Vainio <vivainio@gmail.com>
455
476
456 * Magic.py: %Pprint works again
477 * Magic.py: %Pprint works again
457
478
458 * Extensions/ipy_sane_defaults.py: Provide everything provided
479 * Extensions/ipy_sane_defaults.py: Provide everything provided
459 in default ipythonrc, to make it possible to have a completely empty
480 in default ipythonrc, to make it possible to have a completely empty
460 ipythonrc (and thus completely rc-file free configuration)
481 ipythonrc (and thus completely rc-file free configuration)
461
482
462 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
483 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
463
484
464 * IPython/hooks.py (editor): quote the call to the editor command,
485 * IPython/hooks.py (editor): quote the call to the editor command,
465 to allow commands with spaces in them. Problem noted by watching
486 to allow commands with spaces in them. Problem noted by watching
466 Ian Oswald's video about textpad under win32 at
487 Ian Oswald's video about textpad under win32 at
467 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
488 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
468
489
469 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
490 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
470 describing magics (we haven't used @ for a loong time).
491 describing magics (we haven't used @ for a loong time).
471
492
472 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
493 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
473 contributed by marienz to close
494 contributed by marienz to close
474 http://www.scipy.net/roundup/ipython/issue53.
495 http://www.scipy.net/roundup/ipython/issue53.
475
496
476 2006-02-10 Ville Vainio <vivainio@gmail.com>
497 2006-02-10 Ville Vainio <vivainio@gmail.com>
477
498
478 * genutils.py: getoutput now works in win32 too
499 * genutils.py: getoutput now works in win32 too
479
500
480 * completer.py: alias and magic completion only invoked
501 * completer.py: alias and magic completion only invoked
481 at the first "item" in the line, to avoid "cd %store"
502 at the first "item" in the line, to avoid "cd %store"
482 nonsense.
503 nonsense.
483
504
484 2006-02-09 Ville Vainio <vivainio@gmail.com>
505 2006-02-09 Ville Vainio <vivainio@gmail.com>
485
506
486 * test/*: Added a unit testing framework (finally).
507 * test/*: Added a unit testing framework (finally).
487 '%run runtests.py' to run test_*.
508 '%run runtests.py' to run test_*.
488
509
489 * ipapi.py: Exposed runlines and set_custom_exc
510 * ipapi.py: Exposed runlines and set_custom_exc
490
511
491 2006-02-07 Ville Vainio <vivainio@gmail.com>
512 2006-02-07 Ville Vainio <vivainio@gmail.com>
492
513
493 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
514 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
494 instead use "f(1 2)" as before.
515 instead use "f(1 2)" as before.
495
516
496 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
517 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
497
518
498 * IPython/demo.py (IPythonDemo): Add new classes to the demo
519 * IPython/demo.py (IPythonDemo): Add new classes to the demo
499 facilities, for demos processed by the IPython input filter
520 facilities, for demos processed by the IPython input filter
500 (IPythonDemo), and for running a script one-line-at-a-time as a
521 (IPythonDemo), and for running a script one-line-at-a-time as a
501 demo, both for pure Python (LineDemo) and for IPython-processed
522 demo, both for pure Python (LineDemo) and for IPython-processed
502 input (IPythonLineDemo). After a request by Dave Kohel, from the
523 input (IPythonLineDemo). After a request by Dave Kohel, from the
503 SAGE team.
524 SAGE team.
504 (Demo.edit): added an edit() method to the demo objects, to edit
525 (Demo.edit): added an edit() method to the demo objects, to edit
505 the in-memory copy of the last executed block.
526 the in-memory copy of the last executed block.
506
527
507 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
528 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
508 processing to %edit, %macro and %save. These commands can now be
529 processing to %edit, %macro and %save. These commands can now be
509 invoked on the unprocessed input as it was typed by the user
530 invoked on the unprocessed input as it was typed by the user
510 (without any prefilters applied). After requests by the SAGE team
531 (without any prefilters applied). After requests by the SAGE team
511 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
532 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
512
533
513 2006-02-01 Ville Vainio <vivainio@gmail.com>
534 2006-02-01 Ville Vainio <vivainio@gmail.com>
514
535
515 * setup.py, eggsetup.py: easy_install ipython==dev works
536 * setup.py, eggsetup.py: easy_install ipython==dev works
516 correctly now (on Linux)
537 correctly now (on Linux)
517
538
518 * ipy_user_conf,ipmaker: user config changes, removed spurious
539 * ipy_user_conf,ipmaker: user config changes, removed spurious
519 warnings
540 warnings
520
541
521 * iplib: if rc.banner is string, use it as is.
542 * iplib: if rc.banner is string, use it as is.
522
543
523 * Magic: %pycat accepts a string argument and pages it's contents.
544 * Magic: %pycat accepts a string argument and pages it's contents.
524
545
525
546
526 2006-01-30 Ville Vainio <vivainio@gmail.com>
547 2006-01-30 Ville Vainio <vivainio@gmail.com>
527
548
528 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
549 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
529 Now %store and bookmarks work through PickleShare, meaning that
550 Now %store and bookmarks work through PickleShare, meaning that
530 concurrent access is possible and all ipython sessions see the
551 concurrent access is possible and all ipython sessions see the
531 same database situation all the time, instead of snapshot of
552 same database situation all the time, instead of snapshot of
532 the situation when the session was started. Hence, %bookmark
553 the situation when the session was started. Hence, %bookmark
533 results are immediately accessible from othes sessions. The database
554 results are immediately accessible from othes sessions. The database
534 is also available for use by user extensions. See:
555 is also available for use by user extensions. See:
535 http://www.python.org/pypi/pickleshare
556 http://www.python.org/pypi/pickleshare
536
557
537 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
558 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
538
559
539 * aliases can now be %store'd
560 * aliases can now be %store'd
540
561
541 * path.py moved to Extensions so that pickleshare does not need
562 * path.py moved to Extensions so that pickleshare does not need
542 IPython-specific import. Extensions added to pythonpath right
563 IPython-specific import. Extensions added to pythonpath right
543 at __init__.
564 at __init__.
544
565
545 * iplib.py: ipalias deprecated/redundant; aliases are converted and
566 * iplib.py: ipalias deprecated/redundant; aliases are converted and
546 called with _ip.system and the pre-transformed command string.
567 called with _ip.system and the pre-transformed command string.
547
568
548 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
569 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
549
570
550 * IPython/iplib.py (interact): Fix that we were not catching
571 * IPython/iplib.py (interact): Fix that we were not catching
551 KeyboardInterrupt exceptions properly. I'm not quite sure why the
572 KeyboardInterrupt exceptions properly. I'm not quite sure why the
552 logic here had to change, but it's fixed now.
573 logic here had to change, but it's fixed now.
553
574
554 2006-01-29 Ville Vainio <vivainio@gmail.com>
575 2006-01-29 Ville Vainio <vivainio@gmail.com>
555
576
556 * iplib.py: Try to import pyreadline on Windows.
577 * iplib.py: Try to import pyreadline on Windows.
557
578
558 2006-01-27 Ville Vainio <vivainio@gmail.com>
579 2006-01-27 Ville Vainio <vivainio@gmail.com>
559
580
560 * iplib.py: Expose ipapi as _ip in builtin namespace.
581 * iplib.py: Expose ipapi as _ip in builtin namespace.
561 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
582 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
562 and ip_set_hook (-> _ip.set_hook) redundant. % and !
583 and ip_set_hook (-> _ip.set_hook) redundant. % and !
563 syntax now produce _ip.* variant of the commands.
584 syntax now produce _ip.* variant of the commands.
564
585
565 * "_ip.options().autoedit_syntax = 2" automatically throws
586 * "_ip.options().autoedit_syntax = 2" automatically throws
566 user to editor for syntax error correction without prompting.
587 user to editor for syntax error correction without prompting.
567
588
568 2006-01-27 Ville Vainio <vivainio@gmail.com>
589 2006-01-27 Ville Vainio <vivainio@gmail.com>
569
590
570 * ipmaker.py: Give "realistic" sys.argv for scripts (without
591 * ipmaker.py: Give "realistic" sys.argv for scripts (without
571 'ipython' at argv[0]) executed through command line.
592 'ipython' at argv[0]) executed through command line.
572 NOTE: this DEPRECATES calling ipython with multiple scripts
593 NOTE: this DEPRECATES calling ipython with multiple scripts
573 ("ipython a.py b.py c.py")
594 ("ipython a.py b.py c.py")
574
595
575 * iplib.py, hooks.py: Added configurable input prefilter,
596 * iplib.py, hooks.py: Added configurable input prefilter,
576 named 'input_prefilter'. See ext_rescapture.py for example
597 named 'input_prefilter'. See ext_rescapture.py for example
577 usage.
598 usage.
578
599
579 * ext_rescapture.py, Magic.py: Better system command output capture
600 * ext_rescapture.py, Magic.py: Better system command output capture
580 through 'var = !ls' (deprecates user-visible %sc). Same notation
601 through 'var = !ls' (deprecates user-visible %sc). Same notation
581 applies for magics, 'var = %alias' assigns alias list to var.
602 applies for magics, 'var = %alias' assigns alias list to var.
582
603
583 * ipapi.py: added meta() for accessing extension-usable data store.
604 * ipapi.py: added meta() for accessing extension-usable data store.
584
605
585 * iplib.py: added InteractiveShell.getapi(). New magics should be
606 * iplib.py: added InteractiveShell.getapi(). New magics should be
586 written doing self.getapi() instead of using the shell directly.
607 written doing self.getapi() instead of using the shell directly.
587
608
588 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
609 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
589 %store foo >> ~/myfoo.txt to store variables to files (in clean
610 %store foo >> ~/myfoo.txt to store variables to files (in clean
590 textual form, not a restorable pickle).
611 textual form, not a restorable pickle).
591
612
592 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
613 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
593
614
594 * usage.py, Magic.py: added %quickref
615 * usage.py, Magic.py: added %quickref
595
616
596 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
617 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
597
618
598 * GetoptErrors when invoking magics etc. with wrong args
619 * GetoptErrors when invoking magics etc. with wrong args
599 are now more helpful:
620 are now more helpful:
600 GetoptError: option -l not recognized (allowed: "qb" )
621 GetoptError: option -l not recognized (allowed: "qb" )
601
622
602 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
623 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
603
624
604 * IPython/demo.py (Demo.show): Flush stdout after each block, so
625 * IPython/demo.py (Demo.show): Flush stdout after each block, so
605 computationally intensive blocks don't appear to stall the demo.
626 computationally intensive blocks don't appear to stall the demo.
606
627
607 2006-01-24 Ville Vainio <vivainio@gmail.com>
628 2006-01-24 Ville Vainio <vivainio@gmail.com>
608
629
609 * iplib.py, hooks.py: 'result_display' hook can return a non-None
630 * iplib.py, hooks.py: 'result_display' hook can return a non-None
610 value to manipulate resulting history entry.
631 value to manipulate resulting history entry.
611
632
612 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
633 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
613 to instance methods of IPApi class, to make extending an embedded
634 to instance methods of IPApi class, to make extending an embedded
614 IPython feasible. See ext_rehashdir.py for example usage.
635 IPython feasible. See ext_rehashdir.py for example usage.
615
636
616 * Merged 1071-1076 from branches/0.7.1
637 * Merged 1071-1076 from branches/0.7.1
617
638
618
639
619 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
640 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
620
641
621 * tools/release (daystamp): Fix build tools to use the new
642 * tools/release (daystamp): Fix build tools to use the new
622 eggsetup.py script to build lightweight eggs.
643 eggsetup.py script to build lightweight eggs.
623
644
624 * Applied changesets 1062 and 1064 before 0.7.1 release.
645 * Applied changesets 1062 and 1064 before 0.7.1 release.
625
646
626 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
647 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
627 see the raw input history (without conversions like %ls ->
648 see the raw input history (without conversions like %ls ->
628 ipmagic("ls")). After a request from W. Stein, SAGE
649 ipmagic("ls")). After a request from W. Stein, SAGE
629 (http://modular.ucsd.edu/sage) developer. This information is
650 (http://modular.ucsd.edu/sage) developer. This information is
630 stored in the input_hist_raw attribute of the IPython instance, so
651 stored in the input_hist_raw attribute of the IPython instance, so
631 developers can access it if needed (it's an InputList instance).
652 developers can access it if needed (it's an InputList instance).
632
653
633 * Versionstring = 0.7.2.svn
654 * Versionstring = 0.7.2.svn
634
655
635 * eggsetup.py: A separate script for constructing eggs, creates
656 * eggsetup.py: A separate script for constructing eggs, creates
636 proper launch scripts even on Windows (an .exe file in
657 proper launch scripts even on Windows (an .exe file in
637 \python24\scripts).
658 \python24\scripts).
638
659
639 * ipapi.py: launch_new_instance, launch entry point needed for the
660 * ipapi.py: launch_new_instance, launch entry point needed for the
640 egg.
661 egg.
641
662
642 2006-01-23 Ville Vainio <vivainio@gmail.com>
663 2006-01-23 Ville Vainio <vivainio@gmail.com>
643
664
644 * Added %cpaste magic for pasting python code
665 * Added %cpaste magic for pasting python code
645
666
646 2006-01-22 Ville Vainio <vivainio@gmail.com>
667 2006-01-22 Ville Vainio <vivainio@gmail.com>
647
668
648 * Merge from branches/0.7.1 into trunk, revs 1052-1057
669 * Merge from branches/0.7.1 into trunk, revs 1052-1057
649
670
650 * Versionstring = 0.7.2.svn
671 * Versionstring = 0.7.2.svn
651
672
652 * eggsetup.py: A separate script for constructing eggs, creates
673 * eggsetup.py: A separate script for constructing eggs, creates
653 proper launch scripts even on Windows (an .exe file in
674 proper launch scripts even on Windows (an .exe file in
654 \python24\scripts).
675 \python24\scripts).
655
676
656 * ipapi.py: launch_new_instance, launch entry point needed for the
677 * ipapi.py: launch_new_instance, launch entry point needed for the
657 egg.
678 egg.
658
679
659 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
680 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
660
681
661 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
682 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
662 %pfile foo would print the file for foo even if it was a binary.
683 %pfile foo would print the file for foo even if it was a binary.
663 Now, extensions '.so' and '.dll' are skipped.
684 Now, extensions '.so' and '.dll' are skipped.
664
685
665 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
686 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
666 bug, where macros would fail in all threaded modes. I'm not 100%
687 bug, where macros would fail in all threaded modes. I'm not 100%
667 sure, so I'm going to put out an rc instead of making a release
688 sure, so I'm going to put out an rc instead of making a release
668 today, and wait for feedback for at least a few days.
689 today, and wait for feedback for at least a few days.
669
690
670 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
691 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
671 it...) the handling of pasting external code with autoindent on.
692 it...) the handling of pasting external code with autoindent on.
672 To get out of a multiline input, the rule will appear for most
693 To get out of a multiline input, the rule will appear for most
673 users unchanged: two blank lines or change the indent level
694 users unchanged: two blank lines or change the indent level
674 proposed by IPython. But there is a twist now: you can
695 proposed by IPython. But there is a twist now: you can
675 add/subtract only *one or two spaces*. If you add/subtract three
696 add/subtract only *one or two spaces*. If you add/subtract three
676 or more (unless you completely delete the line), IPython will
697 or more (unless you completely delete the line), IPython will
677 accept that line, and you'll need to enter a second one of pure
698 accept that line, and you'll need to enter a second one of pure
678 whitespace. I know it sounds complicated, but I can't find a
699 whitespace. I know it sounds complicated, but I can't find a
679 different solution that covers all the cases, with the right
700 different solution that covers all the cases, with the right
680 heuristics. Hopefully in actual use, nobody will really notice
701 heuristics. Hopefully in actual use, nobody will really notice
681 all these strange rules and things will 'just work'.
702 all these strange rules and things will 'just work'.
682
703
683 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
704 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
684
705
685 * IPython/iplib.py (interact): catch exceptions which can be
706 * IPython/iplib.py (interact): catch exceptions which can be
686 triggered asynchronously by signal handlers. Thanks to an
707 triggered asynchronously by signal handlers. Thanks to an
687 automatic crash report, submitted by Colin Kingsley
708 automatic crash report, submitted by Colin Kingsley
688 <tercel-AT-gentoo.org>.
709 <tercel-AT-gentoo.org>.
689
710
690 2006-01-20 Ville Vainio <vivainio@gmail.com>
711 2006-01-20 Ville Vainio <vivainio@gmail.com>
691
712
692 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
713 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
693 (%rehashdir, very useful, try it out) of how to extend ipython
714 (%rehashdir, very useful, try it out) of how to extend ipython
694 with new magics. Also added Extensions dir to pythonpath to make
715 with new magics. Also added Extensions dir to pythonpath to make
695 importing extensions easy.
716 importing extensions easy.
696
717
697 * %store now complains when trying to store interactively declared
718 * %store now complains when trying to store interactively declared
698 classes / instances of those classes.
719 classes / instances of those classes.
699
720
700 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
721 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
701 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
722 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
702 if they exist, and ipy_user_conf.py with some defaults is created for
723 if they exist, and ipy_user_conf.py with some defaults is created for
703 the user.
724 the user.
704
725
705 * Startup rehashing done by the config file, not InterpreterExec.
726 * Startup rehashing done by the config file, not InterpreterExec.
706 This means system commands are available even without selecting the
727 This means system commands are available even without selecting the
707 pysh profile. It's the sensible default after all.
728 pysh profile. It's the sensible default after all.
708
729
709 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
730 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
710
731
711 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
732 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
712 multiline code with autoindent on working. But I am really not
733 multiline code with autoindent on working. But I am really not
713 sure, so this needs more testing. Will commit a debug-enabled
734 sure, so this needs more testing. Will commit a debug-enabled
714 version for now, while I test it some more, so that Ville and
735 version for now, while I test it some more, so that Ville and
715 others may also catch any problems. Also made
736 others may also catch any problems. Also made
716 self.indent_current_str() a method, to ensure that there's no
737 self.indent_current_str() a method, to ensure that there's no
717 chance of the indent space count and the corresponding string
738 chance of the indent space count and the corresponding string
718 falling out of sync. All code needing the string should just call
739 falling out of sync. All code needing the string should just call
719 the method.
740 the method.
720
741
721 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
742 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
722
743
723 * IPython/Magic.py (magic_edit): fix check for when users don't
744 * IPython/Magic.py (magic_edit): fix check for when users don't
724 save their output files, the try/except was in the wrong section.
745 save their output files, the try/except was in the wrong section.
725
746
726 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
747 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
727
748
728 * IPython/Magic.py (magic_run): fix __file__ global missing from
749 * IPython/Magic.py (magic_run): fix __file__ global missing from
729 script's namespace when executed via %run. After a report by
750 script's namespace when executed via %run. After a report by
730 Vivian.
751 Vivian.
731
752
732 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
753 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
733 when using python 2.4. The parent constructor changed in 2.4, and
754 when using python 2.4. The parent constructor changed in 2.4, and
734 we need to track it directly (we can't call it, as it messes up
755 we need to track it directly (we can't call it, as it messes up
735 readline and tab-completion inside our pdb would stop working).
756 readline and tab-completion inside our pdb would stop working).
736 After a bug report by R. Bernstein <rocky-AT-panix.com>.
757 After a bug report by R. Bernstein <rocky-AT-panix.com>.
737
758
738 2006-01-16 Ville Vainio <vivainio@gmail.com>
759 2006-01-16 Ville Vainio <vivainio@gmail.com>
739
760
740 * Ipython/magic.py: Reverted back to old %edit functionality
761 * Ipython/magic.py: Reverted back to old %edit functionality
741 that returns file contents on exit.
762 that returns file contents on exit.
742
763
743 * IPython/path.py: Added Jason Orendorff's "path" module to
764 * IPython/path.py: Added Jason Orendorff's "path" module to
744 IPython tree, http://www.jorendorff.com/articles/python/path/.
765 IPython tree, http://www.jorendorff.com/articles/python/path/.
745 You can get path objects conveniently through %sc, and !!, e.g.:
766 You can get path objects conveniently through %sc, and !!, e.g.:
746 sc files=ls
767 sc files=ls
747 for p in files.paths: # or files.p
768 for p in files.paths: # or files.p
748 print p,p.mtime
769 print p,p.mtime
749
770
750 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
771 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
751 now work again without considering the exclusion regexp -
772 now work again without considering the exclusion regexp -
752 hence, things like ',foo my/path' turn to 'foo("my/path")'
773 hence, things like ',foo my/path' turn to 'foo("my/path")'
753 instead of syntax error.
774 instead of syntax error.
754
775
755
776
756 2006-01-14 Ville Vainio <vivainio@gmail.com>
777 2006-01-14 Ville Vainio <vivainio@gmail.com>
757
778
758 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
779 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
759 ipapi decorators for python 2.4 users, options() provides access to rc
780 ipapi decorators for python 2.4 users, options() provides access to rc
760 data.
781 data.
761
782
762 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
783 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
763 as path separators (even on Linux ;-). Space character after
784 as path separators (even on Linux ;-). Space character after
764 backslash (as yielded by tab completer) is still space;
785 backslash (as yielded by tab completer) is still space;
765 "%cd long\ name" works as expected.
786 "%cd long\ name" works as expected.
766
787
767 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
788 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
768 as "chain of command", with priority. API stays the same,
789 as "chain of command", with priority. API stays the same,
769 TryNext exception raised by a hook function signals that
790 TryNext exception raised by a hook function signals that
770 current hook failed and next hook should try handling it, as
791 current hook failed and next hook should try handling it, as
771 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
792 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
772 requested configurable display hook, which is now implemented.
793 requested configurable display hook, which is now implemented.
773
794
774 2006-01-13 Ville Vainio <vivainio@gmail.com>
795 2006-01-13 Ville Vainio <vivainio@gmail.com>
775
796
776 * IPython/platutils*.py: platform specific utility functions,
797 * IPython/platutils*.py: platform specific utility functions,
777 so far only set_term_title is implemented (change terminal
798 so far only set_term_title is implemented (change terminal
778 label in windowing systems). %cd now changes the title to
799 label in windowing systems). %cd now changes the title to
779 current dir.
800 current dir.
780
801
781 * IPython/Release.py: Added myself to "authors" list,
802 * IPython/Release.py: Added myself to "authors" list,
782 had to create new files.
803 had to create new files.
783
804
784 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
805 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
785 shell escape; not a known bug but had potential to be one in the
806 shell escape; not a known bug but had potential to be one in the
786 future.
807 future.
787
808
788 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
809 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
789 extension API for IPython! See the module for usage example. Fix
810 extension API for IPython! See the module for usage example. Fix
790 OInspect for docstring-less magic functions.
811 OInspect for docstring-less magic functions.
791
812
792
813
793 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
814 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
794
815
795 * IPython/iplib.py (raw_input): temporarily deactivate all
816 * IPython/iplib.py (raw_input): temporarily deactivate all
796 attempts at allowing pasting of code with autoindent on. It
817 attempts at allowing pasting of code with autoindent on. It
797 introduced bugs (reported by Prabhu) and I can't seem to find a
818 introduced bugs (reported by Prabhu) and I can't seem to find a
798 robust combination which works in all cases. Will have to revisit
819 robust combination which works in all cases. Will have to revisit
799 later.
820 later.
800
821
801 * IPython/genutils.py: remove isspace() function. We've dropped
822 * IPython/genutils.py: remove isspace() function. We've dropped
802 2.2 compatibility, so it's OK to use the string method.
823 2.2 compatibility, so it's OK to use the string method.
803
824
804 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
825 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
805
826
806 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
827 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
807 matching what NOT to autocall on, to include all python binary
828 matching what NOT to autocall on, to include all python binary
808 operators (including things like 'and', 'or', 'is' and 'in').
829 operators (including things like 'and', 'or', 'is' and 'in').
809 Prompted by a bug report on 'foo & bar', but I realized we had
830 Prompted by a bug report on 'foo & bar', but I realized we had
810 many more potential bug cases with other operators. The regexp is
831 many more potential bug cases with other operators. The regexp is
811 self.re_exclude_auto, it's fairly commented.
832 self.re_exclude_auto, it's fairly commented.
812
833
813 2006-01-12 Ville Vainio <vivainio@gmail.com>
834 2006-01-12 Ville Vainio <vivainio@gmail.com>
814
835
815 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
836 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
816 Prettified and hardened string/backslash quoting with ipsystem(),
837 Prettified and hardened string/backslash quoting with ipsystem(),
817 ipalias() and ipmagic(). Now even \ characters are passed to
838 ipalias() and ipmagic(). Now even \ characters are passed to
818 %magics, !shell escapes and aliases exactly as they are in the
839 %magics, !shell escapes and aliases exactly as they are in the
819 ipython command line. Should improve backslash experience,
840 ipython command line. Should improve backslash experience,
820 particularly in Windows (path delimiter for some commands that
841 particularly in Windows (path delimiter for some commands that
821 won't understand '/'), but Unix benefits as well (regexps). %cd
842 won't understand '/'), but Unix benefits as well (regexps). %cd
822 magic still doesn't support backslash path delimiters, though. Also
843 magic still doesn't support backslash path delimiters, though. Also
823 deleted all pretense of supporting multiline command strings in
844 deleted all pretense of supporting multiline command strings in
824 !system or %magic commands. Thanks to Jerry McRae for suggestions.
845 !system or %magic commands. Thanks to Jerry McRae for suggestions.
825
846
826 * doc/build_doc_instructions.txt added. Documentation on how to
847 * doc/build_doc_instructions.txt added. Documentation on how to
827 use doc/update_manual.py, added yesterday. Both files contributed
848 use doc/update_manual.py, added yesterday. Both files contributed
828 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
849 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
829 doc/*.sh for deprecation at a later date.
850 doc/*.sh for deprecation at a later date.
830
851
831 * /ipython.py Added ipython.py to root directory for
852 * /ipython.py Added ipython.py to root directory for
832 zero-installation (tar xzvf ipython.tgz; cd ipython; python
853 zero-installation (tar xzvf ipython.tgz; cd ipython; python
833 ipython.py) and development convenience (no need to keep doing
854 ipython.py) and development convenience (no need to keep doing
834 "setup.py install" between changes).
855 "setup.py install" between changes).
835
856
836 * Made ! and !! shell escapes work (again) in multiline expressions:
857 * Made ! and !! shell escapes work (again) in multiline expressions:
837 if 1:
858 if 1:
838 !ls
859 !ls
839 !!ls
860 !!ls
840
861
841 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
862 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
842
863
843 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
864 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
844 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
865 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
845 module in case-insensitive installation. Was causing crashes
866 module in case-insensitive installation. Was causing crashes
846 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
867 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
847
868
848 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
869 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
849 <marienz-AT-gentoo.org>, closes
870 <marienz-AT-gentoo.org>, closes
850 http://www.scipy.net/roundup/ipython/issue51.
871 http://www.scipy.net/roundup/ipython/issue51.
851
872
852 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
873 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
853
874
854 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
875 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
855 problem of excessive CPU usage under *nix and keyboard lag under
876 problem of excessive CPU usage under *nix and keyboard lag under
856 win32.
877 win32.
857
878
858 2006-01-10 *** Released version 0.7.0
879 2006-01-10 *** Released version 0.7.0
859
880
860 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
881 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
861
882
862 * IPython/Release.py (revision): tag version number to 0.7.0,
883 * IPython/Release.py (revision): tag version number to 0.7.0,
863 ready for release.
884 ready for release.
864
885
865 * IPython/Magic.py (magic_edit): Add print statement to %edit so
886 * IPython/Magic.py (magic_edit): Add print statement to %edit so
866 it informs the user of the name of the temp. file used. This can
887 it informs the user of the name of the temp. file used. This can
867 help if you decide later to reuse that same file, so you know
888 help if you decide later to reuse that same file, so you know
868 where to copy the info from.
889 where to copy the info from.
869
890
870 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
891 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
871
892
872 * setup_bdist_egg.py: little script to build an egg. Added
893 * setup_bdist_egg.py: little script to build an egg. Added
873 support in the release tools as well.
894 support in the release tools as well.
874
895
875 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
896 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
876
897
877 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
898 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
878 version selection (new -wxversion command line and ipythonrc
899 version selection (new -wxversion command line and ipythonrc
879 parameter). Patch contributed by Arnd Baecker
900 parameter). Patch contributed by Arnd Baecker
880 <arnd.baecker-AT-web.de>.
901 <arnd.baecker-AT-web.de>.
881
902
882 * IPython/iplib.py (embed_mainloop): fix tab-completion in
903 * IPython/iplib.py (embed_mainloop): fix tab-completion in
883 embedded instances, for variables defined at the interactive
904 embedded instances, for variables defined at the interactive
884 prompt of the embedded ipython. Reported by Arnd.
905 prompt of the embedded ipython. Reported by Arnd.
885
906
886 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
907 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
887 it can be used as a (stateful) toggle, or with a direct parameter.
908 it can be used as a (stateful) toggle, or with a direct parameter.
888
909
889 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
910 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
890 could be triggered in certain cases and cause the traceback
911 could be triggered in certain cases and cause the traceback
891 printer not to work.
912 printer not to work.
892
913
893 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
914 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
894
915
895 * IPython/iplib.py (_should_recompile): Small fix, closes
916 * IPython/iplib.py (_should_recompile): Small fix, closes
896 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
917 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
897
918
898 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
919 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
899
920
900 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
921 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
901 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
922 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
902 Moad for help with tracking it down.
923 Moad for help with tracking it down.
903
924
904 * IPython/iplib.py (handle_auto): fix autocall handling for
925 * IPython/iplib.py (handle_auto): fix autocall handling for
905 objects which support BOTH __getitem__ and __call__ (so that f [x]
926 objects which support BOTH __getitem__ and __call__ (so that f [x]
906 is left alone, instead of becoming f([x]) automatically).
927 is left alone, instead of becoming f([x]) automatically).
907
928
908 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
929 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
909 Ville's patch.
930 Ville's patch.
910
931
911 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
932 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
912
933
913 * IPython/iplib.py (handle_auto): changed autocall semantics to
934 * IPython/iplib.py (handle_auto): changed autocall semantics to
914 include 'smart' mode, where the autocall transformation is NOT
935 include 'smart' mode, where the autocall transformation is NOT
915 applied if there are no arguments on the line. This allows you to
936 applied if there are no arguments on the line. This allows you to
916 just type 'foo' if foo is a callable to see its internal form,
937 just type 'foo' if foo is a callable to see its internal form,
917 instead of having it called with no arguments (typically a
938 instead of having it called with no arguments (typically a
918 mistake). The old 'full' autocall still exists: for that, you
939 mistake). The old 'full' autocall still exists: for that, you
919 need to set the 'autocall' parameter to 2 in your ipythonrc file.
940 need to set the 'autocall' parameter to 2 in your ipythonrc file.
920
941
921 * IPython/completer.py (Completer.attr_matches): add
942 * IPython/completer.py (Completer.attr_matches): add
922 tab-completion support for Enthoughts' traits. After a report by
943 tab-completion support for Enthoughts' traits. After a report by
923 Arnd and a patch by Prabhu.
944 Arnd and a patch by Prabhu.
924
945
925 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
946 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
926
947
927 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
948 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
928 Schmolck's patch to fix inspect.getinnerframes().
949 Schmolck's patch to fix inspect.getinnerframes().
929
950
930 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
951 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
931 for embedded instances, regarding handling of namespaces and items
952 for embedded instances, regarding handling of namespaces and items
932 added to the __builtin__ one. Multiple embedded instances and
953 added to the __builtin__ one. Multiple embedded instances and
933 recursive embeddings should work better now (though I'm not sure
954 recursive embeddings should work better now (though I'm not sure
934 I've got all the corner cases fixed, that code is a bit of a brain
955 I've got all the corner cases fixed, that code is a bit of a brain
935 twister).
956 twister).
936
957
937 * IPython/Magic.py (magic_edit): added support to edit in-memory
958 * IPython/Magic.py (magic_edit): added support to edit in-memory
938 macros (automatically creates the necessary temp files). %edit
959 macros (automatically creates the necessary temp files). %edit
939 also doesn't return the file contents anymore, it's just noise.
960 also doesn't return the file contents anymore, it's just noise.
940
961
941 * IPython/completer.py (Completer.attr_matches): revert change to
962 * IPython/completer.py (Completer.attr_matches): revert change to
942 complete only on attributes listed in __all__. I realized it
963 complete only on attributes listed in __all__. I realized it
943 cripples the tab-completion system as a tool for exploring the
964 cripples the tab-completion system as a tool for exploring the
944 internals of unknown libraries (it renders any non-__all__
965 internals of unknown libraries (it renders any non-__all__
945 attribute off-limits). I got bit by this when trying to see
966 attribute off-limits). I got bit by this when trying to see
946 something inside the dis module.
967 something inside the dis module.
947
968
948 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
969 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
949
970
950 * IPython/iplib.py (InteractiveShell.__init__): add .meta
971 * IPython/iplib.py (InteractiveShell.__init__): add .meta
951 namespace for users and extension writers to hold data in. This
972 namespace for users and extension writers to hold data in. This
952 follows the discussion in
973 follows the discussion in
953 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
974 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
954
975
955 * IPython/completer.py (IPCompleter.complete): small patch to help
976 * IPython/completer.py (IPCompleter.complete): small patch to help
956 tab-completion under Emacs, after a suggestion by John Barnard
977 tab-completion under Emacs, after a suggestion by John Barnard
957 <barnarj-AT-ccf.org>.
978 <barnarj-AT-ccf.org>.
958
979
959 * IPython/Magic.py (Magic.extract_input_slices): added support for
980 * IPython/Magic.py (Magic.extract_input_slices): added support for
960 the slice notation in magics to use N-M to represent numbers N...M
981 the slice notation in magics to use N-M to represent numbers N...M
961 (closed endpoints). This is used by %macro and %save.
982 (closed endpoints). This is used by %macro and %save.
962
983
963 * IPython/completer.py (Completer.attr_matches): for modules which
984 * IPython/completer.py (Completer.attr_matches): for modules which
964 define __all__, complete only on those. After a patch by Jeffrey
985 define __all__, complete only on those. After a patch by Jeffrey
965 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
986 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
966 speed up this routine.
987 speed up this routine.
967
988
968 * IPython/Logger.py (Logger.log): fix a history handling bug. I
989 * IPython/Logger.py (Logger.log): fix a history handling bug. I
969 don't know if this is the end of it, but the behavior now is
990 don't know if this is the end of it, but the behavior now is
970 certainly much more correct. Note that coupled with macros,
991 certainly much more correct. Note that coupled with macros,
971 slightly surprising (at first) behavior may occur: a macro will in
992 slightly surprising (at first) behavior may occur: a macro will in
972 general expand to multiple lines of input, so upon exiting, the
993 general expand to multiple lines of input, so upon exiting, the
973 in/out counters will both be bumped by the corresponding amount
994 in/out counters will both be bumped by the corresponding amount
974 (as if the macro's contents had been typed interactively). Typing
995 (as if the macro's contents had been typed interactively). Typing
975 %hist will reveal the intermediate (silently processed) lines.
996 %hist will reveal the intermediate (silently processed) lines.
976
997
977 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
998 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
978 pickle to fail (%run was overwriting __main__ and not restoring
999 pickle to fail (%run was overwriting __main__ and not restoring
979 it, but pickle relies on __main__ to operate).
1000 it, but pickle relies on __main__ to operate).
980
1001
981 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1002 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
982 using properties, but forgot to make the main InteractiveShell
1003 using properties, but forgot to make the main InteractiveShell
983 class a new-style class. Properties fail silently, and
1004 class a new-style class. Properties fail silently, and
984 mysteriously, with old-style class (getters work, but
1005 mysteriously, with old-style class (getters work, but
985 setters don't do anything).
1006 setters don't do anything).
986
1007
987 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1008 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
988
1009
989 * IPython/Magic.py (magic_history): fix history reporting bug (I
1010 * IPython/Magic.py (magic_history): fix history reporting bug (I
990 know some nasties are still there, I just can't seem to find a
1011 know some nasties are still there, I just can't seem to find a
991 reproducible test case to track them down; the input history is
1012 reproducible test case to track them down; the input history is
992 falling out of sync...)
1013 falling out of sync...)
993
1014
994 * IPython/iplib.py (handle_shell_escape): fix bug where both
1015 * IPython/iplib.py (handle_shell_escape): fix bug where both
995 aliases and system accesses where broken for indented code (such
1016 aliases and system accesses where broken for indented code (such
996 as loops).
1017 as loops).
997
1018
998 * IPython/genutils.py (shell): fix small but critical bug for
1019 * IPython/genutils.py (shell): fix small but critical bug for
999 win32 system access.
1020 win32 system access.
1000
1021
1001 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1022 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1002
1023
1003 * IPython/iplib.py (showtraceback): remove use of the
1024 * IPython/iplib.py (showtraceback): remove use of the
1004 sys.last_{type/value/traceback} structures, which are non
1025 sys.last_{type/value/traceback} structures, which are non
1005 thread-safe.
1026 thread-safe.
1006 (_prefilter): change control flow to ensure that we NEVER
1027 (_prefilter): change control flow to ensure that we NEVER
1007 introspect objects when autocall is off. This will guarantee that
1028 introspect objects when autocall is off. This will guarantee that
1008 having an input line of the form 'x.y', where access to attribute
1029 having an input line of the form 'x.y', where access to attribute
1009 'y' has side effects, doesn't trigger the side effect TWICE. It
1030 'y' has side effects, doesn't trigger the side effect TWICE. It
1010 is important to note that, with autocall on, these side effects
1031 is important to note that, with autocall on, these side effects
1011 can still happen.
1032 can still happen.
1012 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1033 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1013 trio. IPython offers these three kinds of special calls which are
1034 trio. IPython offers these three kinds of special calls which are
1014 not python code, and it's a good thing to have their call method
1035 not python code, and it's a good thing to have their call method
1015 be accessible as pure python functions (not just special syntax at
1036 be accessible as pure python functions (not just special syntax at
1016 the command line). It gives us a better internal implementation
1037 the command line). It gives us a better internal implementation
1017 structure, as well as exposing these for user scripting more
1038 structure, as well as exposing these for user scripting more
1018 cleanly.
1039 cleanly.
1019
1040
1020 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1041 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1021 file. Now that they'll be more likely to be used with the
1042 file. Now that they'll be more likely to be used with the
1022 persistance system (%store), I want to make sure their module path
1043 persistance system (%store), I want to make sure their module path
1023 doesn't change in the future, so that we don't break things for
1044 doesn't change in the future, so that we don't break things for
1024 users' persisted data.
1045 users' persisted data.
1025
1046
1026 * IPython/iplib.py (autoindent_update): move indentation
1047 * IPython/iplib.py (autoindent_update): move indentation
1027 management into the _text_ processing loop, not the keyboard
1048 management into the _text_ processing loop, not the keyboard
1028 interactive one. This is necessary to correctly process non-typed
1049 interactive one. This is necessary to correctly process non-typed
1029 multiline input (such as macros).
1050 multiline input (such as macros).
1030
1051
1031 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1052 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1032 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1053 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1033 which was producing problems in the resulting manual.
1054 which was producing problems in the resulting manual.
1034 (magic_whos): improve reporting of instances (show their class,
1055 (magic_whos): improve reporting of instances (show their class,
1035 instead of simply printing 'instance' which isn't terribly
1056 instead of simply printing 'instance' which isn't terribly
1036 informative).
1057 informative).
1037
1058
1038 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1059 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1039 (minor mods) to support network shares under win32.
1060 (minor mods) to support network shares under win32.
1040
1061
1041 * IPython/winconsole.py (get_console_size): add new winconsole
1062 * IPython/winconsole.py (get_console_size): add new winconsole
1042 module and fixes to page_dumb() to improve its behavior under
1063 module and fixes to page_dumb() to improve its behavior under
1043 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1064 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1044
1065
1045 * IPython/Magic.py (Macro): simplified Macro class to just
1066 * IPython/Magic.py (Macro): simplified Macro class to just
1046 subclass list. We've had only 2.2 compatibility for a very long
1067 subclass list. We've had only 2.2 compatibility for a very long
1047 time, yet I was still avoiding subclassing the builtin types. No
1068 time, yet I was still avoiding subclassing the builtin types. No
1048 more (I'm also starting to use properties, though I won't shift to
1069 more (I'm also starting to use properties, though I won't shift to
1049 2.3-specific features quite yet).
1070 2.3-specific features quite yet).
1050 (magic_store): added Ville's patch for lightweight variable
1071 (magic_store): added Ville's patch for lightweight variable
1051 persistence, after a request on the user list by Matt Wilkie
1072 persistence, after a request on the user list by Matt Wilkie
1052 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1073 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1053 details.
1074 details.
1054
1075
1055 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1076 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1056 changed the default logfile name from 'ipython.log' to
1077 changed the default logfile name from 'ipython.log' to
1057 'ipython_log.py'. These logs are real python files, and now that
1078 'ipython_log.py'. These logs are real python files, and now that
1058 we have much better multiline support, people are more likely to
1079 we have much better multiline support, people are more likely to
1059 want to use them as such. Might as well name them correctly.
1080 want to use them as such. Might as well name them correctly.
1060
1081
1061 * IPython/Magic.py: substantial cleanup. While we can't stop
1082 * IPython/Magic.py: substantial cleanup. While we can't stop
1062 using magics as mixins, due to the existing customizations 'out
1083 using magics as mixins, due to the existing customizations 'out
1063 there' which rely on the mixin naming conventions, at least I
1084 there' which rely on the mixin naming conventions, at least I
1064 cleaned out all cross-class name usage. So once we are OK with
1085 cleaned out all cross-class name usage. So once we are OK with
1065 breaking compatibility, the two systems can be separated.
1086 breaking compatibility, the two systems can be separated.
1066
1087
1067 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1088 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1068 anymore, and the class is a fair bit less hideous as well. New
1089 anymore, and the class is a fair bit less hideous as well. New
1069 features were also introduced: timestamping of input, and logging
1090 features were also introduced: timestamping of input, and logging
1070 of output results. These are user-visible with the -t and -o
1091 of output results. These are user-visible with the -t and -o
1071 options to %logstart. Closes
1092 options to %logstart. Closes
1072 http://www.scipy.net/roundup/ipython/issue11 and a request by
1093 http://www.scipy.net/roundup/ipython/issue11 and a request by
1073 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1094 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1074
1095
1075 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1096 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1076
1097
1077 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1098 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1078 better handle backslashes in paths. See the thread 'More Windows
1099 better handle backslashes in paths. See the thread 'More Windows
1079 questions part 2 - \/ characters revisited' on the iypthon user
1100 questions part 2 - \/ characters revisited' on the iypthon user
1080 list:
1101 list:
1081 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1102 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1082
1103
1083 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1104 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1084
1105
1085 (InteractiveShell.__init__): change threaded shells to not use the
1106 (InteractiveShell.__init__): change threaded shells to not use the
1086 ipython crash handler. This was causing more problems than not,
1107 ipython crash handler. This was causing more problems than not,
1087 as exceptions in the main thread (GUI code, typically) would
1108 as exceptions in the main thread (GUI code, typically) would
1088 always show up as a 'crash', when they really weren't.
1109 always show up as a 'crash', when they really weren't.
1089
1110
1090 The colors and exception mode commands (%colors/%xmode) have been
1111 The colors and exception mode commands (%colors/%xmode) have been
1091 synchronized to also take this into account, so users can get
1112 synchronized to also take this into account, so users can get
1092 verbose exceptions for their threaded code as well. I also added
1113 verbose exceptions for their threaded code as well. I also added
1093 support for activating pdb inside this exception handler as well,
1114 support for activating pdb inside this exception handler as well,
1094 so now GUI authors can use IPython's enhanced pdb at runtime.
1115 so now GUI authors can use IPython's enhanced pdb at runtime.
1095
1116
1096 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1117 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1097 true by default, and add it to the shipped ipythonrc file. Since
1118 true by default, and add it to the shipped ipythonrc file. Since
1098 this asks the user before proceeding, I think it's OK to make it
1119 this asks the user before proceeding, I think it's OK to make it
1099 true by default.
1120 true by default.
1100
1121
1101 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1122 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1102 of the previous special-casing of input in the eval loop. I think
1123 of the previous special-casing of input in the eval loop. I think
1103 this is cleaner, as they really are commands and shouldn't have
1124 this is cleaner, as they really are commands and shouldn't have
1104 a special role in the middle of the core code.
1125 a special role in the middle of the core code.
1105
1126
1106 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1127 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1107
1128
1108 * IPython/iplib.py (edit_syntax_error): added support for
1129 * IPython/iplib.py (edit_syntax_error): added support for
1109 automatically reopening the editor if the file had a syntax error
1130 automatically reopening the editor if the file had a syntax error
1110 in it. Thanks to scottt who provided the patch at:
1131 in it. Thanks to scottt who provided the patch at:
1111 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1132 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1112 version committed).
1133 version committed).
1113
1134
1114 * IPython/iplib.py (handle_normal): add suport for multi-line
1135 * IPython/iplib.py (handle_normal): add suport for multi-line
1115 input with emtpy lines. This fixes
1136 input with emtpy lines. This fixes
1116 http://www.scipy.net/roundup/ipython/issue43 and a similar
1137 http://www.scipy.net/roundup/ipython/issue43 and a similar
1117 discussion on the user list.
1138 discussion on the user list.
1118
1139
1119 WARNING: a behavior change is necessarily introduced to support
1140 WARNING: a behavior change is necessarily introduced to support
1120 blank lines: now a single blank line with whitespace does NOT
1141 blank lines: now a single blank line with whitespace does NOT
1121 break the input loop, which means that when autoindent is on, by
1142 break the input loop, which means that when autoindent is on, by
1122 default hitting return on the next (indented) line does NOT exit.
1143 default hitting return on the next (indented) line does NOT exit.
1123
1144
1124 Instead, to exit a multiline input you can either have:
1145 Instead, to exit a multiline input you can either have:
1125
1146
1126 - TWO whitespace lines (just hit return again), or
1147 - TWO whitespace lines (just hit return again), or
1127 - a single whitespace line of a different length than provided
1148 - a single whitespace line of a different length than provided
1128 by the autoindent (add or remove a space).
1149 by the autoindent (add or remove a space).
1129
1150
1130 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1151 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1131 module to better organize all readline-related functionality.
1152 module to better organize all readline-related functionality.
1132 I've deleted FlexCompleter and put all completion clases here.
1153 I've deleted FlexCompleter and put all completion clases here.
1133
1154
1134 * IPython/iplib.py (raw_input): improve indentation management.
1155 * IPython/iplib.py (raw_input): improve indentation management.
1135 It is now possible to paste indented code with autoindent on, and
1156 It is now possible to paste indented code with autoindent on, and
1136 the code is interpreted correctly (though it still looks bad on
1157 the code is interpreted correctly (though it still looks bad on
1137 screen, due to the line-oriented nature of ipython).
1158 screen, due to the line-oriented nature of ipython).
1138 (MagicCompleter.complete): change behavior so that a TAB key on an
1159 (MagicCompleter.complete): change behavior so that a TAB key on an
1139 otherwise empty line actually inserts a tab, instead of completing
1160 otherwise empty line actually inserts a tab, instead of completing
1140 on the entire global namespace. This makes it easier to use the
1161 on the entire global namespace. This makes it easier to use the
1141 TAB key for indentation. After a request by Hans Meine
1162 TAB key for indentation. After a request by Hans Meine
1142 <hans_meine-AT-gmx.net>
1163 <hans_meine-AT-gmx.net>
1143 (_prefilter): add support so that typing plain 'exit' or 'quit'
1164 (_prefilter): add support so that typing plain 'exit' or 'quit'
1144 does a sensible thing. Originally I tried to deviate as little as
1165 does a sensible thing. Originally I tried to deviate as little as
1145 possible from the default python behavior, but even that one may
1166 possible from the default python behavior, but even that one may
1146 change in this direction (thread on python-dev to that effect).
1167 change in this direction (thread on python-dev to that effect).
1147 Regardless, ipython should do the right thing even if CPython's
1168 Regardless, ipython should do the right thing even if CPython's
1148 '>>>' prompt doesn't.
1169 '>>>' prompt doesn't.
1149 (InteractiveShell): removed subclassing code.InteractiveConsole
1170 (InteractiveShell): removed subclassing code.InteractiveConsole
1150 class. By now we'd overridden just about all of its methods: I've
1171 class. By now we'd overridden just about all of its methods: I've
1151 copied the remaining two over, and now ipython is a standalone
1172 copied the remaining two over, and now ipython is a standalone
1152 class. This will provide a clearer picture for the chainsaw
1173 class. This will provide a clearer picture for the chainsaw
1153 branch refactoring.
1174 branch refactoring.
1154
1175
1155 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1176 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1156
1177
1157 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1178 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1158 failures for objects which break when dir() is called on them.
1179 failures for objects which break when dir() is called on them.
1159
1180
1160 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1181 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1161 distinct local and global namespaces in the completer API. This
1182 distinct local and global namespaces in the completer API. This
1162 change allows us to properly handle completion with distinct
1183 change allows us to properly handle completion with distinct
1163 scopes, including in embedded instances (this had never really
1184 scopes, including in embedded instances (this had never really
1164 worked correctly).
1185 worked correctly).
1165
1186
1166 Note: this introduces a change in the constructor for
1187 Note: this introduces a change in the constructor for
1167 MagicCompleter, as a new global_namespace parameter is now the
1188 MagicCompleter, as a new global_namespace parameter is now the
1168 second argument (the others were bumped one position).
1189 second argument (the others were bumped one position).
1169
1190
1170 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1191 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1171
1192
1172 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1193 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1173 embedded instances (which can be done now thanks to Vivian's
1194 embedded instances (which can be done now thanks to Vivian's
1174 frame-handling fixes for pdb).
1195 frame-handling fixes for pdb).
1175 (InteractiveShell.__init__): Fix namespace handling problem in
1196 (InteractiveShell.__init__): Fix namespace handling problem in
1176 embedded instances. We were overwriting __main__ unconditionally,
1197 embedded instances. We were overwriting __main__ unconditionally,
1177 and this should only be done for 'full' (non-embedded) IPython;
1198 and this should only be done for 'full' (non-embedded) IPython;
1178 embedded instances must respect the caller's __main__. Thanks to
1199 embedded instances must respect the caller's __main__. Thanks to
1179 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1200 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1180
1201
1181 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1202 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1182
1203
1183 * setup.py: added download_url to setup(). This registers the
1204 * setup.py: added download_url to setup(). This registers the
1184 download address at PyPI, which is not only useful to humans
1205 download address at PyPI, which is not only useful to humans
1185 browsing the site, but is also picked up by setuptools (the Eggs
1206 browsing the site, but is also picked up by setuptools (the Eggs
1186 machinery). Thanks to Ville and R. Kern for the info/discussion
1207 machinery). Thanks to Ville and R. Kern for the info/discussion
1187 on this.
1208 on this.
1188
1209
1189 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1210 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1190
1211
1191 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1212 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1192 This brings a lot of nice functionality to the pdb mode, which now
1213 This brings a lot of nice functionality to the pdb mode, which now
1193 has tab-completion, syntax highlighting, and better stack handling
1214 has tab-completion, syntax highlighting, and better stack handling
1194 than before. Many thanks to Vivian De Smedt
1215 than before. Many thanks to Vivian De Smedt
1195 <vivian-AT-vdesmedt.com> for the original patches.
1216 <vivian-AT-vdesmedt.com> for the original patches.
1196
1217
1197 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1218 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1198
1219
1199 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1220 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1200 sequence to consistently accept the banner argument. The
1221 sequence to consistently accept the banner argument. The
1201 inconsistency was tripping SAGE, thanks to Gary Zablackis
1222 inconsistency was tripping SAGE, thanks to Gary Zablackis
1202 <gzabl-AT-yahoo.com> for the report.
1223 <gzabl-AT-yahoo.com> for the report.
1203
1224
1204 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1225 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1205
1226
1206 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1227 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1207 Fix bug where a naked 'alias' call in the ipythonrc file would
1228 Fix bug where a naked 'alias' call in the ipythonrc file would
1208 cause a crash. Bug reported by Jorgen Stenarson.
1229 cause a crash. Bug reported by Jorgen Stenarson.
1209
1230
1210 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1231 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1211
1232
1212 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1233 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1213 startup time.
1234 startup time.
1214
1235
1215 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1236 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1216 instances had introduced a bug with globals in normal code. Now
1237 instances had introduced a bug with globals in normal code. Now
1217 it's working in all cases.
1238 it's working in all cases.
1218
1239
1219 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1240 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1220 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1241 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1221 has been introduced to set the default case sensitivity of the
1242 has been introduced to set the default case sensitivity of the
1222 searches. Users can still select either mode at runtime on a
1243 searches. Users can still select either mode at runtime on a
1223 per-search basis.
1244 per-search basis.
1224
1245
1225 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1246 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1226
1247
1227 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1248 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1228 attributes in wildcard searches for subclasses. Modified version
1249 attributes in wildcard searches for subclasses. Modified version
1229 of a patch by Jorgen.
1250 of a patch by Jorgen.
1230
1251
1231 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1252 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1232
1253
1233 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1254 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1234 embedded instances. I added a user_global_ns attribute to the
1255 embedded instances. I added a user_global_ns attribute to the
1235 InteractiveShell class to handle this.
1256 InteractiveShell class to handle this.
1236
1257
1237 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1258 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1238
1259
1239 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1260 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1240 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1261 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1241 (reported under win32, but may happen also in other platforms).
1262 (reported under win32, but may happen also in other platforms).
1242 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1263 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1243
1264
1244 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1265 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1245
1266
1246 * IPython/Magic.py (magic_psearch): new support for wildcard
1267 * IPython/Magic.py (magic_psearch): new support for wildcard
1247 patterns. Now, typing ?a*b will list all names which begin with a
1268 patterns. Now, typing ?a*b will list all names which begin with a
1248 and end in b, for example. The %psearch magic has full
1269 and end in b, for example. The %psearch magic has full
1249 docstrings. Many thanks to JΓΆrgen Stenarson
1270 docstrings. Many thanks to JΓΆrgen Stenarson
1250 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1271 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1251 implementing this functionality.
1272 implementing this functionality.
1252
1273
1253 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1274 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1254
1275
1255 * Manual: fixed long-standing annoyance of double-dashes (as in
1276 * Manual: fixed long-standing annoyance of double-dashes (as in
1256 --prefix=~, for example) being stripped in the HTML version. This
1277 --prefix=~, for example) being stripped in the HTML version. This
1257 is a latex2html bug, but a workaround was provided. Many thanks
1278 is a latex2html bug, but a workaround was provided. Many thanks
1258 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1279 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1259 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1280 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1260 rolling. This seemingly small issue had tripped a number of users
1281 rolling. This seemingly small issue had tripped a number of users
1261 when first installing, so I'm glad to see it gone.
1282 when first installing, so I'm glad to see it gone.
1262
1283
1263 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1284 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1264
1285
1265 * IPython/Extensions/numeric_formats.py: fix missing import,
1286 * IPython/Extensions/numeric_formats.py: fix missing import,
1266 reported by Stephen Walton.
1287 reported by Stephen Walton.
1267
1288
1268 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1289 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1269
1290
1270 * IPython/demo.py: finish demo module, fully documented now.
1291 * IPython/demo.py: finish demo module, fully documented now.
1271
1292
1272 * IPython/genutils.py (file_read): simple little utility to read a
1293 * IPython/genutils.py (file_read): simple little utility to read a
1273 file and ensure it's closed afterwards.
1294 file and ensure it's closed afterwards.
1274
1295
1275 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1296 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1276
1297
1277 * IPython/demo.py (Demo.__init__): added support for individually
1298 * IPython/demo.py (Demo.__init__): added support for individually
1278 tagging blocks for automatic execution.
1299 tagging blocks for automatic execution.
1279
1300
1280 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1301 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1281 syntax-highlighted python sources, requested by John.
1302 syntax-highlighted python sources, requested by John.
1282
1303
1283 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1304 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1284
1305
1285 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1306 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1286 finishing.
1307 finishing.
1287
1308
1288 * IPython/genutils.py (shlex_split): moved from Magic to here,
1309 * IPython/genutils.py (shlex_split): moved from Magic to here,
1289 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1310 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1290
1311
1291 * IPython/demo.py (Demo.__init__): added support for silent
1312 * IPython/demo.py (Demo.__init__): added support for silent
1292 blocks, improved marks as regexps, docstrings written.
1313 blocks, improved marks as regexps, docstrings written.
1293 (Demo.__init__): better docstring, added support for sys.argv.
1314 (Demo.__init__): better docstring, added support for sys.argv.
1294
1315
1295 * IPython/genutils.py (marquee): little utility used by the demo
1316 * IPython/genutils.py (marquee): little utility used by the demo
1296 code, handy in general.
1317 code, handy in general.
1297
1318
1298 * IPython/demo.py (Demo.__init__): new class for interactive
1319 * IPython/demo.py (Demo.__init__): new class for interactive
1299 demos. Not documented yet, I just wrote it in a hurry for
1320 demos. Not documented yet, I just wrote it in a hurry for
1300 scipy'05. Will docstring later.
1321 scipy'05. Will docstring later.
1301
1322
1302 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1323 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1303
1324
1304 * IPython/Shell.py (sigint_handler): Drastic simplification which
1325 * IPython/Shell.py (sigint_handler): Drastic simplification which
1305 also seems to make Ctrl-C work correctly across threads! This is
1326 also seems to make Ctrl-C work correctly across threads! This is
1306 so simple, that I can't beleive I'd missed it before. Needs more
1327 so simple, that I can't beleive I'd missed it before. Needs more
1307 testing, though.
1328 testing, though.
1308 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1329 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1309 like this before...
1330 like this before...
1310
1331
1311 * IPython/genutils.py (get_home_dir): add protection against
1332 * IPython/genutils.py (get_home_dir): add protection against
1312 non-dirs in win32 registry.
1333 non-dirs in win32 registry.
1313
1334
1314 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1335 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1315 bug where dict was mutated while iterating (pysh crash).
1336 bug where dict was mutated while iterating (pysh crash).
1316
1337
1317 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1338 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1318
1339
1319 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1340 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1320 spurious newlines added by this routine. After a report by
1341 spurious newlines added by this routine. After a report by
1321 F. Mantegazza.
1342 F. Mantegazza.
1322
1343
1323 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1344 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1324
1345
1325 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1346 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1326 calls. These were a leftover from the GTK 1.x days, and can cause
1347 calls. These were a leftover from the GTK 1.x days, and can cause
1327 problems in certain cases (after a report by John Hunter).
1348 problems in certain cases (after a report by John Hunter).
1328
1349
1329 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1350 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1330 os.getcwd() fails at init time. Thanks to patch from David Remahl
1351 os.getcwd() fails at init time. Thanks to patch from David Remahl
1331 <chmod007-AT-mac.com>.
1352 <chmod007-AT-mac.com>.
1332 (InteractiveShell.__init__): prevent certain special magics from
1353 (InteractiveShell.__init__): prevent certain special magics from
1333 being shadowed by aliases. Closes
1354 being shadowed by aliases. Closes
1334 http://www.scipy.net/roundup/ipython/issue41.
1355 http://www.scipy.net/roundup/ipython/issue41.
1335
1356
1336 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1357 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1337
1358
1338 * IPython/iplib.py (InteractiveShell.complete): Added new
1359 * IPython/iplib.py (InteractiveShell.complete): Added new
1339 top-level completion method to expose the completion mechanism
1360 top-level completion method to expose the completion mechanism
1340 beyond readline-based environments.
1361 beyond readline-based environments.
1341
1362
1342 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1363 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1343
1364
1344 * tools/ipsvnc (svnversion): fix svnversion capture.
1365 * tools/ipsvnc (svnversion): fix svnversion capture.
1345
1366
1346 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1367 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1347 attribute to self, which was missing. Before, it was set by a
1368 attribute to self, which was missing. Before, it was set by a
1348 routine which in certain cases wasn't being called, so the
1369 routine which in certain cases wasn't being called, so the
1349 instance could end up missing the attribute. This caused a crash.
1370 instance could end up missing the attribute. This caused a crash.
1350 Closes http://www.scipy.net/roundup/ipython/issue40.
1371 Closes http://www.scipy.net/roundup/ipython/issue40.
1351
1372
1352 2005-08-16 Fernando Perez <fperez@colorado.edu>
1373 2005-08-16 Fernando Perez <fperez@colorado.edu>
1353
1374
1354 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1375 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1355 contains non-string attribute. Closes
1376 contains non-string attribute. Closes
1356 http://www.scipy.net/roundup/ipython/issue38.
1377 http://www.scipy.net/roundup/ipython/issue38.
1357
1378
1358 2005-08-14 Fernando Perez <fperez@colorado.edu>
1379 2005-08-14 Fernando Perez <fperez@colorado.edu>
1359
1380
1360 * tools/ipsvnc: Minor improvements, to add changeset info.
1381 * tools/ipsvnc: Minor improvements, to add changeset info.
1361
1382
1362 2005-08-12 Fernando Perez <fperez@colorado.edu>
1383 2005-08-12 Fernando Perez <fperez@colorado.edu>
1363
1384
1364 * IPython/iplib.py (runsource): remove self.code_to_run_src
1385 * IPython/iplib.py (runsource): remove self.code_to_run_src
1365 attribute. I realized this is nothing more than
1386 attribute. I realized this is nothing more than
1366 '\n'.join(self.buffer), and having the same data in two different
1387 '\n'.join(self.buffer), and having the same data in two different
1367 places is just asking for synchronization bugs. This may impact
1388 places is just asking for synchronization bugs. This may impact
1368 people who have custom exception handlers, so I need to warn
1389 people who have custom exception handlers, so I need to warn
1369 ipython-dev about it (F. Mantegazza may use them).
1390 ipython-dev about it (F. Mantegazza may use them).
1370
1391
1371 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1392 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1372
1393
1373 * IPython/genutils.py: fix 2.2 compatibility (generators)
1394 * IPython/genutils.py: fix 2.2 compatibility (generators)
1374
1395
1375 2005-07-18 Fernando Perez <fperez@colorado.edu>
1396 2005-07-18 Fernando Perez <fperez@colorado.edu>
1376
1397
1377 * IPython/genutils.py (get_home_dir): fix to help users with
1398 * IPython/genutils.py (get_home_dir): fix to help users with
1378 invalid $HOME under win32.
1399 invalid $HOME under win32.
1379
1400
1380 2005-07-17 Fernando Perez <fperez@colorado.edu>
1401 2005-07-17 Fernando Perez <fperez@colorado.edu>
1381
1402
1382 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1403 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1383 some old hacks and clean up a bit other routines; code should be
1404 some old hacks and clean up a bit other routines; code should be
1384 simpler and a bit faster.
1405 simpler and a bit faster.
1385
1406
1386 * IPython/iplib.py (interact): removed some last-resort attempts
1407 * IPython/iplib.py (interact): removed some last-resort attempts
1387 to survive broken stdout/stderr. That code was only making it
1408 to survive broken stdout/stderr. That code was only making it
1388 harder to abstract out the i/o (necessary for gui integration),
1409 harder to abstract out the i/o (necessary for gui integration),
1389 and the crashes it could prevent were extremely rare in practice
1410 and the crashes it could prevent were extremely rare in practice
1390 (besides being fully user-induced in a pretty violent manner).
1411 (besides being fully user-induced in a pretty violent manner).
1391
1412
1392 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1413 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1393 Nothing major yet, but the code is simpler to read; this should
1414 Nothing major yet, but the code is simpler to read; this should
1394 make it easier to do more serious modifications in the future.
1415 make it easier to do more serious modifications in the future.
1395
1416
1396 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1417 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1397 which broke in .15 (thanks to a report by Ville).
1418 which broke in .15 (thanks to a report by Ville).
1398
1419
1399 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1420 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1400 be quite correct, I know next to nothing about unicode). This
1421 be quite correct, I know next to nothing about unicode). This
1401 will allow unicode strings to be used in prompts, amongst other
1422 will allow unicode strings to be used in prompts, amongst other
1402 cases. It also will prevent ipython from crashing when unicode
1423 cases. It also will prevent ipython from crashing when unicode
1403 shows up unexpectedly in many places. If ascii encoding fails, we
1424 shows up unexpectedly in many places. If ascii encoding fails, we
1404 assume utf_8. Currently the encoding is not a user-visible
1425 assume utf_8. Currently the encoding is not a user-visible
1405 setting, though it could be made so if there is demand for it.
1426 setting, though it could be made so if there is demand for it.
1406
1427
1407 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1428 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1408
1429
1409 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1430 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1410
1431
1411 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1432 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1412
1433
1413 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1434 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1414 code can work transparently for 2.2/2.3.
1435 code can work transparently for 2.2/2.3.
1415
1436
1416 2005-07-16 Fernando Perez <fperez@colorado.edu>
1437 2005-07-16 Fernando Perez <fperez@colorado.edu>
1417
1438
1418 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1439 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1419 out of the color scheme table used for coloring exception
1440 out of the color scheme table used for coloring exception
1420 tracebacks. This allows user code to add new schemes at runtime.
1441 tracebacks. This allows user code to add new schemes at runtime.
1421 This is a minimally modified version of the patch at
1442 This is a minimally modified version of the patch at
1422 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1443 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1423 for the contribution.
1444 for the contribution.
1424
1445
1425 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1446 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1426 slightly modified version of the patch in
1447 slightly modified version of the patch in
1427 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1448 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1428 to remove the previous try/except solution (which was costlier).
1449 to remove the previous try/except solution (which was costlier).
1429 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1450 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1430
1451
1431 2005-06-08 Fernando Perez <fperez@colorado.edu>
1452 2005-06-08 Fernando Perez <fperez@colorado.edu>
1432
1453
1433 * IPython/iplib.py (write/write_err): Add methods to abstract all
1454 * IPython/iplib.py (write/write_err): Add methods to abstract all
1434 I/O a bit more.
1455 I/O a bit more.
1435
1456
1436 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1457 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1437 warning, reported by Aric Hagberg, fix by JD Hunter.
1458 warning, reported by Aric Hagberg, fix by JD Hunter.
1438
1459
1439 2005-06-02 *** Released version 0.6.15
1460 2005-06-02 *** Released version 0.6.15
1440
1461
1441 2005-06-01 Fernando Perez <fperez@colorado.edu>
1462 2005-06-01 Fernando Perez <fperez@colorado.edu>
1442
1463
1443 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1464 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1444 tab-completion of filenames within open-quoted strings. Note that
1465 tab-completion of filenames within open-quoted strings. Note that
1445 this requires that in ~/.ipython/ipythonrc, users change the
1466 this requires that in ~/.ipython/ipythonrc, users change the
1446 readline delimiters configuration to read:
1467 readline delimiters configuration to read:
1447
1468
1448 readline_remove_delims -/~
1469 readline_remove_delims -/~
1449
1470
1450
1471
1451 2005-05-31 *** Released version 0.6.14
1472 2005-05-31 *** Released version 0.6.14
1452
1473
1453 2005-05-29 Fernando Perez <fperez@colorado.edu>
1474 2005-05-29 Fernando Perez <fperez@colorado.edu>
1454
1475
1455 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1476 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1456 with files not on the filesystem. Reported by Eliyahu Sandler
1477 with files not on the filesystem. Reported by Eliyahu Sandler
1457 <eli@gondolin.net>
1478 <eli@gondolin.net>
1458
1479
1459 2005-05-22 Fernando Perez <fperez@colorado.edu>
1480 2005-05-22 Fernando Perez <fperez@colorado.edu>
1460
1481
1461 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1482 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1462 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1483 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1463
1484
1464 2005-05-19 Fernando Perez <fperez@colorado.edu>
1485 2005-05-19 Fernando Perez <fperez@colorado.edu>
1465
1486
1466 * IPython/iplib.py (safe_execfile): close a file which could be
1487 * IPython/iplib.py (safe_execfile): close a file which could be
1467 left open (causing problems in win32, which locks open files).
1488 left open (causing problems in win32, which locks open files).
1468 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1489 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1469
1490
1470 2005-05-18 Fernando Perez <fperez@colorado.edu>
1491 2005-05-18 Fernando Perez <fperez@colorado.edu>
1471
1492
1472 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1493 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1473 keyword arguments correctly to safe_execfile().
1494 keyword arguments correctly to safe_execfile().
1474
1495
1475 2005-05-13 Fernando Perez <fperez@colorado.edu>
1496 2005-05-13 Fernando Perez <fperez@colorado.edu>
1476
1497
1477 * ipython.1: Added info about Qt to manpage, and threads warning
1498 * ipython.1: Added info about Qt to manpage, and threads warning
1478 to usage page (invoked with --help).
1499 to usage page (invoked with --help).
1479
1500
1480 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1501 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1481 new matcher (it goes at the end of the priority list) to do
1502 new matcher (it goes at the end of the priority list) to do
1482 tab-completion on named function arguments. Submitted by George
1503 tab-completion on named function arguments. Submitted by George
1483 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1504 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1484 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1505 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1485 for more details.
1506 for more details.
1486
1507
1487 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1508 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1488 SystemExit exceptions in the script being run. Thanks to a report
1509 SystemExit exceptions in the script being run. Thanks to a report
1489 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1510 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1490 producing very annoying behavior when running unit tests.
1511 producing very annoying behavior when running unit tests.
1491
1512
1492 2005-05-12 Fernando Perez <fperez@colorado.edu>
1513 2005-05-12 Fernando Perez <fperez@colorado.edu>
1493
1514
1494 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1515 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1495 which I'd broken (again) due to a changed regexp. In the process,
1516 which I'd broken (again) due to a changed regexp. In the process,
1496 added ';' as an escape to auto-quote the whole line without
1517 added ';' as an escape to auto-quote the whole line without
1497 splitting its arguments. Thanks to a report by Jerry McRae
1518 splitting its arguments. Thanks to a report by Jerry McRae
1498 <qrs0xyc02-AT-sneakemail.com>.
1519 <qrs0xyc02-AT-sneakemail.com>.
1499
1520
1500 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1521 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1501 possible crashes caused by a TokenError. Reported by Ed Schofield
1522 possible crashes caused by a TokenError. Reported by Ed Schofield
1502 <schofield-AT-ftw.at>.
1523 <schofield-AT-ftw.at>.
1503
1524
1504 2005-05-06 Fernando Perez <fperez@colorado.edu>
1525 2005-05-06 Fernando Perez <fperez@colorado.edu>
1505
1526
1506 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1527 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1507
1528
1508 2005-04-29 Fernando Perez <fperez@colorado.edu>
1529 2005-04-29 Fernando Perez <fperez@colorado.edu>
1509
1530
1510 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1531 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1511 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1532 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1512 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1533 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1513 which provides support for Qt interactive usage (similar to the
1534 which provides support for Qt interactive usage (similar to the
1514 existing one for WX and GTK). This had been often requested.
1535 existing one for WX and GTK). This had been often requested.
1515
1536
1516 2005-04-14 *** Released version 0.6.13
1537 2005-04-14 *** Released version 0.6.13
1517
1538
1518 2005-04-08 Fernando Perez <fperez@colorado.edu>
1539 2005-04-08 Fernando Perez <fperez@colorado.edu>
1519
1540
1520 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1541 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1521 from _ofind, which gets called on almost every input line. Now,
1542 from _ofind, which gets called on almost every input line. Now,
1522 we only try to get docstrings if they are actually going to be
1543 we only try to get docstrings if they are actually going to be
1523 used (the overhead of fetching unnecessary docstrings can be
1544 used (the overhead of fetching unnecessary docstrings can be
1524 noticeable for certain objects, such as Pyro proxies).
1545 noticeable for certain objects, such as Pyro proxies).
1525
1546
1526 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1547 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1527 for completers. For some reason I had been passing them the state
1548 for completers. For some reason I had been passing them the state
1528 variable, which completers never actually need, and was in
1549 variable, which completers never actually need, and was in
1529 conflict with the rlcompleter API. Custom completers ONLY need to
1550 conflict with the rlcompleter API. Custom completers ONLY need to
1530 take the text parameter.
1551 take the text parameter.
1531
1552
1532 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1553 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1533 work correctly in pysh. I've also moved all the logic which used
1554 work correctly in pysh. I've also moved all the logic which used
1534 to be in pysh.py here, which will prevent problems with future
1555 to be in pysh.py here, which will prevent problems with future
1535 upgrades. However, this time I must warn users to update their
1556 upgrades. However, this time I must warn users to update their
1536 pysh profile to include the line
1557 pysh profile to include the line
1537
1558
1538 import_all IPython.Extensions.InterpreterExec
1559 import_all IPython.Extensions.InterpreterExec
1539
1560
1540 because otherwise things won't work for them. They MUST also
1561 because otherwise things won't work for them. They MUST also
1541 delete pysh.py and the line
1562 delete pysh.py and the line
1542
1563
1543 execfile pysh.py
1564 execfile pysh.py
1544
1565
1545 from their ipythonrc-pysh.
1566 from their ipythonrc-pysh.
1546
1567
1547 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1568 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1548 robust in the face of objects whose dir() returns non-strings
1569 robust in the face of objects whose dir() returns non-strings
1549 (which it shouldn't, but some broken libs like ITK do). Thanks to
1570 (which it shouldn't, but some broken libs like ITK do). Thanks to
1550 a patch by John Hunter (implemented differently, though). Also
1571 a patch by John Hunter (implemented differently, though). Also
1551 minor improvements by using .extend instead of + on lists.
1572 minor improvements by using .extend instead of + on lists.
1552
1573
1553 * pysh.py:
1574 * pysh.py:
1554
1575
1555 2005-04-06 Fernando Perez <fperez@colorado.edu>
1576 2005-04-06 Fernando Perez <fperez@colorado.edu>
1556
1577
1557 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1578 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1558 by default, so that all users benefit from it. Those who don't
1579 by default, so that all users benefit from it. Those who don't
1559 want it can still turn it off.
1580 want it can still turn it off.
1560
1581
1561 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1582 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1562 config file, I'd forgotten about this, so users were getting it
1583 config file, I'd forgotten about this, so users were getting it
1563 off by default.
1584 off by default.
1564
1585
1565 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1586 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1566 consistency. Now magics can be called in multiline statements,
1587 consistency. Now magics can be called in multiline statements,
1567 and python variables can be expanded in magic calls via $var.
1588 and python variables can be expanded in magic calls via $var.
1568 This makes the magic system behave just like aliases or !system
1589 This makes the magic system behave just like aliases or !system
1569 calls.
1590 calls.
1570
1591
1571 2005-03-28 Fernando Perez <fperez@colorado.edu>
1592 2005-03-28 Fernando Perez <fperez@colorado.edu>
1572
1593
1573 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1594 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1574 expensive string additions for building command. Add support for
1595 expensive string additions for building command. Add support for
1575 trailing ';' when autocall is used.
1596 trailing ';' when autocall is used.
1576
1597
1577 2005-03-26 Fernando Perez <fperez@colorado.edu>
1598 2005-03-26 Fernando Perez <fperez@colorado.edu>
1578
1599
1579 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1600 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1580 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1601 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1581 ipython.el robust against prompts with any number of spaces
1602 ipython.el robust against prompts with any number of spaces
1582 (including 0) after the ':' character.
1603 (including 0) after the ':' character.
1583
1604
1584 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1605 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1585 continuation prompt, which misled users to think the line was
1606 continuation prompt, which misled users to think the line was
1586 already indented. Closes debian Bug#300847, reported to me by
1607 already indented. Closes debian Bug#300847, reported to me by
1587 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1608 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1588
1609
1589 2005-03-23 Fernando Perez <fperez@colorado.edu>
1610 2005-03-23 Fernando Perez <fperez@colorado.edu>
1590
1611
1591 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1612 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1592 properly aligned if they have embedded newlines.
1613 properly aligned if they have embedded newlines.
1593
1614
1594 * IPython/iplib.py (runlines): Add a public method to expose
1615 * IPython/iplib.py (runlines): Add a public method to expose
1595 IPython's code execution machinery, so that users can run strings
1616 IPython's code execution machinery, so that users can run strings
1596 as if they had been typed at the prompt interactively.
1617 as if they had been typed at the prompt interactively.
1597 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1618 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1598 methods which can call the system shell, but with python variable
1619 methods which can call the system shell, but with python variable
1599 expansion. The three such methods are: __IPYTHON__.system,
1620 expansion. The three such methods are: __IPYTHON__.system,
1600 .getoutput and .getoutputerror. These need to be documented in a
1621 .getoutput and .getoutputerror. These need to be documented in a
1601 'public API' section (to be written) of the manual.
1622 'public API' section (to be written) of the manual.
1602
1623
1603 2005-03-20 Fernando Perez <fperez@colorado.edu>
1624 2005-03-20 Fernando Perez <fperez@colorado.edu>
1604
1625
1605 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1626 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1606 for custom exception handling. This is quite powerful, and it
1627 for custom exception handling. This is quite powerful, and it
1607 allows for user-installable exception handlers which can trap
1628 allows for user-installable exception handlers which can trap
1608 custom exceptions at runtime and treat them separately from
1629 custom exceptions at runtime and treat them separately from
1609 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1630 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1610 Mantegazza <mantegazza-AT-ill.fr>.
1631 Mantegazza <mantegazza-AT-ill.fr>.
1611 (InteractiveShell.set_custom_completer): public API function to
1632 (InteractiveShell.set_custom_completer): public API function to
1612 add new completers at runtime.
1633 add new completers at runtime.
1613
1634
1614 2005-03-19 Fernando Perez <fperez@colorado.edu>
1635 2005-03-19 Fernando Perez <fperez@colorado.edu>
1615
1636
1616 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1637 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1617 allow objects which provide their docstrings via non-standard
1638 allow objects which provide their docstrings via non-standard
1618 mechanisms (like Pyro proxies) to still be inspected by ipython's
1639 mechanisms (like Pyro proxies) to still be inspected by ipython's
1619 ? system.
1640 ? system.
1620
1641
1621 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1642 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1622 automatic capture system. I tried quite hard to make it work
1643 automatic capture system. I tried quite hard to make it work
1623 reliably, and simply failed. I tried many combinations with the
1644 reliably, and simply failed. I tried many combinations with the
1624 subprocess module, but eventually nothing worked in all needed
1645 subprocess module, but eventually nothing worked in all needed
1625 cases (not blocking stdin for the child, duplicating stdout
1646 cases (not blocking stdin for the child, duplicating stdout
1626 without blocking, etc). The new %sc/%sx still do capture to these
1647 without blocking, etc). The new %sc/%sx still do capture to these
1627 magical list/string objects which make shell use much more
1648 magical list/string objects which make shell use much more
1628 conveninent, so not all is lost.
1649 conveninent, so not all is lost.
1629
1650
1630 XXX - FIX MANUAL for the change above!
1651 XXX - FIX MANUAL for the change above!
1631
1652
1632 (runsource): I copied code.py's runsource() into ipython to modify
1653 (runsource): I copied code.py's runsource() into ipython to modify
1633 it a bit. Now the code object and source to be executed are
1654 it a bit. Now the code object and source to be executed are
1634 stored in ipython. This makes this info accessible to third-party
1655 stored in ipython. This makes this info accessible to third-party
1635 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1656 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1636 Mantegazza <mantegazza-AT-ill.fr>.
1657 Mantegazza <mantegazza-AT-ill.fr>.
1637
1658
1638 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1659 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1639 history-search via readline (like C-p/C-n). I'd wanted this for a
1660 history-search via readline (like C-p/C-n). I'd wanted this for a
1640 long time, but only recently found out how to do it. For users
1661 long time, but only recently found out how to do it. For users
1641 who already have their ipythonrc files made and want this, just
1662 who already have their ipythonrc files made and want this, just
1642 add:
1663 add:
1643
1664
1644 readline_parse_and_bind "\e[A": history-search-backward
1665 readline_parse_and_bind "\e[A": history-search-backward
1645 readline_parse_and_bind "\e[B": history-search-forward
1666 readline_parse_and_bind "\e[B": history-search-forward
1646
1667
1647 2005-03-18 Fernando Perez <fperez@colorado.edu>
1668 2005-03-18 Fernando Perez <fperez@colorado.edu>
1648
1669
1649 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1670 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1650 LSString and SList classes which allow transparent conversions
1671 LSString and SList classes which allow transparent conversions
1651 between list mode and whitespace-separated string.
1672 between list mode and whitespace-separated string.
1652 (magic_r): Fix recursion problem in %r.
1673 (magic_r): Fix recursion problem in %r.
1653
1674
1654 * IPython/genutils.py (LSString): New class to be used for
1675 * IPython/genutils.py (LSString): New class to be used for
1655 automatic storage of the results of all alias/system calls in _o
1676 automatic storage of the results of all alias/system calls in _o
1656 and _e (stdout/err). These provide a .l/.list attribute which
1677 and _e (stdout/err). These provide a .l/.list attribute which
1657 does automatic splitting on newlines. This means that for most
1678 does automatic splitting on newlines. This means that for most
1658 uses, you'll never need to do capturing of output with %sc/%sx
1679 uses, you'll never need to do capturing of output with %sc/%sx
1659 anymore, since ipython keeps this always done for you. Note that
1680 anymore, since ipython keeps this always done for you. Note that
1660 only the LAST results are stored, the _o/e variables are
1681 only the LAST results are stored, the _o/e variables are
1661 overwritten on each call. If you need to save their contents
1682 overwritten on each call. If you need to save their contents
1662 further, simply bind them to any other name.
1683 further, simply bind them to any other name.
1663
1684
1664 2005-03-17 Fernando Perez <fperez@colorado.edu>
1685 2005-03-17 Fernando Perez <fperez@colorado.edu>
1665
1686
1666 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1687 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1667 prompt namespace handling.
1688 prompt namespace handling.
1668
1689
1669 2005-03-16 Fernando Perez <fperez@colorado.edu>
1690 2005-03-16 Fernando Perez <fperez@colorado.edu>
1670
1691
1671 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1692 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1672 classic prompts to be '>>> ' (final space was missing, and it
1693 classic prompts to be '>>> ' (final space was missing, and it
1673 trips the emacs python mode).
1694 trips the emacs python mode).
1674 (BasePrompt.__str__): Added safe support for dynamic prompt
1695 (BasePrompt.__str__): Added safe support for dynamic prompt
1675 strings. Now you can set your prompt string to be '$x', and the
1696 strings. Now you can set your prompt string to be '$x', and the
1676 value of x will be printed from your interactive namespace. The
1697 value of x will be printed from your interactive namespace. The
1677 interpolation syntax includes the full Itpl support, so
1698 interpolation syntax includes the full Itpl support, so
1678 ${foo()+x+bar()} is a valid prompt string now, and the function
1699 ${foo()+x+bar()} is a valid prompt string now, and the function
1679 calls will be made at runtime.
1700 calls will be made at runtime.
1680
1701
1681 2005-03-15 Fernando Perez <fperez@colorado.edu>
1702 2005-03-15 Fernando Perez <fperez@colorado.edu>
1682
1703
1683 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1704 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1684 avoid name clashes in pylab. %hist still works, it just forwards
1705 avoid name clashes in pylab. %hist still works, it just forwards
1685 the call to %history.
1706 the call to %history.
1686
1707
1687 2005-03-02 *** Released version 0.6.12
1708 2005-03-02 *** Released version 0.6.12
1688
1709
1689 2005-03-02 Fernando Perez <fperez@colorado.edu>
1710 2005-03-02 Fernando Perez <fperez@colorado.edu>
1690
1711
1691 * IPython/iplib.py (handle_magic): log magic calls properly as
1712 * IPython/iplib.py (handle_magic): log magic calls properly as
1692 ipmagic() function calls.
1713 ipmagic() function calls.
1693
1714
1694 * IPython/Magic.py (magic_time): Improved %time to support
1715 * IPython/Magic.py (magic_time): Improved %time to support
1695 statements and provide wall-clock as well as CPU time.
1716 statements and provide wall-clock as well as CPU time.
1696
1717
1697 2005-02-27 Fernando Perez <fperez@colorado.edu>
1718 2005-02-27 Fernando Perez <fperez@colorado.edu>
1698
1719
1699 * IPython/hooks.py: New hooks module, to expose user-modifiable
1720 * IPython/hooks.py: New hooks module, to expose user-modifiable
1700 IPython functionality in a clean manner. For now only the editor
1721 IPython functionality in a clean manner. For now only the editor
1701 hook is actually written, and other thigns which I intend to turn
1722 hook is actually written, and other thigns which I intend to turn
1702 into proper hooks aren't yet there. The display and prefilter
1723 into proper hooks aren't yet there. The display and prefilter
1703 stuff, for example, should be hooks. But at least now the
1724 stuff, for example, should be hooks. But at least now the
1704 framework is in place, and the rest can be moved here with more
1725 framework is in place, and the rest can be moved here with more
1705 time later. IPython had had a .hooks variable for a long time for
1726 time later. IPython had had a .hooks variable for a long time for
1706 this purpose, but I'd never actually used it for anything.
1727 this purpose, but I'd never actually used it for anything.
1707
1728
1708 2005-02-26 Fernando Perez <fperez@colorado.edu>
1729 2005-02-26 Fernando Perez <fperez@colorado.edu>
1709
1730
1710 * IPython/ipmaker.py (make_IPython): make the default ipython
1731 * IPython/ipmaker.py (make_IPython): make the default ipython
1711 directory be called _ipython under win32, to follow more the
1732 directory be called _ipython under win32, to follow more the
1712 naming peculiarities of that platform (where buggy software like
1733 naming peculiarities of that platform (where buggy software like
1713 Visual Sourcesafe breaks with .named directories). Reported by
1734 Visual Sourcesafe breaks with .named directories). Reported by
1714 Ville Vainio.
1735 Ville Vainio.
1715
1736
1716 2005-02-23 Fernando Perez <fperez@colorado.edu>
1737 2005-02-23 Fernando Perez <fperez@colorado.edu>
1717
1738
1718 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1739 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1719 auto_aliases for win32 which were causing problems. Users can
1740 auto_aliases for win32 which were causing problems. Users can
1720 define the ones they personally like.
1741 define the ones they personally like.
1721
1742
1722 2005-02-21 Fernando Perez <fperez@colorado.edu>
1743 2005-02-21 Fernando Perez <fperez@colorado.edu>
1723
1744
1724 * IPython/Magic.py (magic_time): new magic to time execution of
1745 * IPython/Magic.py (magic_time): new magic to time execution of
1725 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1746 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1726
1747
1727 2005-02-19 Fernando Perez <fperez@colorado.edu>
1748 2005-02-19 Fernando Perez <fperez@colorado.edu>
1728
1749
1729 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1750 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1730 into keys (for prompts, for example).
1751 into keys (for prompts, for example).
1731
1752
1732 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1753 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1733 prompts in case users want them. This introduces a small behavior
1754 prompts in case users want them. This introduces a small behavior
1734 change: ipython does not automatically add a space to all prompts
1755 change: ipython does not automatically add a space to all prompts
1735 anymore. To get the old prompts with a space, users should add it
1756 anymore. To get the old prompts with a space, users should add it
1736 manually to their ipythonrc file, so for example prompt_in1 should
1757 manually to their ipythonrc file, so for example prompt_in1 should
1737 now read 'In [\#]: ' instead of 'In [\#]:'.
1758 now read 'In [\#]: ' instead of 'In [\#]:'.
1738 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1759 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1739 file) to control left-padding of secondary prompts.
1760 file) to control left-padding of secondary prompts.
1740
1761
1741 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1762 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1742 the profiler can't be imported. Fix for Debian, which removed
1763 the profiler can't be imported. Fix for Debian, which removed
1743 profile.py because of License issues. I applied a slightly
1764 profile.py because of License issues. I applied a slightly
1744 modified version of the original Debian patch at
1765 modified version of the original Debian patch at
1745 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1766 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1746
1767
1747 2005-02-17 Fernando Perez <fperez@colorado.edu>
1768 2005-02-17 Fernando Perez <fperez@colorado.edu>
1748
1769
1749 * IPython/genutils.py (native_line_ends): Fix bug which would
1770 * IPython/genutils.py (native_line_ends): Fix bug which would
1750 cause improper line-ends under win32 b/c I was not opening files
1771 cause improper line-ends under win32 b/c I was not opening files
1751 in binary mode. Bug report and fix thanks to Ville.
1772 in binary mode. Bug report and fix thanks to Ville.
1752
1773
1753 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1774 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1754 trying to catch spurious foo[1] autocalls. My fix actually broke
1775 trying to catch spurious foo[1] autocalls. My fix actually broke
1755 ',/' autoquote/call with explicit escape (bad regexp).
1776 ',/' autoquote/call with explicit escape (bad regexp).
1756
1777
1757 2005-02-15 *** Released version 0.6.11
1778 2005-02-15 *** Released version 0.6.11
1758
1779
1759 2005-02-14 Fernando Perez <fperez@colorado.edu>
1780 2005-02-14 Fernando Perez <fperez@colorado.edu>
1760
1781
1761 * IPython/background_jobs.py: New background job management
1782 * IPython/background_jobs.py: New background job management
1762 subsystem. This is implemented via a new set of classes, and
1783 subsystem. This is implemented via a new set of classes, and
1763 IPython now provides a builtin 'jobs' object for background job
1784 IPython now provides a builtin 'jobs' object for background job
1764 execution. A convenience %bg magic serves as a lightweight
1785 execution. A convenience %bg magic serves as a lightweight
1765 frontend for starting the more common type of calls. This was
1786 frontend for starting the more common type of calls. This was
1766 inspired by discussions with B. Granger and the BackgroundCommand
1787 inspired by discussions with B. Granger and the BackgroundCommand
1767 class described in the book Python Scripting for Computational
1788 class described in the book Python Scripting for Computational
1768 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1789 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1769 (although ultimately no code from this text was used, as IPython's
1790 (although ultimately no code from this text was used, as IPython's
1770 system is a separate implementation).
1791 system is a separate implementation).
1771
1792
1772 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1793 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1773 to control the completion of single/double underscore names
1794 to control the completion of single/double underscore names
1774 separately. As documented in the example ipytonrc file, the
1795 separately. As documented in the example ipytonrc file, the
1775 readline_omit__names variable can now be set to 2, to omit even
1796 readline_omit__names variable can now be set to 2, to omit even
1776 single underscore names. Thanks to a patch by Brian Wong
1797 single underscore names. Thanks to a patch by Brian Wong
1777 <BrianWong-AT-AirgoNetworks.Com>.
1798 <BrianWong-AT-AirgoNetworks.Com>.
1778 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1799 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1779 be autocalled as foo([1]) if foo were callable. A problem for
1800 be autocalled as foo([1]) if foo were callable. A problem for
1780 things which are both callable and implement __getitem__.
1801 things which are both callable and implement __getitem__.
1781 (init_readline): Fix autoindentation for win32. Thanks to a patch
1802 (init_readline): Fix autoindentation for win32. Thanks to a patch
1782 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1803 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1783
1804
1784 2005-02-12 Fernando Perez <fperez@colorado.edu>
1805 2005-02-12 Fernando Perez <fperez@colorado.edu>
1785
1806
1786 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1807 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1787 which I had written long ago to sort out user error messages which
1808 which I had written long ago to sort out user error messages which
1788 may occur during startup. This seemed like a good idea initially,
1809 may occur during startup. This seemed like a good idea initially,
1789 but it has proven a disaster in retrospect. I don't want to
1810 but it has proven a disaster in retrospect. I don't want to
1790 change much code for now, so my fix is to set the internal 'debug'
1811 change much code for now, so my fix is to set the internal 'debug'
1791 flag to true everywhere, whose only job was precisely to control
1812 flag to true everywhere, whose only job was precisely to control
1792 this subsystem. This closes issue 28 (as well as avoiding all
1813 this subsystem. This closes issue 28 (as well as avoiding all
1793 sorts of strange hangups which occur from time to time).
1814 sorts of strange hangups which occur from time to time).
1794
1815
1795 2005-02-07 Fernando Perez <fperez@colorado.edu>
1816 2005-02-07 Fernando Perez <fperez@colorado.edu>
1796
1817
1797 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1818 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1798 previous call produced a syntax error.
1819 previous call produced a syntax error.
1799
1820
1800 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1821 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1801 classes without constructor.
1822 classes without constructor.
1802
1823
1803 2005-02-06 Fernando Perez <fperez@colorado.edu>
1824 2005-02-06 Fernando Perez <fperez@colorado.edu>
1804
1825
1805 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1826 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1806 completions with the results of each matcher, so we return results
1827 completions with the results of each matcher, so we return results
1807 to the user from all namespaces. This breaks with ipython
1828 to the user from all namespaces. This breaks with ipython
1808 tradition, but I think it's a nicer behavior. Now you get all
1829 tradition, but I think it's a nicer behavior. Now you get all
1809 possible completions listed, from all possible namespaces (python,
1830 possible completions listed, from all possible namespaces (python,
1810 filesystem, magics...) After a request by John Hunter
1831 filesystem, magics...) After a request by John Hunter
1811 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1832 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1812
1833
1813 2005-02-05 Fernando Perez <fperez@colorado.edu>
1834 2005-02-05 Fernando Perez <fperez@colorado.edu>
1814
1835
1815 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1836 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1816 the call had quote characters in it (the quotes were stripped).
1837 the call had quote characters in it (the quotes were stripped).
1817
1838
1818 2005-01-31 Fernando Perez <fperez@colorado.edu>
1839 2005-01-31 Fernando Perez <fperez@colorado.edu>
1819
1840
1820 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1841 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1821 Itpl.itpl() to make the code more robust against psyco
1842 Itpl.itpl() to make the code more robust against psyco
1822 optimizations.
1843 optimizations.
1823
1844
1824 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1845 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1825 of causing an exception. Quicker, cleaner.
1846 of causing an exception. Quicker, cleaner.
1826
1847
1827 2005-01-28 Fernando Perez <fperez@colorado.edu>
1848 2005-01-28 Fernando Perez <fperez@colorado.edu>
1828
1849
1829 * scripts/ipython_win_post_install.py (install): hardcode
1850 * scripts/ipython_win_post_install.py (install): hardcode
1830 sys.prefix+'python.exe' as the executable path. It turns out that
1851 sys.prefix+'python.exe' as the executable path. It turns out that
1831 during the post-installation run, sys.executable resolves to the
1852 during the post-installation run, sys.executable resolves to the
1832 name of the binary installer! I should report this as a distutils
1853 name of the binary installer! I should report this as a distutils
1833 bug, I think. I updated the .10 release with this tiny fix, to
1854 bug, I think. I updated the .10 release with this tiny fix, to
1834 avoid annoying the lists further.
1855 avoid annoying the lists further.
1835
1856
1836 2005-01-27 *** Released version 0.6.10
1857 2005-01-27 *** Released version 0.6.10
1837
1858
1838 2005-01-27 Fernando Perez <fperez@colorado.edu>
1859 2005-01-27 Fernando Perez <fperez@colorado.edu>
1839
1860
1840 * IPython/numutils.py (norm): Added 'inf' as optional name for
1861 * IPython/numutils.py (norm): Added 'inf' as optional name for
1841 L-infinity norm, included references to mathworld.com for vector
1862 L-infinity norm, included references to mathworld.com for vector
1842 norm definitions.
1863 norm definitions.
1843 (amin/amax): added amin/amax for array min/max. Similar to what
1864 (amin/amax): added amin/amax for array min/max. Similar to what
1844 pylab ships with after the recent reorganization of names.
1865 pylab ships with after the recent reorganization of names.
1845 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1866 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1846
1867
1847 * ipython.el: committed Alex's recent fixes and improvements.
1868 * ipython.el: committed Alex's recent fixes and improvements.
1848 Tested with python-mode from CVS, and it looks excellent. Since
1869 Tested with python-mode from CVS, and it looks excellent. Since
1849 python-mode hasn't released anything in a while, I'm temporarily
1870 python-mode hasn't released anything in a while, I'm temporarily
1850 putting a copy of today's CVS (v 4.70) of python-mode in:
1871 putting a copy of today's CVS (v 4.70) of python-mode in:
1851 http://ipython.scipy.org/tmp/python-mode.el
1872 http://ipython.scipy.org/tmp/python-mode.el
1852
1873
1853 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1874 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1854 sys.executable for the executable name, instead of assuming it's
1875 sys.executable for the executable name, instead of assuming it's
1855 called 'python.exe' (the post-installer would have produced broken
1876 called 'python.exe' (the post-installer would have produced broken
1856 setups on systems with a differently named python binary).
1877 setups on systems with a differently named python binary).
1857
1878
1858 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1879 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1859 references to os.linesep, to make the code more
1880 references to os.linesep, to make the code more
1860 platform-independent. This is also part of the win32 coloring
1881 platform-independent. This is also part of the win32 coloring
1861 fixes.
1882 fixes.
1862
1883
1863 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1884 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1864 lines, which actually cause coloring bugs because the length of
1885 lines, which actually cause coloring bugs because the length of
1865 the line is very difficult to correctly compute with embedded
1886 the line is very difficult to correctly compute with embedded
1866 escapes. This was the source of all the coloring problems under
1887 escapes. This was the source of all the coloring problems under
1867 Win32. I think that _finally_, Win32 users have a properly
1888 Win32. I think that _finally_, Win32 users have a properly
1868 working ipython in all respects. This would never have happened
1889 working ipython in all respects. This would never have happened
1869 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1890 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1870
1891
1871 2005-01-26 *** Released version 0.6.9
1892 2005-01-26 *** Released version 0.6.9
1872
1893
1873 2005-01-25 Fernando Perez <fperez@colorado.edu>
1894 2005-01-25 Fernando Perez <fperez@colorado.edu>
1874
1895
1875 * setup.py: finally, we have a true Windows installer, thanks to
1896 * setup.py: finally, we have a true Windows installer, thanks to
1876 the excellent work of Viktor Ransmayr
1897 the excellent work of Viktor Ransmayr
1877 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1898 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1878 Windows users. The setup routine is quite a bit cleaner thanks to
1899 Windows users. The setup routine is quite a bit cleaner thanks to
1879 this, and the post-install script uses the proper functions to
1900 this, and the post-install script uses the proper functions to
1880 allow a clean de-installation using the standard Windows Control
1901 allow a clean de-installation using the standard Windows Control
1881 Panel.
1902 Panel.
1882
1903
1883 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1904 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1884 environment variable under all OSes (including win32) if
1905 environment variable under all OSes (including win32) if
1885 available. This will give consistency to win32 users who have set
1906 available. This will give consistency to win32 users who have set
1886 this variable for any reason. If os.environ['HOME'] fails, the
1907 this variable for any reason. If os.environ['HOME'] fails, the
1887 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1908 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1888
1909
1889 2005-01-24 Fernando Perez <fperez@colorado.edu>
1910 2005-01-24 Fernando Perez <fperez@colorado.edu>
1890
1911
1891 * IPython/numutils.py (empty_like): add empty_like(), similar to
1912 * IPython/numutils.py (empty_like): add empty_like(), similar to
1892 zeros_like() but taking advantage of the new empty() Numeric routine.
1913 zeros_like() but taking advantage of the new empty() Numeric routine.
1893
1914
1894 2005-01-23 *** Released version 0.6.8
1915 2005-01-23 *** Released version 0.6.8
1895
1916
1896 2005-01-22 Fernando Perez <fperez@colorado.edu>
1917 2005-01-22 Fernando Perez <fperez@colorado.edu>
1897
1918
1898 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1919 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1899 automatic show() calls. After discussing things with JDH, it
1920 automatic show() calls. After discussing things with JDH, it
1900 turns out there are too many corner cases where this can go wrong.
1921 turns out there are too many corner cases where this can go wrong.
1901 It's best not to try to be 'too smart', and simply have ipython
1922 It's best not to try to be 'too smart', and simply have ipython
1902 reproduce as much as possible the default behavior of a normal
1923 reproduce as much as possible the default behavior of a normal
1903 python shell.
1924 python shell.
1904
1925
1905 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1926 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1906 line-splitting regexp and _prefilter() to avoid calling getattr()
1927 line-splitting regexp and _prefilter() to avoid calling getattr()
1907 on assignments. This closes
1928 on assignments. This closes
1908 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1929 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1909 readline uses getattr(), so a simple <TAB> keypress is still
1930 readline uses getattr(), so a simple <TAB> keypress is still
1910 enough to trigger getattr() calls on an object.
1931 enough to trigger getattr() calls on an object.
1911
1932
1912 2005-01-21 Fernando Perez <fperez@colorado.edu>
1933 2005-01-21 Fernando Perez <fperez@colorado.edu>
1913
1934
1914 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1935 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1915 docstring under pylab so it doesn't mask the original.
1936 docstring under pylab so it doesn't mask the original.
1916
1937
1917 2005-01-21 *** Released version 0.6.7
1938 2005-01-21 *** Released version 0.6.7
1918
1939
1919 2005-01-21 Fernando Perez <fperez@colorado.edu>
1940 2005-01-21 Fernando Perez <fperez@colorado.edu>
1920
1941
1921 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1942 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1922 signal handling for win32 users in multithreaded mode.
1943 signal handling for win32 users in multithreaded mode.
1923
1944
1924 2005-01-17 Fernando Perez <fperez@colorado.edu>
1945 2005-01-17 Fernando Perez <fperez@colorado.edu>
1925
1946
1926 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1947 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1927 instances with no __init__. After a crash report by Norbert Nemec
1948 instances with no __init__. After a crash report by Norbert Nemec
1928 <Norbert-AT-nemec-online.de>.
1949 <Norbert-AT-nemec-online.de>.
1929
1950
1930 2005-01-14 Fernando Perez <fperez@colorado.edu>
1951 2005-01-14 Fernando Perez <fperez@colorado.edu>
1931
1952
1932 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1953 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1933 names for verbose exceptions, when multiple dotted names and the
1954 names for verbose exceptions, when multiple dotted names and the
1934 'parent' object were present on the same line.
1955 'parent' object were present on the same line.
1935
1956
1936 2005-01-11 Fernando Perez <fperez@colorado.edu>
1957 2005-01-11 Fernando Perez <fperez@colorado.edu>
1937
1958
1938 * IPython/genutils.py (flag_calls): new utility to trap and flag
1959 * IPython/genutils.py (flag_calls): new utility to trap and flag
1939 calls in functions. I need it to clean up matplotlib support.
1960 calls in functions. I need it to clean up matplotlib support.
1940 Also removed some deprecated code in genutils.
1961 Also removed some deprecated code in genutils.
1941
1962
1942 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1963 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1943 that matplotlib scripts called with %run, which don't call show()
1964 that matplotlib scripts called with %run, which don't call show()
1944 themselves, still have their plotting windows open.
1965 themselves, still have their plotting windows open.
1945
1966
1946 2005-01-05 Fernando Perez <fperez@colorado.edu>
1967 2005-01-05 Fernando Perez <fperez@colorado.edu>
1947
1968
1948 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1969 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1949 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1970 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1950
1971
1951 2004-12-19 Fernando Perez <fperez@colorado.edu>
1972 2004-12-19 Fernando Perez <fperez@colorado.edu>
1952
1973
1953 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1974 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1954 parent_runcode, which was an eyesore. The same result can be
1975 parent_runcode, which was an eyesore. The same result can be
1955 obtained with Python's regular superclass mechanisms.
1976 obtained with Python's regular superclass mechanisms.
1956
1977
1957 2004-12-17 Fernando Perez <fperez@colorado.edu>
1978 2004-12-17 Fernando Perez <fperez@colorado.edu>
1958
1979
1959 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1980 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1960 reported by Prabhu.
1981 reported by Prabhu.
1961 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1982 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1962 sys.stderr) instead of explicitly calling sys.stderr. This helps
1983 sys.stderr) instead of explicitly calling sys.stderr. This helps
1963 maintain our I/O abstractions clean, for future GUI embeddings.
1984 maintain our I/O abstractions clean, for future GUI embeddings.
1964
1985
1965 * IPython/genutils.py (info): added new utility for sys.stderr
1986 * IPython/genutils.py (info): added new utility for sys.stderr
1966 unified info message handling (thin wrapper around warn()).
1987 unified info message handling (thin wrapper around warn()).
1967
1988
1968 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1989 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1969 composite (dotted) names on verbose exceptions.
1990 composite (dotted) names on verbose exceptions.
1970 (VerboseTB.nullrepr): harden against another kind of errors which
1991 (VerboseTB.nullrepr): harden against another kind of errors which
1971 Python's inspect module can trigger, and which were crashing
1992 Python's inspect module can trigger, and which were crashing
1972 IPython. Thanks to a report by Marco Lombardi
1993 IPython. Thanks to a report by Marco Lombardi
1973 <mlombard-AT-ma010192.hq.eso.org>.
1994 <mlombard-AT-ma010192.hq.eso.org>.
1974
1995
1975 2004-12-13 *** Released version 0.6.6
1996 2004-12-13 *** Released version 0.6.6
1976
1997
1977 2004-12-12 Fernando Perez <fperez@colorado.edu>
1998 2004-12-12 Fernando Perez <fperez@colorado.edu>
1978
1999
1979 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2000 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1980 generated by pygtk upon initialization if it was built without
2001 generated by pygtk upon initialization if it was built without
1981 threads (for matplotlib users). After a crash reported by
2002 threads (for matplotlib users). After a crash reported by
1982 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2003 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1983
2004
1984 * IPython/ipmaker.py (make_IPython): fix small bug in the
2005 * IPython/ipmaker.py (make_IPython): fix small bug in the
1985 import_some parameter for multiple imports.
2006 import_some parameter for multiple imports.
1986
2007
1987 * IPython/iplib.py (ipmagic): simplified the interface of
2008 * IPython/iplib.py (ipmagic): simplified the interface of
1988 ipmagic() to take a single string argument, just as it would be
2009 ipmagic() to take a single string argument, just as it would be
1989 typed at the IPython cmd line.
2010 typed at the IPython cmd line.
1990 (ipalias): Added new ipalias() with an interface identical to
2011 (ipalias): Added new ipalias() with an interface identical to
1991 ipmagic(). This completes exposing a pure python interface to the
2012 ipmagic(). This completes exposing a pure python interface to the
1992 alias and magic system, which can be used in loops or more complex
2013 alias and magic system, which can be used in loops or more complex
1993 code where IPython's automatic line mangling is not active.
2014 code where IPython's automatic line mangling is not active.
1994
2015
1995 * IPython/genutils.py (timing): changed interface of timing to
2016 * IPython/genutils.py (timing): changed interface of timing to
1996 simply run code once, which is the most common case. timings()
2017 simply run code once, which is the most common case. timings()
1997 remains unchanged, for the cases where you want multiple runs.
2018 remains unchanged, for the cases where you want multiple runs.
1998
2019
1999 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2020 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2000 bug where Python2.2 crashes with exec'ing code which does not end
2021 bug where Python2.2 crashes with exec'ing code which does not end
2001 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2022 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2002 before.
2023 before.
2003
2024
2004 2004-12-10 Fernando Perez <fperez@colorado.edu>
2025 2004-12-10 Fernando Perez <fperez@colorado.edu>
2005
2026
2006 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2027 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2007 -t to -T, to accomodate the new -t flag in %run (the %run and
2028 -t to -T, to accomodate the new -t flag in %run (the %run and
2008 %prun options are kind of intermixed, and it's not easy to change
2029 %prun options are kind of intermixed, and it's not easy to change
2009 this with the limitations of python's getopt).
2030 this with the limitations of python's getopt).
2010
2031
2011 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2032 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2012 the execution of scripts. It's not as fine-tuned as timeit.py,
2033 the execution of scripts. It's not as fine-tuned as timeit.py,
2013 but it works from inside ipython (and under 2.2, which lacks
2034 but it works from inside ipython (and under 2.2, which lacks
2014 timeit.py). Optionally a number of runs > 1 can be given for
2035 timeit.py). Optionally a number of runs > 1 can be given for
2015 timing very short-running code.
2036 timing very short-running code.
2016
2037
2017 * IPython/genutils.py (uniq_stable): new routine which returns a
2038 * IPython/genutils.py (uniq_stable): new routine which returns a
2018 list of unique elements in any iterable, but in stable order of
2039 list of unique elements in any iterable, but in stable order of
2019 appearance. I needed this for the ultraTB fixes, and it's a handy
2040 appearance. I needed this for the ultraTB fixes, and it's a handy
2020 utility.
2041 utility.
2021
2042
2022 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2043 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2023 dotted names in Verbose exceptions. This had been broken since
2044 dotted names in Verbose exceptions. This had been broken since
2024 the very start, now x.y will properly be printed in a Verbose
2045 the very start, now x.y will properly be printed in a Verbose
2025 traceback, instead of x being shown and y appearing always as an
2046 traceback, instead of x being shown and y appearing always as an
2026 'undefined global'. Getting this to work was a bit tricky,
2047 'undefined global'. Getting this to work was a bit tricky,
2027 because by default python tokenizers are stateless. Saved by
2048 because by default python tokenizers are stateless. Saved by
2028 python's ability to easily add a bit of state to an arbitrary
2049 python's ability to easily add a bit of state to an arbitrary
2029 function (without needing to build a full-blown callable object).
2050 function (without needing to build a full-blown callable object).
2030
2051
2031 Also big cleanup of this code, which had horrendous runtime
2052 Also big cleanup of this code, which had horrendous runtime
2032 lookups of zillions of attributes for colorization. Moved all
2053 lookups of zillions of attributes for colorization. Moved all
2033 this code into a few templates, which make it cleaner and quicker.
2054 this code into a few templates, which make it cleaner and quicker.
2034
2055
2035 Printout quality was also improved for Verbose exceptions: one
2056 Printout quality was also improved for Verbose exceptions: one
2036 variable per line, and memory addresses are printed (this can be
2057 variable per line, and memory addresses are printed (this can be
2037 quite handy in nasty debugging situations, which is what Verbose
2058 quite handy in nasty debugging situations, which is what Verbose
2038 is for).
2059 is for).
2039
2060
2040 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2061 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2041 the command line as scripts to be loaded by embedded instances.
2062 the command line as scripts to be loaded by embedded instances.
2042 Doing so has the potential for an infinite recursion if there are
2063 Doing so has the potential for an infinite recursion if there are
2043 exceptions thrown in the process. This fixes a strange crash
2064 exceptions thrown in the process. This fixes a strange crash
2044 reported by Philippe MULLER <muller-AT-irit.fr>.
2065 reported by Philippe MULLER <muller-AT-irit.fr>.
2045
2066
2046 2004-12-09 Fernando Perez <fperez@colorado.edu>
2067 2004-12-09 Fernando Perez <fperez@colorado.edu>
2047
2068
2048 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2069 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2049 to reflect new names in matplotlib, which now expose the
2070 to reflect new names in matplotlib, which now expose the
2050 matlab-compatible interface via a pylab module instead of the
2071 matlab-compatible interface via a pylab module instead of the
2051 'matlab' name. The new code is backwards compatible, so users of
2072 'matlab' name. The new code is backwards compatible, so users of
2052 all matplotlib versions are OK. Patch by J. Hunter.
2073 all matplotlib versions are OK. Patch by J. Hunter.
2053
2074
2054 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2075 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2055 of __init__ docstrings for instances (class docstrings are already
2076 of __init__ docstrings for instances (class docstrings are already
2056 automatically printed). Instances with customized docstrings
2077 automatically printed). Instances with customized docstrings
2057 (indep. of the class) are also recognized and all 3 separate
2078 (indep. of the class) are also recognized and all 3 separate
2058 docstrings are printed (instance, class, constructor). After some
2079 docstrings are printed (instance, class, constructor). After some
2059 comments/suggestions by J. Hunter.
2080 comments/suggestions by J. Hunter.
2060
2081
2061 2004-12-05 Fernando Perez <fperez@colorado.edu>
2082 2004-12-05 Fernando Perez <fperez@colorado.edu>
2062
2083
2063 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2084 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2064 warnings when tab-completion fails and triggers an exception.
2085 warnings when tab-completion fails and triggers an exception.
2065
2086
2066 2004-12-03 Fernando Perez <fperez@colorado.edu>
2087 2004-12-03 Fernando Perez <fperez@colorado.edu>
2067
2088
2068 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2089 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2069 be triggered when using 'run -p'. An incorrect option flag was
2090 be triggered when using 'run -p'. An incorrect option flag was
2070 being set ('d' instead of 'D').
2091 being set ('d' instead of 'D').
2071 (manpage): fix missing escaped \- sign.
2092 (manpage): fix missing escaped \- sign.
2072
2093
2073 2004-11-30 *** Released version 0.6.5
2094 2004-11-30 *** Released version 0.6.5
2074
2095
2075 2004-11-30 Fernando Perez <fperez@colorado.edu>
2096 2004-11-30 Fernando Perez <fperez@colorado.edu>
2076
2097
2077 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2098 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2078 setting with -d option.
2099 setting with -d option.
2079
2100
2080 * setup.py (docfiles): Fix problem where the doc glob I was using
2101 * setup.py (docfiles): Fix problem where the doc glob I was using
2081 was COMPLETELY BROKEN. It was giving the right files by pure
2102 was COMPLETELY BROKEN. It was giving the right files by pure
2082 accident, but failed once I tried to include ipython.el. Note:
2103 accident, but failed once I tried to include ipython.el. Note:
2083 glob() does NOT allow you to do exclusion on multiple endings!
2104 glob() does NOT allow you to do exclusion on multiple endings!
2084
2105
2085 2004-11-29 Fernando Perez <fperez@colorado.edu>
2106 2004-11-29 Fernando Perez <fperez@colorado.edu>
2086
2107
2087 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2108 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2088 the manpage as the source. Better formatting & consistency.
2109 the manpage as the source. Better formatting & consistency.
2089
2110
2090 * IPython/Magic.py (magic_run): Added new -d option, to run
2111 * IPython/Magic.py (magic_run): Added new -d option, to run
2091 scripts under the control of the python pdb debugger. Note that
2112 scripts under the control of the python pdb debugger. Note that
2092 this required changing the %prun option -d to -D, to avoid a clash
2113 this required changing the %prun option -d to -D, to avoid a clash
2093 (since %run must pass options to %prun, and getopt is too dumb to
2114 (since %run must pass options to %prun, and getopt is too dumb to
2094 handle options with string values with embedded spaces). Thanks
2115 handle options with string values with embedded spaces). Thanks
2095 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2116 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2096 (magic_who_ls): added type matching to %who and %whos, so that one
2117 (magic_who_ls): added type matching to %who and %whos, so that one
2097 can filter their output to only include variables of certain
2118 can filter their output to only include variables of certain
2098 types. Another suggestion by Matthew.
2119 types. Another suggestion by Matthew.
2099 (magic_whos): Added memory summaries in kb and Mb for arrays.
2120 (magic_whos): Added memory summaries in kb and Mb for arrays.
2100 (magic_who): Improve formatting (break lines every 9 vars).
2121 (magic_who): Improve formatting (break lines every 9 vars).
2101
2122
2102 2004-11-28 Fernando Perez <fperez@colorado.edu>
2123 2004-11-28 Fernando Perez <fperez@colorado.edu>
2103
2124
2104 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2125 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2105 cache when empty lines were present.
2126 cache when empty lines were present.
2106
2127
2107 2004-11-24 Fernando Perez <fperez@colorado.edu>
2128 2004-11-24 Fernando Perez <fperez@colorado.edu>
2108
2129
2109 * IPython/usage.py (__doc__): document the re-activated threading
2130 * IPython/usage.py (__doc__): document the re-activated threading
2110 options for WX and GTK.
2131 options for WX and GTK.
2111
2132
2112 2004-11-23 Fernando Perez <fperez@colorado.edu>
2133 2004-11-23 Fernando Perez <fperez@colorado.edu>
2113
2134
2114 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2135 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2115 the -wthread and -gthread options, along with a new -tk one to try
2136 the -wthread and -gthread options, along with a new -tk one to try
2116 and coordinate Tk threading with wx/gtk. The tk support is very
2137 and coordinate Tk threading with wx/gtk. The tk support is very
2117 platform dependent, since it seems to require Tcl and Tk to be
2138 platform dependent, since it seems to require Tcl and Tk to be
2118 built with threads (Fedora1/2 appears NOT to have it, but in
2139 built with threads (Fedora1/2 appears NOT to have it, but in
2119 Prabhu's Debian boxes it works OK). But even with some Tk
2140 Prabhu's Debian boxes it works OK). But even with some Tk
2120 limitations, this is a great improvement.
2141 limitations, this is a great improvement.
2121
2142
2122 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2143 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2123 info in user prompts. Patch by Prabhu.
2144 info in user prompts. Patch by Prabhu.
2124
2145
2125 2004-11-18 Fernando Perez <fperez@colorado.edu>
2146 2004-11-18 Fernando Perez <fperez@colorado.edu>
2126
2147
2127 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2148 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2128 EOFErrors and bail, to avoid infinite loops if a non-terminating
2149 EOFErrors and bail, to avoid infinite loops if a non-terminating
2129 file is fed into ipython. Patch submitted in issue 19 by user,
2150 file is fed into ipython. Patch submitted in issue 19 by user,
2130 many thanks.
2151 many thanks.
2131
2152
2132 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2153 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2133 autoquote/parens in continuation prompts, which can cause lots of
2154 autoquote/parens in continuation prompts, which can cause lots of
2134 problems. Closes roundup issue 20.
2155 problems. Closes roundup issue 20.
2135
2156
2136 2004-11-17 Fernando Perez <fperez@colorado.edu>
2157 2004-11-17 Fernando Perez <fperez@colorado.edu>
2137
2158
2138 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2159 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2139 reported as debian bug #280505. I'm not sure my local changelog
2160 reported as debian bug #280505. I'm not sure my local changelog
2140 entry has the proper debian format (Jack?).
2161 entry has the proper debian format (Jack?).
2141
2162
2142 2004-11-08 *** Released version 0.6.4
2163 2004-11-08 *** Released version 0.6.4
2143
2164
2144 2004-11-08 Fernando Perez <fperez@colorado.edu>
2165 2004-11-08 Fernando Perez <fperez@colorado.edu>
2145
2166
2146 * IPython/iplib.py (init_readline): Fix exit message for Windows
2167 * IPython/iplib.py (init_readline): Fix exit message for Windows
2147 when readline is active. Thanks to a report by Eric Jones
2168 when readline is active. Thanks to a report by Eric Jones
2148 <eric-AT-enthought.com>.
2169 <eric-AT-enthought.com>.
2149
2170
2150 2004-11-07 Fernando Perez <fperez@colorado.edu>
2171 2004-11-07 Fernando Perez <fperez@colorado.edu>
2151
2172
2152 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2173 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2153 sometimes seen by win2k/cygwin users.
2174 sometimes seen by win2k/cygwin users.
2154
2175
2155 2004-11-06 Fernando Perez <fperez@colorado.edu>
2176 2004-11-06 Fernando Perez <fperez@colorado.edu>
2156
2177
2157 * IPython/iplib.py (interact): Change the handling of %Exit from
2178 * IPython/iplib.py (interact): Change the handling of %Exit from
2158 trying to propagate a SystemExit to an internal ipython flag.
2179 trying to propagate a SystemExit to an internal ipython flag.
2159 This is less elegant than using Python's exception mechanism, but
2180 This is less elegant than using Python's exception mechanism, but
2160 I can't get that to work reliably with threads, so under -pylab
2181 I can't get that to work reliably with threads, so under -pylab
2161 %Exit was hanging IPython. Cross-thread exception handling is
2182 %Exit was hanging IPython. Cross-thread exception handling is
2162 really a bitch. Thaks to a bug report by Stephen Walton
2183 really a bitch. Thaks to a bug report by Stephen Walton
2163 <stephen.walton-AT-csun.edu>.
2184 <stephen.walton-AT-csun.edu>.
2164
2185
2165 2004-11-04 Fernando Perez <fperez@colorado.edu>
2186 2004-11-04 Fernando Perez <fperez@colorado.edu>
2166
2187
2167 * IPython/iplib.py (raw_input_original): store a pointer to the
2188 * IPython/iplib.py (raw_input_original): store a pointer to the
2168 true raw_input to harden against code which can modify it
2189 true raw_input to harden against code which can modify it
2169 (wx.py.PyShell does this and would otherwise crash ipython).
2190 (wx.py.PyShell does this and would otherwise crash ipython).
2170 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2191 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2171
2192
2172 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2193 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2173 Ctrl-C problem, which does not mess up the input line.
2194 Ctrl-C problem, which does not mess up the input line.
2174
2195
2175 2004-11-03 Fernando Perez <fperez@colorado.edu>
2196 2004-11-03 Fernando Perez <fperez@colorado.edu>
2176
2197
2177 * IPython/Release.py: Changed licensing to BSD, in all files.
2198 * IPython/Release.py: Changed licensing to BSD, in all files.
2178 (name): lowercase name for tarball/RPM release.
2199 (name): lowercase name for tarball/RPM release.
2179
2200
2180 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2201 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2181 use throughout ipython.
2202 use throughout ipython.
2182
2203
2183 * IPython/Magic.py (Magic._ofind): Switch to using the new
2204 * IPython/Magic.py (Magic._ofind): Switch to using the new
2184 OInspect.getdoc() function.
2205 OInspect.getdoc() function.
2185
2206
2186 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2207 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2187 of the line currently being canceled via Ctrl-C. It's extremely
2208 of the line currently being canceled via Ctrl-C. It's extremely
2188 ugly, but I don't know how to do it better (the problem is one of
2209 ugly, but I don't know how to do it better (the problem is one of
2189 handling cross-thread exceptions).
2210 handling cross-thread exceptions).
2190
2211
2191 2004-10-28 Fernando Perez <fperez@colorado.edu>
2212 2004-10-28 Fernando Perez <fperez@colorado.edu>
2192
2213
2193 * IPython/Shell.py (signal_handler): add signal handlers to trap
2214 * IPython/Shell.py (signal_handler): add signal handlers to trap
2194 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2215 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2195 report by Francesc Alted.
2216 report by Francesc Alted.
2196
2217
2197 2004-10-21 Fernando Perez <fperez@colorado.edu>
2218 2004-10-21 Fernando Perez <fperez@colorado.edu>
2198
2219
2199 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2220 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2200 to % for pysh syntax extensions.
2221 to % for pysh syntax extensions.
2201
2222
2202 2004-10-09 Fernando Perez <fperez@colorado.edu>
2223 2004-10-09 Fernando Perez <fperez@colorado.edu>
2203
2224
2204 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2225 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2205 arrays to print a more useful summary, without calling str(arr).
2226 arrays to print a more useful summary, without calling str(arr).
2206 This avoids the problem of extremely lengthy computations which
2227 This avoids the problem of extremely lengthy computations which
2207 occur if arr is large, and appear to the user as a system lockup
2228 occur if arr is large, and appear to the user as a system lockup
2208 with 100% cpu activity. After a suggestion by Kristian Sandberg
2229 with 100% cpu activity. After a suggestion by Kristian Sandberg
2209 <Kristian.Sandberg@colorado.edu>.
2230 <Kristian.Sandberg@colorado.edu>.
2210 (Magic.__init__): fix bug in global magic escapes not being
2231 (Magic.__init__): fix bug in global magic escapes not being
2211 correctly set.
2232 correctly set.
2212
2233
2213 2004-10-08 Fernando Perez <fperez@colorado.edu>
2234 2004-10-08 Fernando Perez <fperez@colorado.edu>
2214
2235
2215 * IPython/Magic.py (__license__): change to absolute imports of
2236 * IPython/Magic.py (__license__): change to absolute imports of
2216 ipython's own internal packages, to start adapting to the absolute
2237 ipython's own internal packages, to start adapting to the absolute
2217 import requirement of PEP-328.
2238 import requirement of PEP-328.
2218
2239
2219 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2240 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2220 files, and standardize author/license marks through the Release
2241 files, and standardize author/license marks through the Release
2221 module instead of having per/file stuff (except for files with
2242 module instead of having per/file stuff (except for files with
2222 particular licenses, like the MIT/PSF-licensed codes).
2243 particular licenses, like the MIT/PSF-licensed codes).
2223
2244
2224 * IPython/Debugger.py: remove dead code for python 2.1
2245 * IPython/Debugger.py: remove dead code for python 2.1
2225
2246
2226 2004-10-04 Fernando Perez <fperez@colorado.edu>
2247 2004-10-04 Fernando Perez <fperez@colorado.edu>
2227
2248
2228 * IPython/iplib.py (ipmagic): New function for accessing magics
2249 * IPython/iplib.py (ipmagic): New function for accessing magics
2229 via a normal python function call.
2250 via a normal python function call.
2230
2251
2231 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2252 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2232 from '@' to '%', to accomodate the new @decorator syntax of python
2253 from '@' to '%', to accomodate the new @decorator syntax of python
2233 2.4.
2254 2.4.
2234
2255
2235 2004-09-29 Fernando Perez <fperez@colorado.edu>
2256 2004-09-29 Fernando Perez <fperez@colorado.edu>
2236
2257
2237 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2258 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2238 matplotlib.use to prevent running scripts which try to switch
2259 matplotlib.use to prevent running scripts which try to switch
2239 interactive backends from within ipython. This will just crash
2260 interactive backends from within ipython. This will just crash
2240 the python interpreter, so we can't allow it (but a detailed error
2261 the python interpreter, so we can't allow it (but a detailed error
2241 is given to the user).
2262 is given to the user).
2242
2263
2243 2004-09-28 Fernando Perez <fperez@colorado.edu>
2264 2004-09-28 Fernando Perez <fperez@colorado.edu>
2244
2265
2245 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2266 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2246 matplotlib-related fixes so that using @run with non-matplotlib
2267 matplotlib-related fixes so that using @run with non-matplotlib
2247 scripts doesn't pop up spurious plot windows. This requires
2268 scripts doesn't pop up spurious plot windows. This requires
2248 matplotlib >= 0.63, where I had to make some changes as well.
2269 matplotlib >= 0.63, where I had to make some changes as well.
2249
2270
2250 * IPython/ipmaker.py (make_IPython): update version requirement to
2271 * IPython/ipmaker.py (make_IPython): update version requirement to
2251 python 2.2.
2272 python 2.2.
2252
2273
2253 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2274 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2254 banner arg for embedded customization.
2275 banner arg for embedded customization.
2255
2276
2256 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2277 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2257 explicit uses of __IP as the IPython's instance name. Now things
2278 explicit uses of __IP as the IPython's instance name. Now things
2258 are properly handled via the shell.name value. The actual code
2279 are properly handled via the shell.name value. The actual code
2259 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2280 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2260 is much better than before. I'll clean things completely when the
2281 is much better than before. I'll clean things completely when the
2261 magic stuff gets a real overhaul.
2282 magic stuff gets a real overhaul.
2262
2283
2263 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2284 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2264 minor changes to debian dir.
2285 minor changes to debian dir.
2265
2286
2266 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2287 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2267 pointer to the shell itself in the interactive namespace even when
2288 pointer to the shell itself in the interactive namespace even when
2268 a user-supplied dict is provided. This is needed for embedding
2289 a user-supplied dict is provided. This is needed for embedding
2269 purposes (found by tests with Michel Sanner).
2290 purposes (found by tests with Michel Sanner).
2270
2291
2271 2004-09-27 Fernando Perez <fperez@colorado.edu>
2292 2004-09-27 Fernando Perez <fperez@colorado.edu>
2272
2293
2273 * IPython/UserConfig/ipythonrc: remove []{} from
2294 * IPython/UserConfig/ipythonrc: remove []{} from
2274 readline_remove_delims, so that things like [modname.<TAB> do
2295 readline_remove_delims, so that things like [modname.<TAB> do
2275 proper completion. This disables [].TAB, but that's a less common
2296 proper completion. This disables [].TAB, but that's a less common
2276 case than module names in list comprehensions, for example.
2297 case than module names in list comprehensions, for example.
2277 Thanks to a report by Andrea Riciputi.
2298 Thanks to a report by Andrea Riciputi.
2278
2299
2279 2004-09-09 Fernando Perez <fperez@colorado.edu>
2300 2004-09-09 Fernando Perez <fperez@colorado.edu>
2280
2301
2281 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2302 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2282 blocking problems in win32 and osx. Fix by John.
2303 blocking problems in win32 and osx. Fix by John.
2283
2304
2284 2004-09-08 Fernando Perez <fperez@colorado.edu>
2305 2004-09-08 Fernando Perez <fperez@colorado.edu>
2285
2306
2286 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2307 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2287 for Win32 and OSX. Fix by John Hunter.
2308 for Win32 and OSX. Fix by John Hunter.
2288
2309
2289 2004-08-30 *** Released version 0.6.3
2310 2004-08-30 *** Released version 0.6.3
2290
2311
2291 2004-08-30 Fernando Perez <fperez@colorado.edu>
2312 2004-08-30 Fernando Perez <fperez@colorado.edu>
2292
2313
2293 * setup.py (isfile): Add manpages to list of dependent files to be
2314 * setup.py (isfile): Add manpages to list of dependent files to be
2294 updated.
2315 updated.
2295
2316
2296 2004-08-27 Fernando Perez <fperez@colorado.edu>
2317 2004-08-27 Fernando Perez <fperez@colorado.edu>
2297
2318
2298 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2319 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2299 for now. They don't really work with standalone WX/GTK code
2320 for now. They don't really work with standalone WX/GTK code
2300 (though matplotlib IS working fine with both of those backends).
2321 (though matplotlib IS working fine with both of those backends).
2301 This will neeed much more testing. I disabled most things with
2322 This will neeed much more testing. I disabled most things with
2302 comments, so turning it back on later should be pretty easy.
2323 comments, so turning it back on later should be pretty easy.
2303
2324
2304 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2325 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2305 autocalling of expressions like r'foo', by modifying the line
2326 autocalling of expressions like r'foo', by modifying the line
2306 split regexp. Closes
2327 split regexp. Closes
2307 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2328 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2308 Riley <ipythonbugs-AT-sabi.net>.
2329 Riley <ipythonbugs-AT-sabi.net>.
2309 (InteractiveShell.mainloop): honor --nobanner with banner
2330 (InteractiveShell.mainloop): honor --nobanner with banner
2310 extensions.
2331 extensions.
2311
2332
2312 * IPython/Shell.py: Significant refactoring of all classes, so
2333 * IPython/Shell.py: Significant refactoring of all classes, so
2313 that we can really support ALL matplotlib backends and threading
2334 that we can really support ALL matplotlib backends and threading
2314 models (John spotted a bug with Tk which required this). Now we
2335 models (John spotted a bug with Tk which required this). Now we
2315 should support single-threaded, WX-threads and GTK-threads, both
2336 should support single-threaded, WX-threads and GTK-threads, both
2316 for generic code and for matplotlib.
2337 for generic code and for matplotlib.
2317
2338
2318 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2339 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2319 -pylab, to simplify things for users. Will also remove the pylab
2340 -pylab, to simplify things for users. Will also remove the pylab
2320 profile, since now all of matplotlib configuration is directly
2341 profile, since now all of matplotlib configuration is directly
2321 handled here. This also reduces startup time.
2342 handled here. This also reduces startup time.
2322
2343
2323 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2344 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2324 shell wasn't being correctly called. Also in IPShellWX.
2345 shell wasn't being correctly called. Also in IPShellWX.
2325
2346
2326 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2347 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2327 fine-tune banner.
2348 fine-tune banner.
2328
2349
2329 * IPython/numutils.py (spike): Deprecate these spike functions,
2350 * IPython/numutils.py (spike): Deprecate these spike functions,
2330 delete (long deprecated) gnuplot_exec handler.
2351 delete (long deprecated) gnuplot_exec handler.
2331
2352
2332 2004-08-26 Fernando Perez <fperez@colorado.edu>
2353 2004-08-26 Fernando Perez <fperez@colorado.edu>
2333
2354
2334 * ipython.1: Update for threading options, plus some others which
2355 * ipython.1: Update for threading options, plus some others which
2335 were missing.
2356 were missing.
2336
2357
2337 * IPython/ipmaker.py (__call__): Added -wthread option for
2358 * IPython/ipmaker.py (__call__): Added -wthread option for
2338 wxpython thread handling. Make sure threading options are only
2359 wxpython thread handling. Make sure threading options are only
2339 valid at the command line.
2360 valid at the command line.
2340
2361
2341 * scripts/ipython: moved shell selection into a factory function
2362 * scripts/ipython: moved shell selection into a factory function
2342 in Shell.py, to keep the starter script to a minimum.
2363 in Shell.py, to keep the starter script to a minimum.
2343
2364
2344 2004-08-25 Fernando Perez <fperez@colorado.edu>
2365 2004-08-25 Fernando Perez <fperez@colorado.edu>
2345
2366
2346 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2367 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2347 John. Along with some recent changes he made to matplotlib, the
2368 John. Along with some recent changes he made to matplotlib, the
2348 next versions of both systems should work very well together.
2369 next versions of both systems should work very well together.
2349
2370
2350 2004-08-24 Fernando Perez <fperez@colorado.edu>
2371 2004-08-24 Fernando Perez <fperez@colorado.edu>
2351
2372
2352 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2373 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2353 tried to switch the profiling to using hotshot, but I'm getting
2374 tried to switch the profiling to using hotshot, but I'm getting
2354 strange errors from prof.runctx() there. I may be misreading the
2375 strange errors from prof.runctx() there. I may be misreading the
2355 docs, but it looks weird. For now the profiling code will
2376 docs, but it looks weird. For now the profiling code will
2356 continue to use the standard profiler.
2377 continue to use the standard profiler.
2357
2378
2358 2004-08-23 Fernando Perez <fperez@colorado.edu>
2379 2004-08-23 Fernando Perez <fperez@colorado.edu>
2359
2380
2360 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2381 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2361 threaded shell, by John Hunter. It's not quite ready yet, but
2382 threaded shell, by John Hunter. It's not quite ready yet, but
2362 close.
2383 close.
2363
2384
2364 2004-08-22 Fernando Perez <fperez@colorado.edu>
2385 2004-08-22 Fernando Perez <fperez@colorado.edu>
2365
2386
2366 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2387 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2367 in Magic and ultraTB.
2388 in Magic and ultraTB.
2368
2389
2369 * ipython.1: document threading options in manpage.
2390 * ipython.1: document threading options in manpage.
2370
2391
2371 * scripts/ipython: Changed name of -thread option to -gthread,
2392 * scripts/ipython: Changed name of -thread option to -gthread,
2372 since this is GTK specific. I want to leave the door open for a
2393 since this is GTK specific. I want to leave the door open for a
2373 -wthread option for WX, which will most likely be necessary. This
2394 -wthread option for WX, which will most likely be necessary. This
2374 change affects usage and ipmaker as well.
2395 change affects usage and ipmaker as well.
2375
2396
2376 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2397 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2377 handle the matplotlib shell issues. Code by John Hunter
2398 handle the matplotlib shell issues. Code by John Hunter
2378 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2399 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2379 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2400 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2380 broken (and disabled for end users) for now, but it puts the
2401 broken (and disabled for end users) for now, but it puts the
2381 infrastructure in place.
2402 infrastructure in place.
2382
2403
2383 2004-08-21 Fernando Perez <fperez@colorado.edu>
2404 2004-08-21 Fernando Perez <fperez@colorado.edu>
2384
2405
2385 * ipythonrc-pylab: Add matplotlib support.
2406 * ipythonrc-pylab: Add matplotlib support.
2386
2407
2387 * matplotlib_config.py: new files for matplotlib support, part of
2408 * matplotlib_config.py: new files for matplotlib support, part of
2388 the pylab profile.
2409 the pylab profile.
2389
2410
2390 * IPython/usage.py (__doc__): documented the threading options.
2411 * IPython/usage.py (__doc__): documented the threading options.
2391
2412
2392 2004-08-20 Fernando Perez <fperez@colorado.edu>
2413 2004-08-20 Fernando Perez <fperez@colorado.edu>
2393
2414
2394 * ipython: Modified the main calling routine to handle the -thread
2415 * ipython: Modified the main calling routine to handle the -thread
2395 and -mpthread options. This needs to be done as a top-level hack,
2416 and -mpthread options. This needs to be done as a top-level hack,
2396 because it determines which class to instantiate for IPython
2417 because it determines which class to instantiate for IPython
2397 itself.
2418 itself.
2398
2419
2399 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2420 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2400 classes to support multithreaded GTK operation without blocking,
2421 classes to support multithreaded GTK operation without blocking,
2401 and matplotlib with all backends. This is a lot of still very
2422 and matplotlib with all backends. This is a lot of still very
2402 experimental code, and threads are tricky. So it may still have a
2423 experimental code, and threads are tricky. So it may still have a
2403 few rough edges... This code owes a lot to
2424 few rough edges... This code owes a lot to
2404 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2425 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2405 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2426 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2406 to John Hunter for all the matplotlib work.
2427 to John Hunter for all the matplotlib work.
2407
2428
2408 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2429 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2409 options for gtk thread and matplotlib support.
2430 options for gtk thread and matplotlib support.
2410
2431
2411 2004-08-16 Fernando Perez <fperez@colorado.edu>
2432 2004-08-16 Fernando Perez <fperez@colorado.edu>
2412
2433
2413 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2434 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2414 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2435 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2415 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2436 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2416
2437
2417 2004-08-11 Fernando Perez <fperez@colorado.edu>
2438 2004-08-11 Fernando Perez <fperez@colorado.edu>
2418
2439
2419 * setup.py (isfile): Fix build so documentation gets updated for
2440 * setup.py (isfile): Fix build so documentation gets updated for
2420 rpms (it was only done for .tgz builds).
2441 rpms (it was only done for .tgz builds).
2421
2442
2422 2004-08-10 Fernando Perez <fperez@colorado.edu>
2443 2004-08-10 Fernando Perez <fperez@colorado.edu>
2423
2444
2424 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2445 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2425
2446
2426 * iplib.py : Silence syntax error exceptions in tab-completion.
2447 * iplib.py : Silence syntax error exceptions in tab-completion.
2427
2448
2428 2004-08-05 Fernando Perez <fperez@colorado.edu>
2449 2004-08-05 Fernando Perez <fperez@colorado.edu>
2429
2450
2430 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2451 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2431 'color off' mark for continuation prompts. This was causing long
2452 'color off' mark for continuation prompts. This was causing long
2432 continuation lines to mis-wrap.
2453 continuation lines to mis-wrap.
2433
2454
2434 2004-08-01 Fernando Perez <fperez@colorado.edu>
2455 2004-08-01 Fernando Perez <fperez@colorado.edu>
2435
2456
2436 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2457 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2437 for building ipython to be a parameter. All this is necessary
2458 for building ipython to be a parameter. All this is necessary
2438 right now to have a multithreaded version, but this insane
2459 right now to have a multithreaded version, but this insane
2439 non-design will be cleaned up soon. For now, it's a hack that
2460 non-design will be cleaned up soon. For now, it's a hack that
2440 works.
2461 works.
2441
2462
2442 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2463 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2443 args in various places. No bugs so far, but it's a dangerous
2464 args in various places. No bugs so far, but it's a dangerous
2444 practice.
2465 practice.
2445
2466
2446 2004-07-31 Fernando Perez <fperez@colorado.edu>
2467 2004-07-31 Fernando Perez <fperez@colorado.edu>
2447
2468
2448 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2469 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2449 fix completion of files with dots in their names under most
2470 fix completion of files with dots in their names under most
2450 profiles (pysh was OK because the completion order is different).
2471 profiles (pysh was OK because the completion order is different).
2451
2472
2452 2004-07-27 Fernando Perez <fperez@colorado.edu>
2473 2004-07-27 Fernando Perez <fperez@colorado.edu>
2453
2474
2454 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2475 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2455 keywords manually, b/c the one in keyword.py was removed in python
2476 keywords manually, b/c the one in keyword.py was removed in python
2456 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2477 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2457 This is NOT a bug under python 2.3 and earlier.
2478 This is NOT a bug under python 2.3 and earlier.
2458
2479
2459 2004-07-26 Fernando Perez <fperez@colorado.edu>
2480 2004-07-26 Fernando Perez <fperez@colorado.edu>
2460
2481
2461 * IPython/ultraTB.py (VerboseTB.text): Add another
2482 * IPython/ultraTB.py (VerboseTB.text): Add another
2462 linecache.checkcache() call to try to prevent inspect.py from
2483 linecache.checkcache() call to try to prevent inspect.py from
2463 crashing under python 2.3. I think this fixes
2484 crashing under python 2.3. I think this fixes
2464 http://www.scipy.net/roundup/ipython/issue17.
2485 http://www.scipy.net/roundup/ipython/issue17.
2465
2486
2466 2004-07-26 *** Released version 0.6.2
2487 2004-07-26 *** Released version 0.6.2
2467
2488
2468 2004-07-26 Fernando Perez <fperez@colorado.edu>
2489 2004-07-26 Fernando Perez <fperez@colorado.edu>
2469
2490
2470 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2491 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2471 fail for any number.
2492 fail for any number.
2472 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2493 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2473 empty bookmarks.
2494 empty bookmarks.
2474
2495
2475 2004-07-26 *** Released version 0.6.1
2496 2004-07-26 *** Released version 0.6.1
2476
2497
2477 2004-07-26 Fernando Perez <fperez@colorado.edu>
2498 2004-07-26 Fernando Perez <fperez@colorado.edu>
2478
2499
2479 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2500 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2480
2501
2481 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2502 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2482 escaping '()[]{}' in filenames.
2503 escaping '()[]{}' in filenames.
2483
2504
2484 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2505 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2485 Python 2.2 users who lack a proper shlex.split.
2506 Python 2.2 users who lack a proper shlex.split.
2486
2507
2487 2004-07-19 Fernando Perez <fperez@colorado.edu>
2508 2004-07-19 Fernando Perez <fperez@colorado.edu>
2488
2509
2489 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2510 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2490 for reading readline's init file. I follow the normal chain:
2511 for reading readline's init file. I follow the normal chain:
2491 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2512 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2492 report by Mike Heeter. This closes
2513 report by Mike Heeter. This closes
2493 http://www.scipy.net/roundup/ipython/issue16.
2514 http://www.scipy.net/roundup/ipython/issue16.
2494
2515
2495 2004-07-18 Fernando Perez <fperez@colorado.edu>
2516 2004-07-18 Fernando Perez <fperez@colorado.edu>
2496
2517
2497 * IPython/iplib.py (__init__): Add better handling of '\' under
2518 * IPython/iplib.py (__init__): Add better handling of '\' under
2498 Win32 for filenames. After a patch by Ville.
2519 Win32 for filenames. After a patch by Ville.
2499
2520
2500 2004-07-17 Fernando Perez <fperez@colorado.edu>
2521 2004-07-17 Fernando Perez <fperez@colorado.edu>
2501
2522
2502 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2523 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2503 autocalling would be triggered for 'foo is bar' if foo is
2524 autocalling would be triggered for 'foo is bar' if foo is
2504 callable. I also cleaned up the autocall detection code to use a
2525 callable. I also cleaned up the autocall detection code to use a
2505 regexp, which is faster. Bug reported by Alexander Schmolck.
2526 regexp, which is faster. Bug reported by Alexander Schmolck.
2506
2527
2507 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2528 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2508 '?' in them would confuse the help system. Reported by Alex
2529 '?' in them would confuse the help system. Reported by Alex
2509 Schmolck.
2530 Schmolck.
2510
2531
2511 2004-07-16 Fernando Perez <fperez@colorado.edu>
2532 2004-07-16 Fernando Perez <fperez@colorado.edu>
2512
2533
2513 * IPython/GnuplotInteractive.py (__all__): added plot2.
2534 * IPython/GnuplotInteractive.py (__all__): added plot2.
2514
2535
2515 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2536 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2516 plotting dictionaries, lists or tuples of 1d arrays.
2537 plotting dictionaries, lists or tuples of 1d arrays.
2517
2538
2518 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2539 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2519 optimizations.
2540 optimizations.
2520
2541
2521 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2542 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2522 the information which was there from Janko's original IPP code:
2543 the information which was there from Janko's original IPP code:
2523
2544
2524 03.05.99 20:53 porto.ifm.uni-kiel.de
2545 03.05.99 20:53 porto.ifm.uni-kiel.de
2525 --Started changelog.
2546 --Started changelog.
2526 --make clear do what it say it does
2547 --make clear do what it say it does
2527 --added pretty output of lines from inputcache
2548 --added pretty output of lines from inputcache
2528 --Made Logger a mixin class, simplifies handling of switches
2549 --Made Logger a mixin class, simplifies handling of switches
2529 --Added own completer class. .string<TAB> expands to last history
2550 --Added own completer class. .string<TAB> expands to last history
2530 line which starts with string. The new expansion is also present
2551 line which starts with string. The new expansion is also present
2531 with Ctrl-r from the readline library. But this shows, who this
2552 with Ctrl-r from the readline library. But this shows, who this
2532 can be done for other cases.
2553 can be done for other cases.
2533 --Added convention that all shell functions should accept a
2554 --Added convention that all shell functions should accept a
2534 parameter_string This opens the door for different behaviour for
2555 parameter_string This opens the door for different behaviour for
2535 each function. @cd is a good example of this.
2556 each function. @cd is a good example of this.
2536
2557
2537 04.05.99 12:12 porto.ifm.uni-kiel.de
2558 04.05.99 12:12 porto.ifm.uni-kiel.de
2538 --added logfile rotation
2559 --added logfile rotation
2539 --added new mainloop method which freezes first the namespace
2560 --added new mainloop method which freezes first the namespace
2540
2561
2541 07.05.99 21:24 porto.ifm.uni-kiel.de
2562 07.05.99 21:24 porto.ifm.uni-kiel.de
2542 --added the docreader classes. Now there is a help system.
2563 --added the docreader classes. Now there is a help system.
2543 -This is only a first try. Currently it's not easy to put new
2564 -This is only a first try. Currently it's not easy to put new
2544 stuff in the indices. But this is the way to go. Info would be
2565 stuff in the indices. But this is the way to go. Info would be
2545 better, but HTML is every where and not everybody has an info
2566 better, but HTML is every where and not everybody has an info
2546 system installed and it's not so easy to change html-docs to info.
2567 system installed and it's not so easy to change html-docs to info.
2547 --added global logfile option
2568 --added global logfile option
2548 --there is now a hook for object inspection method pinfo needs to
2569 --there is now a hook for object inspection method pinfo needs to
2549 be provided for this. Can be reached by two '??'.
2570 be provided for this. Can be reached by two '??'.
2550
2571
2551 08.05.99 20:51 porto.ifm.uni-kiel.de
2572 08.05.99 20:51 porto.ifm.uni-kiel.de
2552 --added a README
2573 --added a README
2553 --bug in rc file. Something has changed so functions in the rc
2574 --bug in rc file. Something has changed so functions in the rc
2554 file need to reference the shell and not self. Not clear if it's a
2575 file need to reference the shell and not self. Not clear if it's a
2555 bug or feature.
2576 bug or feature.
2556 --changed rc file for new behavior
2577 --changed rc file for new behavior
2557
2578
2558 2004-07-15 Fernando Perez <fperez@colorado.edu>
2579 2004-07-15 Fernando Perez <fperez@colorado.edu>
2559
2580
2560 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2581 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2561 cache was falling out of sync in bizarre manners when multi-line
2582 cache was falling out of sync in bizarre manners when multi-line
2562 input was present. Minor optimizations and cleanup.
2583 input was present. Minor optimizations and cleanup.
2563
2584
2564 (Logger): Remove old Changelog info for cleanup. This is the
2585 (Logger): Remove old Changelog info for cleanup. This is the
2565 information which was there from Janko's original code:
2586 information which was there from Janko's original code:
2566
2587
2567 Changes to Logger: - made the default log filename a parameter
2588 Changes to Logger: - made the default log filename a parameter
2568
2589
2569 - put a check for lines beginning with !@? in log(). Needed
2590 - put a check for lines beginning with !@? in log(). Needed
2570 (even if the handlers properly log their lines) for mid-session
2591 (even if the handlers properly log their lines) for mid-session
2571 logging activation to work properly. Without this, lines logged
2592 logging activation to work properly. Without this, lines logged
2572 in mid session, which get read from the cache, would end up
2593 in mid session, which get read from the cache, would end up
2573 'bare' (with !@? in the open) in the log. Now they are caught
2594 'bare' (with !@? in the open) in the log. Now they are caught
2574 and prepended with a #.
2595 and prepended with a #.
2575
2596
2576 * IPython/iplib.py (InteractiveShell.init_readline): added check
2597 * IPython/iplib.py (InteractiveShell.init_readline): added check
2577 in case MagicCompleter fails to be defined, so we don't crash.
2598 in case MagicCompleter fails to be defined, so we don't crash.
2578
2599
2579 2004-07-13 Fernando Perez <fperez@colorado.edu>
2600 2004-07-13 Fernando Perez <fperez@colorado.edu>
2580
2601
2581 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2602 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2582 of EPS if the requested filename ends in '.eps'.
2603 of EPS if the requested filename ends in '.eps'.
2583
2604
2584 2004-07-04 Fernando Perez <fperez@colorado.edu>
2605 2004-07-04 Fernando Perez <fperez@colorado.edu>
2585
2606
2586 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2607 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2587 escaping of quotes when calling the shell.
2608 escaping of quotes when calling the shell.
2588
2609
2589 2004-07-02 Fernando Perez <fperez@colorado.edu>
2610 2004-07-02 Fernando Perez <fperez@colorado.edu>
2590
2611
2591 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2612 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2592 gettext not working because we were clobbering '_'. Fixes
2613 gettext not working because we were clobbering '_'. Fixes
2593 http://www.scipy.net/roundup/ipython/issue6.
2614 http://www.scipy.net/roundup/ipython/issue6.
2594
2615
2595 2004-07-01 Fernando Perez <fperez@colorado.edu>
2616 2004-07-01 Fernando Perez <fperez@colorado.edu>
2596
2617
2597 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2618 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2598 into @cd. Patch by Ville.
2619 into @cd. Patch by Ville.
2599
2620
2600 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2621 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2601 new function to store things after ipmaker runs. Patch by Ville.
2622 new function to store things after ipmaker runs. Patch by Ville.
2602 Eventually this will go away once ipmaker is removed and the class
2623 Eventually this will go away once ipmaker is removed and the class
2603 gets cleaned up, but for now it's ok. Key functionality here is
2624 gets cleaned up, but for now it's ok. Key functionality here is
2604 the addition of the persistent storage mechanism, a dict for
2625 the addition of the persistent storage mechanism, a dict for
2605 keeping data across sessions (for now just bookmarks, but more can
2626 keeping data across sessions (for now just bookmarks, but more can
2606 be implemented later).
2627 be implemented later).
2607
2628
2608 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2629 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2609 persistent across sections. Patch by Ville, I modified it
2630 persistent across sections. Patch by Ville, I modified it
2610 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2631 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2611 added a '-l' option to list all bookmarks.
2632 added a '-l' option to list all bookmarks.
2612
2633
2613 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2634 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2614 center for cleanup. Registered with atexit.register(). I moved
2635 center for cleanup. Registered with atexit.register(). I moved
2615 here the old exit_cleanup(). After a patch by Ville.
2636 here the old exit_cleanup(). After a patch by Ville.
2616
2637
2617 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2638 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2618 characters in the hacked shlex_split for python 2.2.
2639 characters in the hacked shlex_split for python 2.2.
2619
2640
2620 * IPython/iplib.py (file_matches): more fixes to filenames with
2641 * IPython/iplib.py (file_matches): more fixes to filenames with
2621 whitespace in them. It's not perfect, but limitations in python's
2642 whitespace in them. It's not perfect, but limitations in python's
2622 readline make it impossible to go further.
2643 readline make it impossible to go further.
2623
2644
2624 2004-06-29 Fernando Perez <fperez@colorado.edu>
2645 2004-06-29 Fernando Perez <fperez@colorado.edu>
2625
2646
2626 * IPython/iplib.py (file_matches): escape whitespace correctly in
2647 * IPython/iplib.py (file_matches): escape whitespace correctly in
2627 filename completions. Bug reported by Ville.
2648 filename completions. Bug reported by Ville.
2628
2649
2629 2004-06-28 Fernando Perez <fperez@colorado.edu>
2650 2004-06-28 Fernando Perez <fperez@colorado.edu>
2630
2651
2631 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2652 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2632 the history file will be called 'history-PROFNAME' (or just
2653 the history file will be called 'history-PROFNAME' (or just
2633 'history' if no profile is loaded). I was getting annoyed at
2654 'history' if no profile is loaded). I was getting annoyed at
2634 getting my Numerical work history clobbered by pysh sessions.
2655 getting my Numerical work history clobbered by pysh sessions.
2635
2656
2636 * IPython/iplib.py (InteractiveShell.__init__): Internal
2657 * IPython/iplib.py (InteractiveShell.__init__): Internal
2637 getoutputerror() function so that we can honor the system_verbose
2658 getoutputerror() function so that we can honor the system_verbose
2638 flag for _all_ system calls. I also added escaping of #
2659 flag for _all_ system calls. I also added escaping of #
2639 characters here to avoid confusing Itpl.
2660 characters here to avoid confusing Itpl.
2640
2661
2641 * IPython/Magic.py (shlex_split): removed call to shell in
2662 * IPython/Magic.py (shlex_split): removed call to shell in
2642 parse_options and replaced it with shlex.split(). The annoying
2663 parse_options and replaced it with shlex.split(). The annoying
2643 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2664 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2644 to backport it from 2.3, with several frail hacks (the shlex
2665 to backport it from 2.3, with several frail hacks (the shlex
2645 module is rather limited in 2.2). Thanks to a suggestion by Ville
2666 module is rather limited in 2.2). Thanks to a suggestion by Ville
2646 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2667 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2647 problem.
2668 problem.
2648
2669
2649 (Magic.magic_system_verbose): new toggle to print the actual
2670 (Magic.magic_system_verbose): new toggle to print the actual
2650 system calls made by ipython. Mainly for debugging purposes.
2671 system calls made by ipython. Mainly for debugging purposes.
2651
2672
2652 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2673 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2653 doesn't support persistence. Reported (and fix suggested) by
2674 doesn't support persistence. Reported (and fix suggested) by
2654 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2675 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2655
2676
2656 2004-06-26 Fernando Perez <fperez@colorado.edu>
2677 2004-06-26 Fernando Perez <fperez@colorado.edu>
2657
2678
2658 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2679 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2659 continue prompts.
2680 continue prompts.
2660
2681
2661 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2682 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2662 function (basically a big docstring) and a few more things here to
2683 function (basically a big docstring) and a few more things here to
2663 speedup startup. pysh.py is now very lightweight. We want because
2684 speedup startup. pysh.py is now very lightweight. We want because
2664 it gets execfile'd, while InterpreterExec gets imported, so
2685 it gets execfile'd, while InterpreterExec gets imported, so
2665 byte-compilation saves time.
2686 byte-compilation saves time.
2666
2687
2667 2004-06-25 Fernando Perez <fperez@colorado.edu>
2688 2004-06-25 Fernando Perez <fperez@colorado.edu>
2668
2689
2669 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2690 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2670 -NUM', which was recently broken.
2691 -NUM', which was recently broken.
2671
2692
2672 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2693 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2673 in multi-line input (but not !!, which doesn't make sense there).
2694 in multi-line input (but not !!, which doesn't make sense there).
2674
2695
2675 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2696 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2676 It's just too useful, and people can turn it off in the less
2697 It's just too useful, and people can turn it off in the less
2677 common cases where it's a problem.
2698 common cases where it's a problem.
2678
2699
2679 2004-06-24 Fernando Perez <fperez@colorado.edu>
2700 2004-06-24 Fernando Perez <fperez@colorado.edu>
2680
2701
2681 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2702 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2682 special syntaxes (like alias calling) is now allied in multi-line
2703 special syntaxes (like alias calling) is now allied in multi-line
2683 input. This is still _very_ experimental, but it's necessary for
2704 input. This is still _very_ experimental, but it's necessary for
2684 efficient shell usage combining python looping syntax with system
2705 efficient shell usage combining python looping syntax with system
2685 calls. For now it's restricted to aliases, I don't think it
2706 calls. For now it's restricted to aliases, I don't think it
2686 really even makes sense to have this for magics.
2707 really even makes sense to have this for magics.
2687
2708
2688 2004-06-23 Fernando Perez <fperez@colorado.edu>
2709 2004-06-23 Fernando Perez <fperez@colorado.edu>
2689
2710
2690 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2711 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2691 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2712 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2692
2713
2693 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2714 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2694 extensions under Windows (after code sent by Gary Bishop). The
2715 extensions under Windows (after code sent by Gary Bishop). The
2695 extensions considered 'executable' are stored in IPython's rc
2716 extensions considered 'executable' are stored in IPython's rc
2696 structure as win_exec_ext.
2717 structure as win_exec_ext.
2697
2718
2698 * IPython/genutils.py (shell): new function, like system() but
2719 * IPython/genutils.py (shell): new function, like system() but
2699 without return value. Very useful for interactive shell work.
2720 without return value. Very useful for interactive shell work.
2700
2721
2701 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2722 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2702 delete aliases.
2723 delete aliases.
2703
2724
2704 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2725 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2705 sure that the alias table doesn't contain python keywords.
2726 sure that the alias table doesn't contain python keywords.
2706
2727
2707 2004-06-21 Fernando Perez <fperez@colorado.edu>
2728 2004-06-21 Fernando Perez <fperez@colorado.edu>
2708
2729
2709 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2730 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2710 non-existent items are found in $PATH. Reported by Thorsten.
2731 non-existent items are found in $PATH. Reported by Thorsten.
2711
2732
2712 2004-06-20 Fernando Perez <fperez@colorado.edu>
2733 2004-06-20 Fernando Perez <fperez@colorado.edu>
2713
2734
2714 * IPython/iplib.py (complete): modified the completer so that the
2735 * IPython/iplib.py (complete): modified the completer so that the
2715 order of priorities can be easily changed at runtime.
2736 order of priorities can be easily changed at runtime.
2716
2737
2717 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2738 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2718 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2739 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2719
2740
2720 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2741 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2721 expand Python variables prepended with $ in all system calls. The
2742 expand Python variables prepended with $ in all system calls. The
2722 same was done to InteractiveShell.handle_shell_escape. Now all
2743 same was done to InteractiveShell.handle_shell_escape. Now all
2723 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2744 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2724 expansion of python variables and expressions according to the
2745 expansion of python variables and expressions according to the
2725 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2746 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2726
2747
2727 Though PEP-215 has been rejected, a similar (but simpler) one
2748 Though PEP-215 has been rejected, a similar (but simpler) one
2728 seems like it will go into Python 2.4, PEP-292 -
2749 seems like it will go into Python 2.4, PEP-292 -
2729 http://www.python.org/peps/pep-0292.html.
2750 http://www.python.org/peps/pep-0292.html.
2730
2751
2731 I'll keep the full syntax of PEP-215, since IPython has since the
2752 I'll keep the full syntax of PEP-215, since IPython has since the
2732 start used Ka-Ping Yee's reference implementation discussed there
2753 start used Ka-Ping Yee's reference implementation discussed there
2733 (Itpl), and I actually like the powerful semantics it offers.
2754 (Itpl), and I actually like the powerful semantics it offers.
2734
2755
2735 In order to access normal shell variables, the $ has to be escaped
2756 In order to access normal shell variables, the $ has to be escaped
2736 via an extra $. For example:
2757 via an extra $. For example:
2737
2758
2738 In [7]: PATH='a python variable'
2759 In [7]: PATH='a python variable'
2739
2760
2740 In [8]: !echo $PATH
2761 In [8]: !echo $PATH
2741 a python variable
2762 a python variable
2742
2763
2743 In [9]: !echo $$PATH
2764 In [9]: !echo $$PATH
2744 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2765 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2745
2766
2746 (Magic.parse_options): escape $ so the shell doesn't evaluate
2767 (Magic.parse_options): escape $ so the shell doesn't evaluate
2747 things prematurely.
2768 things prematurely.
2748
2769
2749 * IPython/iplib.py (InteractiveShell.call_alias): added the
2770 * IPython/iplib.py (InteractiveShell.call_alias): added the
2750 ability for aliases to expand python variables via $.
2771 ability for aliases to expand python variables via $.
2751
2772
2752 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2773 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2753 system, now there's a @rehash/@rehashx pair of magics. These work
2774 system, now there's a @rehash/@rehashx pair of magics. These work
2754 like the csh rehash command, and can be invoked at any time. They
2775 like the csh rehash command, and can be invoked at any time. They
2755 build a table of aliases to everything in the user's $PATH
2776 build a table of aliases to everything in the user's $PATH
2756 (@rehash uses everything, @rehashx is slower but only adds
2777 (@rehash uses everything, @rehashx is slower but only adds
2757 executable files). With this, the pysh.py-based shell profile can
2778 executable files). With this, the pysh.py-based shell profile can
2758 now simply call rehash upon startup, and full access to all
2779 now simply call rehash upon startup, and full access to all
2759 programs in the user's path is obtained.
2780 programs in the user's path is obtained.
2760
2781
2761 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2782 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2762 functionality is now fully in place. I removed the old dynamic
2783 functionality is now fully in place. I removed the old dynamic
2763 code generation based approach, in favor of a much lighter one
2784 code generation based approach, in favor of a much lighter one
2764 based on a simple dict. The advantage is that this allows me to
2785 based on a simple dict. The advantage is that this allows me to
2765 now have thousands of aliases with negligible cost (unthinkable
2786 now have thousands of aliases with negligible cost (unthinkable
2766 with the old system).
2787 with the old system).
2767
2788
2768 2004-06-19 Fernando Perez <fperez@colorado.edu>
2789 2004-06-19 Fernando Perez <fperez@colorado.edu>
2769
2790
2770 * IPython/iplib.py (__init__): extended MagicCompleter class to
2791 * IPython/iplib.py (__init__): extended MagicCompleter class to
2771 also complete (last in priority) on user aliases.
2792 also complete (last in priority) on user aliases.
2772
2793
2773 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2794 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2774 call to eval.
2795 call to eval.
2775 (ItplNS.__init__): Added a new class which functions like Itpl,
2796 (ItplNS.__init__): Added a new class which functions like Itpl,
2776 but allows configuring the namespace for the evaluation to occur
2797 but allows configuring the namespace for the evaluation to occur
2777 in.
2798 in.
2778
2799
2779 2004-06-18 Fernando Perez <fperez@colorado.edu>
2800 2004-06-18 Fernando Perez <fperez@colorado.edu>
2780
2801
2781 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2802 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2782 better message when 'exit' or 'quit' are typed (a common newbie
2803 better message when 'exit' or 'quit' are typed (a common newbie
2783 confusion).
2804 confusion).
2784
2805
2785 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2806 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2786 check for Windows users.
2807 check for Windows users.
2787
2808
2788 * IPython/iplib.py (InteractiveShell.user_setup): removed
2809 * IPython/iplib.py (InteractiveShell.user_setup): removed
2789 disabling of colors for Windows. I'll test at runtime and issue a
2810 disabling of colors for Windows. I'll test at runtime and issue a
2790 warning if Gary's readline isn't found, as to nudge users to
2811 warning if Gary's readline isn't found, as to nudge users to
2791 download it.
2812 download it.
2792
2813
2793 2004-06-16 Fernando Perez <fperez@colorado.edu>
2814 2004-06-16 Fernando Perez <fperez@colorado.edu>
2794
2815
2795 * IPython/genutils.py (Stream.__init__): changed to print errors
2816 * IPython/genutils.py (Stream.__init__): changed to print errors
2796 to sys.stderr. I had a circular dependency here. Now it's
2817 to sys.stderr. I had a circular dependency here. Now it's
2797 possible to run ipython as IDLE's shell (consider this pre-alpha,
2818 possible to run ipython as IDLE's shell (consider this pre-alpha,
2798 since true stdout things end up in the starting terminal instead
2819 since true stdout things end up in the starting terminal instead
2799 of IDLE's out).
2820 of IDLE's out).
2800
2821
2801 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2822 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2802 users who haven't # updated their prompt_in2 definitions. Remove
2823 users who haven't # updated their prompt_in2 definitions. Remove
2803 eventually.
2824 eventually.
2804 (multiple_replace): added credit to original ASPN recipe.
2825 (multiple_replace): added credit to original ASPN recipe.
2805
2826
2806 2004-06-15 Fernando Perez <fperez@colorado.edu>
2827 2004-06-15 Fernando Perez <fperez@colorado.edu>
2807
2828
2808 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2829 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2809 list of auto-defined aliases.
2830 list of auto-defined aliases.
2810
2831
2811 2004-06-13 Fernando Perez <fperez@colorado.edu>
2832 2004-06-13 Fernando Perez <fperez@colorado.edu>
2812
2833
2813 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2834 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2814 install was really requested (so setup.py can be used for other
2835 install was really requested (so setup.py can be used for other
2815 things under Windows).
2836 things under Windows).
2816
2837
2817 2004-06-10 Fernando Perez <fperez@colorado.edu>
2838 2004-06-10 Fernando Perez <fperez@colorado.edu>
2818
2839
2819 * IPython/Logger.py (Logger.create_log): Manually remove any old
2840 * IPython/Logger.py (Logger.create_log): Manually remove any old
2820 backup, since os.remove may fail under Windows. Fixes bug
2841 backup, since os.remove may fail under Windows. Fixes bug
2821 reported by Thorsten.
2842 reported by Thorsten.
2822
2843
2823 2004-06-09 Fernando Perez <fperez@colorado.edu>
2844 2004-06-09 Fernando Perez <fperez@colorado.edu>
2824
2845
2825 * examples/example-embed.py: fixed all references to %n (replaced
2846 * examples/example-embed.py: fixed all references to %n (replaced
2826 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2847 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2827 for all examples and the manual as well.
2848 for all examples and the manual as well.
2828
2849
2829 2004-06-08 Fernando Perez <fperez@colorado.edu>
2850 2004-06-08 Fernando Perez <fperez@colorado.edu>
2830
2851
2831 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2852 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2832 alignment and color management. All 3 prompt subsystems now
2853 alignment and color management. All 3 prompt subsystems now
2833 inherit from BasePrompt.
2854 inherit from BasePrompt.
2834
2855
2835 * tools/release: updates for windows installer build and tag rpms
2856 * tools/release: updates for windows installer build and tag rpms
2836 with python version (since paths are fixed).
2857 with python version (since paths are fixed).
2837
2858
2838 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2859 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2839 which will become eventually obsolete. Also fixed the default
2860 which will become eventually obsolete. Also fixed the default
2840 prompt_in2 to use \D, so at least new users start with the correct
2861 prompt_in2 to use \D, so at least new users start with the correct
2841 defaults.
2862 defaults.
2842 WARNING: Users with existing ipythonrc files will need to apply
2863 WARNING: Users with existing ipythonrc files will need to apply
2843 this fix manually!
2864 this fix manually!
2844
2865
2845 * setup.py: make windows installer (.exe). This is finally the
2866 * setup.py: make windows installer (.exe). This is finally the
2846 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2867 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2847 which I hadn't included because it required Python 2.3 (or recent
2868 which I hadn't included because it required Python 2.3 (or recent
2848 distutils).
2869 distutils).
2849
2870
2850 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2871 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2851 usage of new '\D' escape.
2872 usage of new '\D' escape.
2852
2873
2853 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2874 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2854 lacks os.getuid())
2875 lacks os.getuid())
2855 (CachedOutput.set_colors): Added the ability to turn coloring
2876 (CachedOutput.set_colors): Added the ability to turn coloring
2856 on/off with @colors even for manually defined prompt colors. It
2877 on/off with @colors even for manually defined prompt colors. It
2857 uses a nasty global, but it works safely and via the generic color
2878 uses a nasty global, but it works safely and via the generic color
2858 handling mechanism.
2879 handling mechanism.
2859 (Prompt2.__init__): Introduced new escape '\D' for continuation
2880 (Prompt2.__init__): Introduced new escape '\D' for continuation
2860 prompts. It represents the counter ('\#') as dots.
2881 prompts. It represents the counter ('\#') as dots.
2861 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2882 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2862 need to update their ipythonrc files and replace '%n' with '\D' in
2883 need to update their ipythonrc files and replace '%n' with '\D' in
2863 their prompt_in2 settings everywhere. Sorry, but there's
2884 their prompt_in2 settings everywhere. Sorry, but there's
2864 otherwise no clean way to get all prompts to properly align. The
2885 otherwise no clean way to get all prompts to properly align. The
2865 ipythonrc shipped with IPython has been updated.
2886 ipythonrc shipped with IPython has been updated.
2866
2887
2867 2004-06-07 Fernando Perez <fperez@colorado.edu>
2888 2004-06-07 Fernando Perez <fperez@colorado.edu>
2868
2889
2869 * setup.py (isfile): Pass local_icons option to latex2html, so the
2890 * setup.py (isfile): Pass local_icons option to latex2html, so the
2870 resulting HTML file is self-contained. Thanks to
2891 resulting HTML file is self-contained. Thanks to
2871 dryice-AT-liu.com.cn for the tip.
2892 dryice-AT-liu.com.cn for the tip.
2872
2893
2873 * pysh.py: I created a new profile 'shell', which implements a
2894 * pysh.py: I created a new profile 'shell', which implements a
2874 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2895 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2875 system shell, nor will it become one anytime soon. It's mainly
2896 system shell, nor will it become one anytime soon. It's mainly
2876 meant to illustrate the use of the new flexible bash-like prompts.
2897 meant to illustrate the use of the new flexible bash-like prompts.
2877 I guess it could be used by hardy souls for true shell management,
2898 I guess it could be used by hardy souls for true shell management,
2878 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2899 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2879 profile. This uses the InterpreterExec extension provided by
2900 profile. This uses the InterpreterExec extension provided by
2880 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2901 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2881
2902
2882 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2903 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2883 auto-align itself with the length of the previous input prompt
2904 auto-align itself with the length of the previous input prompt
2884 (taking into account the invisible color escapes).
2905 (taking into account the invisible color escapes).
2885 (CachedOutput.__init__): Large restructuring of this class. Now
2906 (CachedOutput.__init__): Large restructuring of this class. Now
2886 all three prompts (primary1, primary2, output) are proper objects,
2907 all three prompts (primary1, primary2, output) are proper objects,
2887 managed by the 'parent' CachedOutput class. The code is still a
2908 managed by the 'parent' CachedOutput class. The code is still a
2888 bit hackish (all prompts share state via a pointer to the cache),
2909 bit hackish (all prompts share state via a pointer to the cache),
2889 but it's overall far cleaner than before.
2910 but it's overall far cleaner than before.
2890
2911
2891 * IPython/genutils.py (getoutputerror): modified to add verbose,
2912 * IPython/genutils.py (getoutputerror): modified to add verbose,
2892 debug and header options. This makes the interface of all getout*
2913 debug and header options. This makes the interface of all getout*
2893 functions uniform.
2914 functions uniform.
2894 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2915 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2895
2916
2896 * IPython/Magic.py (Magic.default_option): added a function to
2917 * IPython/Magic.py (Magic.default_option): added a function to
2897 allow registering default options for any magic command. This
2918 allow registering default options for any magic command. This
2898 makes it easy to have profiles which customize the magics globally
2919 makes it easy to have profiles which customize the magics globally
2899 for a certain use. The values set through this function are
2920 for a certain use. The values set through this function are
2900 picked up by the parse_options() method, which all magics should
2921 picked up by the parse_options() method, which all magics should
2901 use to parse their options.
2922 use to parse their options.
2902
2923
2903 * IPython/genutils.py (warn): modified the warnings framework to
2924 * IPython/genutils.py (warn): modified the warnings framework to
2904 use the Term I/O class. I'm trying to slowly unify all of
2925 use the Term I/O class. I'm trying to slowly unify all of
2905 IPython's I/O operations to pass through Term.
2926 IPython's I/O operations to pass through Term.
2906
2927
2907 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2928 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2908 the secondary prompt to correctly match the length of the primary
2929 the secondary prompt to correctly match the length of the primary
2909 one for any prompt. Now multi-line code will properly line up
2930 one for any prompt. Now multi-line code will properly line up
2910 even for path dependent prompts, such as the new ones available
2931 even for path dependent prompts, such as the new ones available
2911 via the prompt_specials.
2932 via the prompt_specials.
2912
2933
2913 2004-06-06 Fernando Perez <fperez@colorado.edu>
2934 2004-06-06 Fernando Perez <fperez@colorado.edu>
2914
2935
2915 * IPython/Prompts.py (prompt_specials): Added the ability to have
2936 * IPython/Prompts.py (prompt_specials): Added the ability to have
2916 bash-like special sequences in the prompts, which get
2937 bash-like special sequences in the prompts, which get
2917 automatically expanded. Things like hostname, current working
2938 automatically expanded. Things like hostname, current working
2918 directory and username are implemented already, but it's easy to
2939 directory and username are implemented already, but it's easy to
2919 add more in the future. Thanks to a patch by W.J. van der Laan
2940 add more in the future. Thanks to a patch by W.J. van der Laan
2920 <gnufnork-AT-hetdigitalegat.nl>
2941 <gnufnork-AT-hetdigitalegat.nl>
2921 (prompt_specials): Added color support for prompt strings, so
2942 (prompt_specials): Added color support for prompt strings, so
2922 users can define arbitrary color setups for their prompts.
2943 users can define arbitrary color setups for their prompts.
2923
2944
2924 2004-06-05 Fernando Perez <fperez@colorado.edu>
2945 2004-06-05 Fernando Perez <fperez@colorado.edu>
2925
2946
2926 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2947 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2927 code to load Gary Bishop's readline and configure it
2948 code to load Gary Bishop's readline and configure it
2928 automatically. Thanks to Gary for help on this.
2949 automatically. Thanks to Gary for help on this.
2929
2950
2930 2004-06-01 Fernando Perez <fperez@colorado.edu>
2951 2004-06-01 Fernando Perez <fperez@colorado.edu>
2931
2952
2932 * IPython/Logger.py (Logger.create_log): fix bug for logging
2953 * IPython/Logger.py (Logger.create_log): fix bug for logging
2933 with no filename (previous fix was incomplete).
2954 with no filename (previous fix was incomplete).
2934
2955
2935 2004-05-25 Fernando Perez <fperez@colorado.edu>
2956 2004-05-25 Fernando Perez <fperez@colorado.edu>
2936
2957
2937 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2958 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2938 parens would get passed to the shell.
2959 parens would get passed to the shell.
2939
2960
2940 2004-05-20 Fernando Perez <fperez@colorado.edu>
2961 2004-05-20 Fernando Perez <fperez@colorado.edu>
2941
2962
2942 * IPython/Magic.py (Magic.magic_prun): changed default profile
2963 * IPython/Magic.py (Magic.magic_prun): changed default profile
2943 sort order to 'time' (the more common profiling need).
2964 sort order to 'time' (the more common profiling need).
2944
2965
2945 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2966 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2946 so that source code shown is guaranteed in sync with the file on
2967 so that source code shown is guaranteed in sync with the file on
2947 disk (also changed in psource). Similar fix to the one for
2968 disk (also changed in psource). Similar fix to the one for
2948 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2969 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2949 <yann.ledu-AT-noos.fr>.
2970 <yann.ledu-AT-noos.fr>.
2950
2971
2951 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2972 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2952 with a single option would not be correctly parsed. Closes
2973 with a single option would not be correctly parsed. Closes
2953 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2974 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2954 introduced in 0.6.0 (on 2004-05-06).
2975 introduced in 0.6.0 (on 2004-05-06).
2955
2976
2956 2004-05-13 *** Released version 0.6.0
2977 2004-05-13 *** Released version 0.6.0
2957
2978
2958 2004-05-13 Fernando Perez <fperez@colorado.edu>
2979 2004-05-13 Fernando Perez <fperez@colorado.edu>
2959
2980
2960 * debian/: Added debian/ directory to CVS, so that debian support
2981 * debian/: Added debian/ directory to CVS, so that debian support
2961 is publicly accessible. The debian package is maintained by Jack
2982 is publicly accessible. The debian package is maintained by Jack
2962 Moffit <jack-AT-xiph.org>.
2983 Moffit <jack-AT-xiph.org>.
2963
2984
2964 * Documentation: included the notes about an ipython-based system
2985 * Documentation: included the notes about an ipython-based system
2965 shell (the hypothetical 'pysh') into the new_design.pdf document,
2986 shell (the hypothetical 'pysh') into the new_design.pdf document,
2966 so that these ideas get distributed to users along with the
2987 so that these ideas get distributed to users along with the
2967 official documentation.
2988 official documentation.
2968
2989
2969 2004-05-10 Fernando Perez <fperez@colorado.edu>
2990 2004-05-10 Fernando Perez <fperez@colorado.edu>
2970
2991
2971 * IPython/Logger.py (Logger.create_log): fix recently introduced
2992 * IPython/Logger.py (Logger.create_log): fix recently introduced
2972 bug (misindented line) where logstart would fail when not given an
2993 bug (misindented line) where logstart would fail when not given an
2973 explicit filename.
2994 explicit filename.
2974
2995
2975 2004-05-09 Fernando Perez <fperez@colorado.edu>
2996 2004-05-09 Fernando Perez <fperez@colorado.edu>
2976
2997
2977 * IPython/Magic.py (Magic.parse_options): skip system call when
2998 * IPython/Magic.py (Magic.parse_options): skip system call when
2978 there are no options to look for. Faster, cleaner for the common
2999 there are no options to look for. Faster, cleaner for the common
2979 case.
3000 case.
2980
3001
2981 * Documentation: many updates to the manual: describing Windows
3002 * Documentation: many updates to the manual: describing Windows
2982 support better, Gnuplot updates, credits, misc small stuff. Also
3003 support better, Gnuplot updates, credits, misc small stuff. Also
2983 updated the new_design doc a bit.
3004 updated the new_design doc a bit.
2984
3005
2985 2004-05-06 *** Released version 0.6.0.rc1
3006 2004-05-06 *** Released version 0.6.0.rc1
2986
3007
2987 2004-05-06 Fernando Perez <fperez@colorado.edu>
3008 2004-05-06 Fernando Perez <fperez@colorado.edu>
2988
3009
2989 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3010 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2990 operations to use the vastly more efficient list/''.join() method.
3011 operations to use the vastly more efficient list/''.join() method.
2991 (FormattedTB.text): Fix
3012 (FormattedTB.text): Fix
2992 http://www.scipy.net/roundup/ipython/issue12 - exception source
3013 http://www.scipy.net/roundup/ipython/issue12 - exception source
2993 extract not updated after reload. Thanks to Mike Salib
3014 extract not updated after reload. Thanks to Mike Salib
2994 <msalib-AT-mit.edu> for pinning the source of the problem.
3015 <msalib-AT-mit.edu> for pinning the source of the problem.
2995 Fortunately, the solution works inside ipython and doesn't require
3016 Fortunately, the solution works inside ipython and doesn't require
2996 any changes to python proper.
3017 any changes to python proper.
2997
3018
2998 * IPython/Magic.py (Magic.parse_options): Improved to process the
3019 * IPython/Magic.py (Magic.parse_options): Improved to process the
2999 argument list as a true shell would (by actually using the
3020 argument list as a true shell would (by actually using the
3000 underlying system shell). This way, all @magics automatically get
3021 underlying system shell). This way, all @magics automatically get
3001 shell expansion for variables. Thanks to a comment by Alex
3022 shell expansion for variables. Thanks to a comment by Alex
3002 Schmolck.
3023 Schmolck.
3003
3024
3004 2004-04-04 Fernando Perez <fperez@colorado.edu>
3025 2004-04-04 Fernando Perez <fperez@colorado.edu>
3005
3026
3006 * IPython/iplib.py (InteractiveShell.interact): Added a special
3027 * IPython/iplib.py (InteractiveShell.interact): Added a special
3007 trap for a debugger quit exception, which is basically impossible
3028 trap for a debugger quit exception, which is basically impossible
3008 to handle by normal mechanisms, given what pdb does to the stack.
3029 to handle by normal mechanisms, given what pdb does to the stack.
3009 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3030 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3010
3031
3011 2004-04-03 Fernando Perez <fperez@colorado.edu>
3032 2004-04-03 Fernando Perez <fperez@colorado.edu>
3012
3033
3013 * IPython/genutils.py (Term): Standardized the names of the Term
3034 * IPython/genutils.py (Term): Standardized the names of the Term
3014 class streams to cin/cout/cerr, following C++ naming conventions
3035 class streams to cin/cout/cerr, following C++ naming conventions
3015 (I can't use in/out/err because 'in' is not a valid attribute
3036 (I can't use in/out/err because 'in' is not a valid attribute
3016 name).
3037 name).
3017
3038
3018 * IPython/iplib.py (InteractiveShell.interact): don't increment
3039 * IPython/iplib.py (InteractiveShell.interact): don't increment
3019 the prompt if there's no user input. By Daniel 'Dang' Griffith
3040 the prompt if there's no user input. By Daniel 'Dang' Griffith
3020 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3041 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3021 Francois Pinard.
3042 Francois Pinard.
3022
3043
3023 2004-04-02 Fernando Perez <fperez@colorado.edu>
3044 2004-04-02 Fernando Perez <fperez@colorado.edu>
3024
3045
3025 * IPython/genutils.py (Stream.__init__): Modified to survive at
3046 * IPython/genutils.py (Stream.__init__): Modified to survive at
3026 least importing in contexts where stdin/out/err aren't true file
3047 least importing in contexts where stdin/out/err aren't true file
3027 objects, such as PyCrust (they lack fileno() and mode). However,
3048 objects, such as PyCrust (they lack fileno() and mode). However,
3028 the recovery facilities which rely on these things existing will
3049 the recovery facilities which rely on these things existing will
3029 not work.
3050 not work.
3030
3051
3031 2004-04-01 Fernando Perez <fperez@colorado.edu>
3052 2004-04-01 Fernando Perez <fperez@colorado.edu>
3032
3053
3033 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3054 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3034 use the new getoutputerror() function, so it properly
3055 use the new getoutputerror() function, so it properly
3035 distinguishes stdout/err.
3056 distinguishes stdout/err.
3036
3057
3037 * IPython/genutils.py (getoutputerror): added a function to
3058 * IPython/genutils.py (getoutputerror): added a function to
3038 capture separately the standard output and error of a command.
3059 capture separately the standard output and error of a command.
3039 After a comment from dang on the mailing lists. This code is
3060 After a comment from dang on the mailing lists. This code is
3040 basically a modified version of commands.getstatusoutput(), from
3061 basically a modified version of commands.getstatusoutput(), from
3041 the standard library.
3062 the standard library.
3042
3063
3043 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3064 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3044 '!!' as a special syntax (shorthand) to access @sx.
3065 '!!' as a special syntax (shorthand) to access @sx.
3045
3066
3046 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3067 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3047 command and return its output as a list split on '\n'.
3068 command and return its output as a list split on '\n'.
3048
3069
3049 2004-03-31 Fernando Perez <fperez@colorado.edu>
3070 2004-03-31 Fernando Perez <fperez@colorado.edu>
3050
3071
3051 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3072 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3052 method to dictionaries used as FakeModule instances if they lack
3073 method to dictionaries used as FakeModule instances if they lack
3053 it. At least pydoc in python2.3 breaks for runtime-defined
3074 it. At least pydoc in python2.3 breaks for runtime-defined
3054 functions without this hack. At some point I need to _really_
3075 functions without this hack. At some point I need to _really_
3055 understand what FakeModule is doing, because it's a gross hack.
3076 understand what FakeModule is doing, because it's a gross hack.
3056 But it solves Arnd's problem for now...
3077 But it solves Arnd's problem for now...
3057
3078
3058 2004-02-27 Fernando Perez <fperez@colorado.edu>
3079 2004-02-27 Fernando Perez <fperez@colorado.edu>
3059
3080
3060 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3081 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3061 mode would behave erratically. Also increased the number of
3082 mode would behave erratically. Also increased the number of
3062 possible logs in rotate mod to 999. Thanks to Rod Holland
3083 possible logs in rotate mod to 999. Thanks to Rod Holland
3063 <rhh@StructureLABS.com> for the report and fixes.
3084 <rhh@StructureLABS.com> for the report and fixes.
3064
3085
3065 2004-02-26 Fernando Perez <fperez@colorado.edu>
3086 2004-02-26 Fernando Perez <fperez@colorado.edu>
3066
3087
3067 * IPython/genutils.py (page): Check that the curses module really
3088 * IPython/genutils.py (page): Check that the curses module really
3068 has the initscr attribute before trying to use it. For some
3089 has the initscr attribute before trying to use it. For some
3069 reason, the Solaris curses module is missing this. I think this
3090 reason, the Solaris curses module is missing this. I think this
3070 should be considered a Solaris python bug, but I'm not sure.
3091 should be considered a Solaris python bug, but I'm not sure.
3071
3092
3072 2004-01-17 Fernando Perez <fperez@colorado.edu>
3093 2004-01-17 Fernando Perez <fperez@colorado.edu>
3073
3094
3074 * IPython/genutils.py (Stream.__init__): Changes to try to make
3095 * IPython/genutils.py (Stream.__init__): Changes to try to make
3075 ipython robust against stdin/out/err being closed by the user.
3096 ipython robust against stdin/out/err being closed by the user.
3076 This is 'user error' (and blocks a normal python session, at least
3097 This is 'user error' (and blocks a normal python session, at least
3077 the stdout case). However, Ipython should be able to survive such
3098 the stdout case). However, Ipython should be able to survive such
3078 instances of abuse as gracefully as possible. To simplify the
3099 instances of abuse as gracefully as possible. To simplify the
3079 coding and maintain compatibility with Gary Bishop's Term
3100 coding and maintain compatibility with Gary Bishop's Term
3080 contributions, I've made use of classmethods for this. I think
3101 contributions, I've made use of classmethods for this. I think
3081 this introduces a dependency on python 2.2.
3102 this introduces a dependency on python 2.2.
3082
3103
3083 2004-01-13 Fernando Perez <fperez@colorado.edu>
3104 2004-01-13 Fernando Perez <fperez@colorado.edu>
3084
3105
3085 * IPython/numutils.py (exp_safe): simplified the code a bit and
3106 * IPython/numutils.py (exp_safe): simplified the code a bit and
3086 removed the need for importing the kinds module altogether.
3107 removed the need for importing the kinds module altogether.
3087
3108
3088 2004-01-06 Fernando Perez <fperez@colorado.edu>
3109 2004-01-06 Fernando Perez <fperez@colorado.edu>
3089
3110
3090 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3111 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3091 a magic function instead, after some community feedback. No
3112 a magic function instead, after some community feedback. No
3092 special syntax will exist for it, but its name is deliberately
3113 special syntax will exist for it, but its name is deliberately
3093 very short.
3114 very short.
3094
3115
3095 2003-12-20 Fernando Perez <fperez@colorado.edu>
3116 2003-12-20 Fernando Perez <fperez@colorado.edu>
3096
3117
3097 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3118 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3098 new functionality, to automagically assign the result of a shell
3119 new functionality, to automagically assign the result of a shell
3099 command to a variable. I'll solicit some community feedback on
3120 command to a variable. I'll solicit some community feedback on
3100 this before making it permanent.
3121 this before making it permanent.
3101
3122
3102 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3123 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3103 requested about callables for which inspect couldn't obtain a
3124 requested about callables for which inspect couldn't obtain a
3104 proper argspec. Thanks to a crash report sent by Etienne
3125 proper argspec. Thanks to a crash report sent by Etienne
3105 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3126 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3106
3127
3107 2003-12-09 Fernando Perez <fperez@colorado.edu>
3128 2003-12-09 Fernando Perez <fperez@colorado.edu>
3108
3129
3109 * IPython/genutils.py (page): patch for the pager to work across
3130 * IPython/genutils.py (page): patch for the pager to work across
3110 various versions of Windows. By Gary Bishop.
3131 various versions of Windows. By Gary Bishop.
3111
3132
3112 2003-12-04 Fernando Perez <fperez@colorado.edu>
3133 2003-12-04 Fernando Perez <fperez@colorado.edu>
3113
3134
3114 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3135 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3115 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3136 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3116 While I tested this and it looks ok, there may still be corner
3137 While I tested this and it looks ok, there may still be corner
3117 cases I've missed.
3138 cases I've missed.
3118
3139
3119 2003-12-01 Fernando Perez <fperez@colorado.edu>
3140 2003-12-01 Fernando Perez <fperez@colorado.edu>
3120
3141
3121 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3142 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3122 where a line like 'p,q=1,2' would fail because the automagic
3143 where a line like 'p,q=1,2' would fail because the automagic
3123 system would be triggered for @p.
3144 system would be triggered for @p.
3124
3145
3125 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3146 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3126 cleanups, code unmodified.
3147 cleanups, code unmodified.
3127
3148
3128 * IPython/genutils.py (Term): added a class for IPython to handle
3149 * IPython/genutils.py (Term): added a class for IPython to handle
3129 output. In most cases it will just be a proxy for stdout/err, but
3150 output. In most cases it will just be a proxy for stdout/err, but
3130 having this allows modifications to be made for some platforms,
3151 having this allows modifications to be made for some platforms,
3131 such as handling color escapes under Windows. All of this code
3152 such as handling color escapes under Windows. All of this code
3132 was contributed by Gary Bishop, with minor modifications by me.
3153 was contributed by Gary Bishop, with minor modifications by me.
3133 The actual changes affect many files.
3154 The actual changes affect many files.
3134
3155
3135 2003-11-30 Fernando Perez <fperez@colorado.edu>
3156 2003-11-30 Fernando Perez <fperez@colorado.edu>
3136
3157
3137 * IPython/iplib.py (file_matches): new completion code, courtesy
3158 * IPython/iplib.py (file_matches): new completion code, courtesy
3138 of Jeff Collins. This enables filename completion again under
3159 of Jeff Collins. This enables filename completion again under
3139 python 2.3, which disabled it at the C level.
3160 python 2.3, which disabled it at the C level.
3140
3161
3141 2003-11-11 Fernando Perez <fperez@colorado.edu>
3162 2003-11-11 Fernando Perez <fperez@colorado.edu>
3142
3163
3143 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3164 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3144 for Numeric.array(map(...)), but often convenient.
3165 for Numeric.array(map(...)), but often convenient.
3145
3166
3146 2003-11-05 Fernando Perez <fperez@colorado.edu>
3167 2003-11-05 Fernando Perez <fperez@colorado.edu>
3147
3168
3148 * IPython/numutils.py (frange): Changed a call from int() to
3169 * IPython/numutils.py (frange): Changed a call from int() to
3149 int(round()) to prevent a problem reported with arange() in the
3170 int(round()) to prevent a problem reported with arange() in the
3150 numpy list.
3171 numpy list.
3151
3172
3152 2003-10-06 Fernando Perez <fperez@colorado.edu>
3173 2003-10-06 Fernando Perez <fperez@colorado.edu>
3153
3174
3154 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3175 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3155 prevent crashes if sys lacks an argv attribute (it happens with
3176 prevent crashes if sys lacks an argv attribute (it happens with
3156 embedded interpreters which build a bare-bones sys module).
3177 embedded interpreters which build a bare-bones sys module).
3157 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3178 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3158
3179
3159 2003-09-24 Fernando Perez <fperez@colorado.edu>
3180 2003-09-24 Fernando Perez <fperez@colorado.edu>
3160
3181
3161 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3182 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3162 to protect against poorly written user objects where __getattr__
3183 to protect against poorly written user objects where __getattr__
3163 raises exceptions other than AttributeError. Thanks to a bug
3184 raises exceptions other than AttributeError. Thanks to a bug
3164 report by Oliver Sander <osander-AT-gmx.de>.
3185 report by Oliver Sander <osander-AT-gmx.de>.
3165
3186
3166 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3187 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3167 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3188 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3168
3189
3169 2003-09-09 Fernando Perez <fperez@colorado.edu>
3190 2003-09-09 Fernando Perez <fperez@colorado.edu>
3170
3191
3171 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3192 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3172 unpacking a list whith a callable as first element would
3193 unpacking a list whith a callable as first element would
3173 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3194 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3174 Collins.
3195 Collins.
3175
3196
3176 2003-08-25 *** Released version 0.5.0
3197 2003-08-25 *** Released version 0.5.0
3177
3198
3178 2003-08-22 Fernando Perez <fperez@colorado.edu>
3199 2003-08-22 Fernando Perez <fperez@colorado.edu>
3179
3200
3180 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3201 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3181 improperly defined user exceptions. Thanks to feedback from Mark
3202 improperly defined user exceptions. Thanks to feedback from Mark
3182 Russell <mrussell-AT-verio.net>.
3203 Russell <mrussell-AT-verio.net>.
3183
3204
3184 2003-08-20 Fernando Perez <fperez@colorado.edu>
3205 2003-08-20 Fernando Perez <fperez@colorado.edu>
3185
3206
3186 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3207 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3187 printing so that it would print multi-line string forms starting
3208 printing so that it would print multi-line string forms starting
3188 with a new line. This way the formatting is better respected for
3209 with a new line. This way the formatting is better respected for
3189 objects which work hard to make nice string forms.
3210 objects which work hard to make nice string forms.
3190
3211
3191 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3212 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3192 autocall would overtake data access for objects with both
3213 autocall would overtake data access for objects with both
3193 __getitem__ and __call__.
3214 __getitem__ and __call__.
3194
3215
3195 2003-08-19 *** Released version 0.5.0-rc1
3216 2003-08-19 *** Released version 0.5.0-rc1
3196
3217
3197 2003-08-19 Fernando Perez <fperez@colorado.edu>
3218 2003-08-19 Fernando Perez <fperez@colorado.edu>
3198
3219
3199 * IPython/deep_reload.py (load_tail): single tiny change here
3220 * IPython/deep_reload.py (load_tail): single tiny change here
3200 seems to fix the long-standing bug of dreload() failing to work
3221 seems to fix the long-standing bug of dreload() failing to work
3201 for dotted names. But this module is pretty tricky, so I may have
3222 for dotted names. But this module is pretty tricky, so I may have
3202 missed some subtlety. Needs more testing!.
3223 missed some subtlety. Needs more testing!.
3203
3224
3204 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3225 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3205 exceptions which have badly implemented __str__ methods.
3226 exceptions which have badly implemented __str__ methods.
3206 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3227 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3207 which I've been getting reports about from Python 2.3 users. I
3228 which I've been getting reports about from Python 2.3 users. I
3208 wish I had a simple test case to reproduce the problem, so I could
3229 wish I had a simple test case to reproduce the problem, so I could
3209 either write a cleaner workaround or file a bug report if
3230 either write a cleaner workaround or file a bug report if
3210 necessary.
3231 necessary.
3211
3232
3212 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3233 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3213 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3234 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3214 a bug report by Tjabo Kloppenburg.
3235 a bug report by Tjabo Kloppenburg.
3215
3236
3216 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3237 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3217 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3238 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3218 seems rather unstable. Thanks to a bug report by Tjabo
3239 seems rather unstable. Thanks to a bug report by Tjabo
3219 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3240 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3220
3241
3221 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3242 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3222 this out soon because of the critical fixes in the inner loop for
3243 this out soon because of the critical fixes in the inner loop for
3223 generators.
3244 generators.
3224
3245
3225 * IPython/Magic.py (Magic.getargspec): removed. This (and
3246 * IPython/Magic.py (Magic.getargspec): removed. This (and
3226 _get_def) have been obsoleted by OInspect for a long time, I
3247 _get_def) have been obsoleted by OInspect for a long time, I
3227 hadn't noticed that they were dead code.
3248 hadn't noticed that they were dead code.
3228 (Magic._ofind): restored _ofind functionality for a few literals
3249 (Magic._ofind): restored _ofind functionality for a few literals
3229 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3250 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3230 for things like "hello".capitalize?, since that would require a
3251 for things like "hello".capitalize?, since that would require a
3231 potentially dangerous eval() again.
3252 potentially dangerous eval() again.
3232
3253
3233 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3254 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3234 logic a bit more to clean up the escapes handling and minimize the
3255 logic a bit more to clean up the escapes handling and minimize the
3235 use of _ofind to only necessary cases. The interactive 'feel' of
3256 use of _ofind to only necessary cases. The interactive 'feel' of
3236 IPython should have improved quite a bit with the changes in
3257 IPython should have improved quite a bit with the changes in
3237 _prefilter and _ofind (besides being far safer than before).
3258 _prefilter and _ofind (besides being far safer than before).
3238
3259
3239 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3260 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3240 obscure, never reported). Edit would fail to find the object to
3261 obscure, never reported). Edit would fail to find the object to
3241 edit under some circumstances.
3262 edit under some circumstances.
3242 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3263 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3243 which were causing double-calling of generators. Those eval calls
3264 which were causing double-calling of generators. Those eval calls
3244 were _very_ dangerous, since code with side effects could be
3265 were _very_ dangerous, since code with side effects could be
3245 triggered. As they say, 'eval is evil'... These were the
3266 triggered. As they say, 'eval is evil'... These were the
3246 nastiest evals in IPython. Besides, _ofind is now far simpler,
3267 nastiest evals in IPython. Besides, _ofind is now far simpler,
3247 and it should also be quite a bit faster. Its use of inspect is
3268 and it should also be quite a bit faster. Its use of inspect is
3248 also safer, so perhaps some of the inspect-related crashes I've
3269 also safer, so perhaps some of the inspect-related crashes I've
3249 seen lately with Python 2.3 might be taken care of. That will
3270 seen lately with Python 2.3 might be taken care of. That will
3250 need more testing.
3271 need more testing.
3251
3272
3252 2003-08-17 Fernando Perez <fperez@colorado.edu>
3273 2003-08-17 Fernando Perez <fperez@colorado.edu>
3253
3274
3254 * IPython/iplib.py (InteractiveShell._prefilter): significant
3275 * IPython/iplib.py (InteractiveShell._prefilter): significant
3255 simplifications to the logic for handling user escapes. Faster
3276 simplifications to the logic for handling user escapes. Faster
3256 and simpler code.
3277 and simpler code.
3257
3278
3258 2003-08-14 Fernando Perez <fperez@colorado.edu>
3279 2003-08-14 Fernando Perez <fperez@colorado.edu>
3259
3280
3260 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3281 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3261 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3282 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3262 but it should be quite a bit faster. And the recursive version
3283 but it should be quite a bit faster. And the recursive version
3263 generated O(log N) intermediate storage for all rank>1 arrays,
3284 generated O(log N) intermediate storage for all rank>1 arrays,
3264 even if they were contiguous.
3285 even if they were contiguous.
3265 (l1norm): Added this function.
3286 (l1norm): Added this function.
3266 (norm): Added this function for arbitrary norms (including
3287 (norm): Added this function for arbitrary norms (including
3267 l-infinity). l1 and l2 are still special cases for convenience
3288 l-infinity). l1 and l2 are still special cases for convenience
3268 and speed.
3289 and speed.
3269
3290
3270 2003-08-03 Fernando Perez <fperez@colorado.edu>
3291 2003-08-03 Fernando Perez <fperez@colorado.edu>
3271
3292
3272 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3293 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3273 exceptions, which now raise PendingDeprecationWarnings in Python
3294 exceptions, which now raise PendingDeprecationWarnings in Python
3274 2.3. There were some in Magic and some in Gnuplot2.
3295 2.3. There were some in Magic and some in Gnuplot2.
3275
3296
3276 2003-06-30 Fernando Perez <fperez@colorado.edu>
3297 2003-06-30 Fernando Perez <fperez@colorado.edu>
3277
3298
3278 * IPython/genutils.py (page): modified to call curses only for
3299 * IPython/genutils.py (page): modified to call curses only for
3279 terminals where TERM=='xterm'. After problems under many other
3300 terminals where TERM=='xterm'. After problems under many other
3280 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3301 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3281
3302
3282 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3303 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3283 would be triggered when readline was absent. This was just an old
3304 would be triggered when readline was absent. This was just an old
3284 debugging statement I'd forgotten to take out.
3305 debugging statement I'd forgotten to take out.
3285
3306
3286 2003-06-20 Fernando Perez <fperez@colorado.edu>
3307 2003-06-20 Fernando Perez <fperez@colorado.edu>
3287
3308
3288 * IPython/genutils.py (clock): modified to return only user time
3309 * IPython/genutils.py (clock): modified to return only user time
3289 (not counting system time), after a discussion on scipy. While
3310 (not counting system time), after a discussion on scipy. While
3290 system time may be a useful quantity occasionally, it may much
3311 system time may be a useful quantity occasionally, it may much
3291 more easily be skewed by occasional swapping or other similar
3312 more easily be skewed by occasional swapping or other similar
3292 activity.
3313 activity.
3293
3314
3294 2003-06-05 Fernando Perez <fperez@colorado.edu>
3315 2003-06-05 Fernando Perez <fperez@colorado.edu>
3295
3316
3296 * IPython/numutils.py (identity): new function, for building
3317 * IPython/numutils.py (identity): new function, for building
3297 arbitrary rank Kronecker deltas (mostly backwards compatible with
3318 arbitrary rank Kronecker deltas (mostly backwards compatible with
3298 Numeric.identity)
3319 Numeric.identity)
3299
3320
3300 2003-06-03 Fernando Perez <fperez@colorado.edu>
3321 2003-06-03 Fernando Perez <fperez@colorado.edu>
3301
3322
3302 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3323 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3303 arguments passed to magics with spaces, to allow trailing '\' to
3324 arguments passed to magics with spaces, to allow trailing '\' to
3304 work normally (mainly for Windows users).
3325 work normally (mainly for Windows users).
3305
3326
3306 2003-05-29 Fernando Perez <fperez@colorado.edu>
3327 2003-05-29 Fernando Perez <fperez@colorado.edu>
3307
3328
3308 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3329 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3309 instead of pydoc.help. This fixes a bizarre behavior where
3330 instead of pydoc.help. This fixes a bizarre behavior where
3310 printing '%s' % locals() would trigger the help system. Now
3331 printing '%s' % locals() would trigger the help system. Now
3311 ipython behaves like normal python does.
3332 ipython behaves like normal python does.
3312
3333
3313 Note that if one does 'from pydoc import help', the bizarre
3334 Note that if one does 'from pydoc import help', the bizarre
3314 behavior returns, but this will also happen in normal python, so
3335 behavior returns, but this will also happen in normal python, so
3315 it's not an ipython bug anymore (it has to do with how pydoc.help
3336 it's not an ipython bug anymore (it has to do with how pydoc.help
3316 is implemented).
3337 is implemented).
3317
3338
3318 2003-05-22 Fernando Perez <fperez@colorado.edu>
3339 2003-05-22 Fernando Perez <fperez@colorado.edu>
3319
3340
3320 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3341 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3321 return [] instead of None when nothing matches, also match to end
3342 return [] instead of None when nothing matches, also match to end
3322 of line. Patch by Gary Bishop.
3343 of line. Patch by Gary Bishop.
3323
3344
3324 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3345 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3325 protection as before, for files passed on the command line. This
3346 protection as before, for files passed on the command line. This
3326 prevents the CrashHandler from kicking in if user files call into
3347 prevents the CrashHandler from kicking in if user files call into
3327 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3348 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3328 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3349 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3329
3350
3330 2003-05-20 *** Released version 0.4.0
3351 2003-05-20 *** Released version 0.4.0
3331
3352
3332 2003-05-20 Fernando Perez <fperez@colorado.edu>
3353 2003-05-20 Fernando Perez <fperez@colorado.edu>
3333
3354
3334 * setup.py: added support for manpages. It's a bit hackish b/c of
3355 * setup.py: added support for manpages. It's a bit hackish b/c of
3335 a bug in the way the bdist_rpm distutils target handles gzipped
3356 a bug in the way the bdist_rpm distutils target handles gzipped
3336 manpages, but it works. After a patch by Jack.
3357 manpages, but it works. After a patch by Jack.
3337
3358
3338 2003-05-19 Fernando Perez <fperez@colorado.edu>
3359 2003-05-19 Fernando Perez <fperez@colorado.edu>
3339
3360
3340 * IPython/numutils.py: added a mockup of the kinds module, since
3361 * IPython/numutils.py: added a mockup of the kinds module, since
3341 it was recently removed from Numeric. This way, numutils will
3362 it was recently removed from Numeric. This way, numutils will
3342 work for all users even if they are missing kinds.
3363 work for all users even if they are missing kinds.
3343
3364
3344 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3365 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3345 failure, which can occur with SWIG-wrapped extensions. After a
3366 failure, which can occur with SWIG-wrapped extensions. After a
3346 crash report from Prabhu.
3367 crash report from Prabhu.
3347
3368
3348 2003-05-16 Fernando Perez <fperez@colorado.edu>
3369 2003-05-16 Fernando Perez <fperez@colorado.edu>
3349
3370
3350 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3371 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3351 protect ipython from user code which may call directly
3372 protect ipython from user code which may call directly
3352 sys.excepthook (this looks like an ipython crash to the user, even
3373 sys.excepthook (this looks like an ipython crash to the user, even
3353 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3374 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3354 This is especially important to help users of WxWindows, but may
3375 This is especially important to help users of WxWindows, but may
3355 also be useful in other cases.
3376 also be useful in other cases.
3356
3377
3357 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3378 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3358 an optional tb_offset to be specified, and to preserve exception
3379 an optional tb_offset to be specified, and to preserve exception
3359 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3380 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3360
3381
3361 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3382 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3362
3383
3363 2003-05-15 Fernando Perez <fperez@colorado.edu>
3384 2003-05-15 Fernando Perez <fperez@colorado.edu>
3364
3385
3365 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3386 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3366 installing for a new user under Windows.
3387 installing for a new user under Windows.
3367
3388
3368 2003-05-12 Fernando Perez <fperez@colorado.edu>
3389 2003-05-12 Fernando Perez <fperez@colorado.edu>
3369
3390
3370 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3391 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3371 handler for Emacs comint-based lines. Currently it doesn't do
3392 handler for Emacs comint-based lines. Currently it doesn't do
3372 much (but importantly, it doesn't update the history cache). In
3393 much (but importantly, it doesn't update the history cache). In
3373 the future it may be expanded if Alex needs more functionality
3394 the future it may be expanded if Alex needs more functionality
3374 there.
3395 there.
3375
3396
3376 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3397 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3377 info to crash reports.
3398 info to crash reports.
3378
3399
3379 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3400 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3380 just like Python's -c. Also fixed crash with invalid -color
3401 just like Python's -c. Also fixed crash with invalid -color
3381 option value at startup. Thanks to Will French
3402 option value at startup. Thanks to Will French
3382 <wfrench-AT-bestweb.net> for the bug report.
3403 <wfrench-AT-bestweb.net> for the bug report.
3383
3404
3384 2003-05-09 Fernando Perez <fperez@colorado.edu>
3405 2003-05-09 Fernando Perez <fperez@colorado.edu>
3385
3406
3386 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3407 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3387 to EvalDict (it's a mapping, after all) and simplified its code
3408 to EvalDict (it's a mapping, after all) and simplified its code
3388 quite a bit, after a nice discussion on c.l.py where Gustavo
3409 quite a bit, after a nice discussion on c.l.py where Gustavo
3389 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3410 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3390
3411
3391 2003-04-30 Fernando Perez <fperez@colorado.edu>
3412 2003-04-30 Fernando Perez <fperez@colorado.edu>
3392
3413
3393 * IPython/genutils.py (timings_out): modified it to reduce its
3414 * IPython/genutils.py (timings_out): modified it to reduce its
3394 overhead in the common reps==1 case.
3415 overhead in the common reps==1 case.
3395
3416
3396 2003-04-29 Fernando Perez <fperez@colorado.edu>
3417 2003-04-29 Fernando Perez <fperez@colorado.edu>
3397
3418
3398 * IPython/genutils.py (timings_out): Modified to use the resource
3419 * IPython/genutils.py (timings_out): Modified to use the resource
3399 module, which avoids the wraparound problems of time.clock().
3420 module, which avoids the wraparound problems of time.clock().
3400
3421
3401 2003-04-17 *** Released version 0.2.15pre4
3422 2003-04-17 *** Released version 0.2.15pre4
3402
3423
3403 2003-04-17 Fernando Perez <fperez@colorado.edu>
3424 2003-04-17 Fernando Perez <fperez@colorado.edu>
3404
3425
3405 * setup.py (scriptfiles): Split windows-specific stuff over to a
3426 * setup.py (scriptfiles): Split windows-specific stuff over to a
3406 separate file, in an attempt to have a Windows GUI installer.
3427 separate file, in an attempt to have a Windows GUI installer.
3407 That didn't work, but part of the groundwork is done.
3428 That didn't work, but part of the groundwork is done.
3408
3429
3409 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3430 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3410 indent/unindent with 4 spaces. Particularly useful in combination
3431 indent/unindent with 4 spaces. Particularly useful in combination
3411 with the new auto-indent option.
3432 with the new auto-indent option.
3412
3433
3413 2003-04-16 Fernando Perez <fperez@colorado.edu>
3434 2003-04-16 Fernando Perez <fperez@colorado.edu>
3414
3435
3415 * IPython/Magic.py: various replacements of self.rc for
3436 * IPython/Magic.py: various replacements of self.rc for
3416 self.shell.rc. A lot more remains to be done to fully disentangle
3437 self.shell.rc. A lot more remains to be done to fully disentangle
3417 this class from the main Shell class.
3438 this class from the main Shell class.
3418
3439
3419 * IPython/GnuplotRuntime.py: added checks for mouse support so
3440 * IPython/GnuplotRuntime.py: added checks for mouse support so
3420 that we don't try to enable it if the current gnuplot doesn't
3441 that we don't try to enable it if the current gnuplot doesn't
3421 really support it. Also added checks so that we don't try to
3442 really support it. Also added checks so that we don't try to
3422 enable persist under Windows (where Gnuplot doesn't recognize the
3443 enable persist under Windows (where Gnuplot doesn't recognize the
3423 option).
3444 option).
3424
3445
3425 * IPython/iplib.py (InteractiveShell.interact): Added optional
3446 * IPython/iplib.py (InteractiveShell.interact): Added optional
3426 auto-indenting code, after a patch by King C. Shu
3447 auto-indenting code, after a patch by King C. Shu
3427 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3448 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3428 get along well with pasting indented code. If I ever figure out
3449 get along well with pasting indented code. If I ever figure out
3429 how to make that part go well, it will become on by default.
3450 how to make that part go well, it will become on by default.
3430
3451
3431 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3452 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3432 crash ipython if there was an unmatched '%' in the user's prompt
3453 crash ipython if there was an unmatched '%' in the user's prompt
3433 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3454 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3434
3455
3435 * IPython/iplib.py (InteractiveShell.interact): removed the
3456 * IPython/iplib.py (InteractiveShell.interact): removed the
3436 ability to ask the user whether he wants to crash or not at the
3457 ability to ask the user whether he wants to crash or not at the
3437 'last line' exception handler. Calling functions at that point
3458 'last line' exception handler. Calling functions at that point
3438 changes the stack, and the error reports would have incorrect
3459 changes the stack, and the error reports would have incorrect
3439 tracebacks.
3460 tracebacks.
3440
3461
3441 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3462 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3442 pass through a peger a pretty-printed form of any object. After a
3463 pass through a peger a pretty-printed form of any object. After a
3443 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3464 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3444
3465
3445 2003-04-14 Fernando Perez <fperez@colorado.edu>
3466 2003-04-14 Fernando Perez <fperez@colorado.edu>
3446
3467
3447 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3468 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3448 all files in ~ would be modified at first install (instead of
3469 all files in ~ would be modified at first install (instead of
3449 ~/.ipython). This could be potentially disastrous, as the
3470 ~/.ipython). This could be potentially disastrous, as the
3450 modification (make line-endings native) could damage binary files.
3471 modification (make line-endings native) could damage binary files.
3451
3472
3452 2003-04-10 Fernando Perez <fperez@colorado.edu>
3473 2003-04-10 Fernando Perez <fperez@colorado.edu>
3453
3474
3454 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3475 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3455 handle only lines which are invalid python. This now means that
3476 handle only lines which are invalid python. This now means that
3456 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3477 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3457 for the bug report.
3478 for the bug report.
3458
3479
3459 2003-04-01 Fernando Perez <fperez@colorado.edu>
3480 2003-04-01 Fernando Perez <fperez@colorado.edu>
3460
3481
3461 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3482 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3462 where failing to set sys.last_traceback would crash pdb.pm().
3483 where failing to set sys.last_traceback would crash pdb.pm().
3463 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3484 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3464 report.
3485 report.
3465
3486
3466 2003-03-25 Fernando Perez <fperez@colorado.edu>
3487 2003-03-25 Fernando Perez <fperez@colorado.edu>
3467
3488
3468 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3489 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3469 before printing it (it had a lot of spurious blank lines at the
3490 before printing it (it had a lot of spurious blank lines at the
3470 end).
3491 end).
3471
3492
3472 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3493 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3473 output would be sent 21 times! Obviously people don't use this
3494 output would be sent 21 times! Obviously people don't use this
3474 too often, or I would have heard about it.
3495 too often, or I would have heard about it.
3475
3496
3476 2003-03-24 Fernando Perez <fperez@colorado.edu>
3497 2003-03-24 Fernando Perez <fperez@colorado.edu>
3477
3498
3478 * setup.py (scriptfiles): renamed the data_files parameter from
3499 * setup.py (scriptfiles): renamed the data_files parameter from
3479 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3500 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3480 for the patch.
3501 for the patch.
3481
3502
3482 2003-03-20 Fernando Perez <fperez@colorado.edu>
3503 2003-03-20 Fernando Perez <fperez@colorado.edu>
3483
3504
3484 * IPython/genutils.py (error): added error() and fatal()
3505 * IPython/genutils.py (error): added error() and fatal()
3485 functions.
3506 functions.
3486
3507
3487 2003-03-18 *** Released version 0.2.15pre3
3508 2003-03-18 *** Released version 0.2.15pre3
3488
3509
3489 2003-03-18 Fernando Perez <fperez@colorado.edu>
3510 2003-03-18 Fernando Perez <fperez@colorado.edu>
3490
3511
3491 * setupext/install_data_ext.py
3512 * setupext/install_data_ext.py
3492 (install_data_ext.initialize_options): Class contributed by Jack
3513 (install_data_ext.initialize_options): Class contributed by Jack
3493 Moffit for fixing the old distutils hack. He is sending this to
3514 Moffit for fixing the old distutils hack. He is sending this to
3494 the distutils folks so in the future we may not need it as a
3515 the distutils folks so in the future we may not need it as a
3495 private fix.
3516 private fix.
3496
3517
3497 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3518 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3498 changes for Debian packaging. See his patch for full details.
3519 changes for Debian packaging. See his patch for full details.
3499 The old distutils hack of making the ipythonrc* files carry a
3520 The old distutils hack of making the ipythonrc* files carry a
3500 bogus .py extension is gone, at last. Examples were moved to a
3521 bogus .py extension is gone, at last. Examples were moved to a
3501 separate subdir under doc/, and the separate executable scripts
3522 separate subdir under doc/, and the separate executable scripts
3502 now live in their own directory. Overall a great cleanup. The
3523 now live in their own directory. Overall a great cleanup. The
3503 manual was updated to use the new files, and setup.py has been
3524 manual was updated to use the new files, and setup.py has been
3504 fixed for this setup.
3525 fixed for this setup.
3505
3526
3506 * IPython/PyColorize.py (Parser.usage): made non-executable and
3527 * IPython/PyColorize.py (Parser.usage): made non-executable and
3507 created a pycolor wrapper around it to be included as a script.
3528 created a pycolor wrapper around it to be included as a script.
3508
3529
3509 2003-03-12 *** Released version 0.2.15pre2
3530 2003-03-12 *** Released version 0.2.15pre2
3510
3531
3511 2003-03-12 Fernando Perez <fperez@colorado.edu>
3532 2003-03-12 Fernando Perez <fperez@colorado.edu>
3512
3533
3513 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3534 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3514 long-standing problem with garbage characters in some terminals.
3535 long-standing problem with garbage characters in some terminals.
3515 The issue was really that the \001 and \002 escapes must _only_ be
3536 The issue was really that the \001 and \002 escapes must _only_ be
3516 passed to input prompts (which call readline), but _never_ to
3537 passed to input prompts (which call readline), but _never_ to
3517 normal text to be printed on screen. I changed ColorANSI to have
3538 normal text to be printed on screen. I changed ColorANSI to have
3518 two classes: TermColors and InputTermColors, each with the
3539 two classes: TermColors and InputTermColors, each with the
3519 appropriate escapes for input prompts or normal text. The code in
3540 appropriate escapes for input prompts or normal text. The code in
3520 Prompts.py got slightly more complicated, but this very old and
3541 Prompts.py got slightly more complicated, but this very old and
3521 annoying bug is finally fixed.
3542 annoying bug is finally fixed.
3522
3543
3523 All the credit for nailing down the real origin of this problem
3544 All the credit for nailing down the real origin of this problem
3524 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3545 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3525 *Many* thanks to him for spending quite a bit of effort on this.
3546 *Many* thanks to him for spending quite a bit of effort on this.
3526
3547
3527 2003-03-05 *** Released version 0.2.15pre1
3548 2003-03-05 *** Released version 0.2.15pre1
3528
3549
3529 2003-03-03 Fernando Perez <fperez@colorado.edu>
3550 2003-03-03 Fernando Perez <fperez@colorado.edu>
3530
3551
3531 * IPython/FakeModule.py: Moved the former _FakeModule to a
3552 * IPython/FakeModule.py: Moved the former _FakeModule to a
3532 separate file, because it's also needed by Magic (to fix a similar
3553 separate file, because it's also needed by Magic (to fix a similar
3533 pickle-related issue in @run).
3554 pickle-related issue in @run).
3534
3555
3535 2003-03-02 Fernando Perez <fperez@colorado.edu>
3556 2003-03-02 Fernando Perez <fperez@colorado.edu>
3536
3557
3537 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3558 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3538 the autocall option at runtime.
3559 the autocall option at runtime.
3539 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3560 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3540 across Magic.py to start separating Magic from InteractiveShell.
3561 across Magic.py to start separating Magic from InteractiveShell.
3541 (Magic._ofind): Fixed to return proper namespace for dotted
3562 (Magic._ofind): Fixed to return proper namespace for dotted
3542 names. Before, a dotted name would always return 'not currently
3563 names. Before, a dotted name would always return 'not currently
3543 defined', because it would find the 'parent'. s.x would be found,
3564 defined', because it would find the 'parent'. s.x would be found,
3544 but since 'x' isn't defined by itself, it would get confused.
3565 but since 'x' isn't defined by itself, it would get confused.
3545 (Magic.magic_run): Fixed pickling problems reported by Ralf
3566 (Magic.magic_run): Fixed pickling problems reported by Ralf
3546 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3567 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3547 that I'd used when Mike Heeter reported similar issues at the
3568 that I'd used when Mike Heeter reported similar issues at the
3548 top-level, but now for @run. It boils down to injecting the
3569 top-level, but now for @run. It boils down to injecting the
3549 namespace where code is being executed with something that looks
3570 namespace where code is being executed with something that looks
3550 enough like a module to fool pickle.dump(). Since a pickle stores
3571 enough like a module to fool pickle.dump(). Since a pickle stores
3551 a named reference to the importing module, we need this for
3572 a named reference to the importing module, we need this for
3552 pickles to save something sensible.
3573 pickles to save something sensible.
3553
3574
3554 * IPython/ipmaker.py (make_IPython): added an autocall option.
3575 * IPython/ipmaker.py (make_IPython): added an autocall option.
3555
3576
3556 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3577 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3557 the auto-eval code. Now autocalling is an option, and the code is
3578 the auto-eval code. Now autocalling is an option, and the code is
3558 also vastly safer. There is no more eval() involved at all.
3579 also vastly safer. There is no more eval() involved at all.
3559
3580
3560 2003-03-01 Fernando Perez <fperez@colorado.edu>
3581 2003-03-01 Fernando Perez <fperez@colorado.edu>
3561
3582
3562 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3583 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3563 dict with named keys instead of a tuple.
3584 dict with named keys instead of a tuple.
3564
3585
3565 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3586 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3566
3587
3567 * setup.py (make_shortcut): Fixed message about directories
3588 * setup.py (make_shortcut): Fixed message about directories
3568 created during Windows installation (the directories were ok, just
3589 created during Windows installation (the directories were ok, just
3569 the printed message was misleading). Thanks to Chris Liechti
3590 the printed message was misleading). Thanks to Chris Liechti
3570 <cliechti-AT-gmx.net> for the heads up.
3591 <cliechti-AT-gmx.net> for the heads up.
3571
3592
3572 2003-02-21 Fernando Perez <fperez@colorado.edu>
3593 2003-02-21 Fernando Perez <fperez@colorado.edu>
3573
3594
3574 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3595 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3575 of ValueError exception when checking for auto-execution. This
3596 of ValueError exception when checking for auto-execution. This
3576 one is raised by things like Numeric arrays arr.flat when the
3597 one is raised by things like Numeric arrays arr.flat when the
3577 array is non-contiguous.
3598 array is non-contiguous.
3578
3599
3579 2003-01-31 Fernando Perez <fperez@colorado.edu>
3600 2003-01-31 Fernando Perez <fperez@colorado.edu>
3580
3601
3581 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3602 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3582 not return any value at all (even though the command would get
3603 not return any value at all (even though the command would get
3583 executed).
3604 executed).
3584 (xsys): Flush stdout right after printing the command to ensure
3605 (xsys): Flush stdout right after printing the command to ensure
3585 proper ordering of commands and command output in the total
3606 proper ordering of commands and command output in the total
3586 output.
3607 output.
3587 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3608 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3588 system/getoutput as defaults. The old ones are kept for
3609 system/getoutput as defaults. The old ones are kept for
3589 compatibility reasons, so no code which uses this library needs
3610 compatibility reasons, so no code which uses this library needs
3590 changing.
3611 changing.
3591
3612
3592 2003-01-27 *** Released version 0.2.14
3613 2003-01-27 *** Released version 0.2.14
3593
3614
3594 2003-01-25 Fernando Perez <fperez@colorado.edu>
3615 2003-01-25 Fernando Perez <fperez@colorado.edu>
3595
3616
3596 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3617 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3597 functions defined in previous edit sessions could not be re-edited
3618 functions defined in previous edit sessions could not be re-edited
3598 (because the temp files were immediately removed). Now temp files
3619 (because the temp files were immediately removed). Now temp files
3599 are removed only at IPython's exit.
3620 are removed only at IPython's exit.
3600 (Magic.magic_run): Improved @run to perform shell-like expansions
3621 (Magic.magic_run): Improved @run to perform shell-like expansions
3601 on its arguments (~users and $VARS). With this, @run becomes more
3622 on its arguments (~users and $VARS). With this, @run becomes more
3602 like a normal command-line.
3623 like a normal command-line.
3603
3624
3604 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3625 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3605 bugs related to embedding and cleaned up that code. A fairly
3626 bugs related to embedding and cleaned up that code. A fairly
3606 important one was the impossibility to access the global namespace
3627 important one was the impossibility to access the global namespace
3607 through the embedded IPython (only local variables were visible).
3628 through the embedded IPython (only local variables were visible).
3608
3629
3609 2003-01-14 Fernando Perez <fperez@colorado.edu>
3630 2003-01-14 Fernando Perez <fperez@colorado.edu>
3610
3631
3611 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3632 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3612 auto-calling to be a bit more conservative. Now it doesn't get
3633 auto-calling to be a bit more conservative. Now it doesn't get
3613 triggered if any of '!=()<>' are in the rest of the input line, to
3634 triggered if any of '!=()<>' are in the rest of the input line, to
3614 allow comparing callables. Thanks to Alex for the heads up.
3635 allow comparing callables. Thanks to Alex for the heads up.
3615
3636
3616 2003-01-07 Fernando Perez <fperez@colorado.edu>
3637 2003-01-07 Fernando Perez <fperez@colorado.edu>
3617
3638
3618 * IPython/genutils.py (page): fixed estimation of the number of
3639 * IPython/genutils.py (page): fixed estimation of the number of
3619 lines in a string to be paged to simply count newlines. This
3640 lines in a string to be paged to simply count newlines. This
3620 prevents over-guessing due to embedded escape sequences. A better
3641 prevents over-guessing due to embedded escape sequences. A better
3621 long-term solution would involve stripping out the control chars
3642 long-term solution would involve stripping out the control chars
3622 for the count, but it's potentially so expensive I just don't
3643 for the count, but it's potentially so expensive I just don't
3623 think it's worth doing.
3644 think it's worth doing.
3624
3645
3625 2002-12-19 *** Released version 0.2.14pre50
3646 2002-12-19 *** Released version 0.2.14pre50
3626
3647
3627 2002-12-19 Fernando Perez <fperez@colorado.edu>
3648 2002-12-19 Fernando Perez <fperez@colorado.edu>
3628
3649
3629 * tools/release (version): Changed release scripts to inform
3650 * tools/release (version): Changed release scripts to inform
3630 Andrea and build a NEWS file with a list of recent changes.
3651 Andrea and build a NEWS file with a list of recent changes.
3631
3652
3632 * IPython/ColorANSI.py (__all__): changed terminal detection
3653 * IPython/ColorANSI.py (__all__): changed terminal detection
3633 code. Seems to work better for xterms without breaking
3654 code. Seems to work better for xterms without breaking
3634 konsole. Will need more testing to determine if WinXP and Mac OSX
3655 konsole. Will need more testing to determine if WinXP and Mac OSX
3635 also work ok.
3656 also work ok.
3636
3657
3637 2002-12-18 *** Released version 0.2.14pre49
3658 2002-12-18 *** Released version 0.2.14pre49
3638
3659
3639 2002-12-18 Fernando Perez <fperez@colorado.edu>
3660 2002-12-18 Fernando Perez <fperez@colorado.edu>
3640
3661
3641 * Docs: added new info about Mac OSX, from Andrea.
3662 * Docs: added new info about Mac OSX, from Andrea.
3642
3663
3643 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3664 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3644 allow direct plotting of python strings whose format is the same
3665 allow direct plotting of python strings whose format is the same
3645 of gnuplot data files.
3666 of gnuplot data files.
3646
3667
3647 2002-12-16 Fernando Perez <fperez@colorado.edu>
3668 2002-12-16 Fernando Perez <fperez@colorado.edu>
3648
3669
3649 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3670 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3650 value of exit question to be acknowledged.
3671 value of exit question to be acknowledged.
3651
3672
3652 2002-12-03 Fernando Perez <fperez@colorado.edu>
3673 2002-12-03 Fernando Perez <fperez@colorado.edu>
3653
3674
3654 * IPython/ipmaker.py: removed generators, which had been added
3675 * IPython/ipmaker.py: removed generators, which had been added
3655 by mistake in an earlier debugging run. This was causing trouble
3676 by mistake in an earlier debugging run. This was causing trouble
3656 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3677 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3657 for pointing this out.
3678 for pointing this out.
3658
3679
3659 2002-11-17 Fernando Perez <fperez@colorado.edu>
3680 2002-11-17 Fernando Perez <fperez@colorado.edu>
3660
3681
3661 * Manual: updated the Gnuplot section.
3682 * Manual: updated the Gnuplot section.
3662
3683
3663 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3684 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3664 a much better split of what goes in Runtime and what goes in
3685 a much better split of what goes in Runtime and what goes in
3665 Interactive.
3686 Interactive.
3666
3687
3667 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3688 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3668 being imported from iplib.
3689 being imported from iplib.
3669
3690
3670 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3691 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3671 for command-passing. Now the global Gnuplot instance is called
3692 for command-passing. Now the global Gnuplot instance is called
3672 'gp' instead of 'g', which was really a far too fragile and
3693 'gp' instead of 'g', which was really a far too fragile and
3673 common name.
3694 common name.
3674
3695
3675 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3696 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3676 bounding boxes generated by Gnuplot for square plots.
3697 bounding boxes generated by Gnuplot for square plots.
3677
3698
3678 * IPython/genutils.py (popkey): new function added. I should
3699 * IPython/genutils.py (popkey): new function added. I should
3679 suggest this on c.l.py as a dict method, it seems useful.
3700 suggest this on c.l.py as a dict method, it seems useful.
3680
3701
3681 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3702 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3682 to transparently handle PostScript generation. MUCH better than
3703 to transparently handle PostScript generation. MUCH better than
3683 the previous plot_eps/replot_eps (which I removed now). The code
3704 the previous plot_eps/replot_eps (which I removed now). The code
3684 is also fairly clean and well documented now (including
3705 is also fairly clean and well documented now (including
3685 docstrings).
3706 docstrings).
3686
3707
3687 2002-11-13 Fernando Perez <fperez@colorado.edu>
3708 2002-11-13 Fernando Perez <fperez@colorado.edu>
3688
3709
3689 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3710 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3690 (inconsistent with options).
3711 (inconsistent with options).
3691
3712
3692 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3713 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3693 manually disabled, I don't know why. Fixed it.
3714 manually disabled, I don't know why. Fixed it.
3694 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3715 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3695 eps output.
3716 eps output.
3696
3717
3697 2002-11-12 Fernando Perez <fperez@colorado.edu>
3718 2002-11-12 Fernando Perez <fperez@colorado.edu>
3698
3719
3699 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3720 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3700 don't propagate up to caller. Fixes crash reported by François
3721 don't propagate up to caller. Fixes crash reported by François
3701 Pinard.
3722 Pinard.
3702
3723
3703 2002-11-09 Fernando Perez <fperez@colorado.edu>
3724 2002-11-09 Fernando Perez <fperez@colorado.edu>
3704
3725
3705 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3726 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3706 history file for new users.
3727 history file for new users.
3707 (make_IPython): fixed bug where initial install would leave the
3728 (make_IPython): fixed bug where initial install would leave the
3708 user running in the .ipython dir.
3729 user running in the .ipython dir.
3709 (make_IPython): fixed bug where config dir .ipython would be
3730 (make_IPython): fixed bug where config dir .ipython would be
3710 created regardless of the given -ipythondir option. Thanks to Cory
3731 created regardless of the given -ipythondir option. Thanks to Cory
3711 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3732 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3712
3733
3713 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3734 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3714 type confirmations. Will need to use it in all of IPython's code
3735 type confirmations. Will need to use it in all of IPython's code
3715 consistently.
3736 consistently.
3716
3737
3717 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3738 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3718 context to print 31 lines instead of the default 5. This will make
3739 context to print 31 lines instead of the default 5. This will make
3719 the crash reports extremely detailed in case the problem is in
3740 the crash reports extremely detailed in case the problem is in
3720 libraries I don't have access to.
3741 libraries I don't have access to.
3721
3742
3722 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3743 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3723 line of defense' code to still crash, but giving users fair
3744 line of defense' code to still crash, but giving users fair
3724 warning. I don't want internal errors to go unreported: if there's
3745 warning. I don't want internal errors to go unreported: if there's
3725 an internal problem, IPython should crash and generate a full
3746 an internal problem, IPython should crash and generate a full
3726 report.
3747 report.
3727
3748
3728 2002-11-08 Fernando Perez <fperez@colorado.edu>
3749 2002-11-08 Fernando Perez <fperez@colorado.edu>
3729
3750
3730 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3751 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3731 otherwise uncaught exceptions which can appear if people set
3752 otherwise uncaught exceptions which can appear if people set
3732 sys.stdout to something badly broken. Thanks to a crash report
3753 sys.stdout to something badly broken. Thanks to a crash report
3733 from henni-AT-mail.brainbot.com.
3754 from henni-AT-mail.brainbot.com.
3734
3755
3735 2002-11-04 Fernando Perez <fperez@colorado.edu>
3756 2002-11-04 Fernando Perez <fperez@colorado.edu>
3736
3757
3737 * IPython/iplib.py (InteractiveShell.interact): added
3758 * IPython/iplib.py (InteractiveShell.interact): added
3738 __IPYTHON__active to the builtins. It's a flag which goes on when
3759 __IPYTHON__active to the builtins. It's a flag which goes on when
3739 the interaction starts and goes off again when it stops. This
3760 the interaction starts and goes off again when it stops. This
3740 allows embedding code to detect being inside IPython. Before this
3761 allows embedding code to detect being inside IPython. Before this
3741 was done via __IPYTHON__, but that only shows that an IPython
3762 was done via __IPYTHON__, but that only shows that an IPython
3742 instance has been created.
3763 instance has been created.
3743
3764
3744 * IPython/Magic.py (Magic.magic_env): I realized that in a
3765 * IPython/Magic.py (Magic.magic_env): I realized that in a
3745 UserDict, instance.data holds the data as a normal dict. So I
3766 UserDict, instance.data holds the data as a normal dict. So I
3746 modified @env to return os.environ.data instead of rebuilding a
3767 modified @env to return os.environ.data instead of rebuilding a
3747 dict by hand.
3768 dict by hand.
3748
3769
3749 2002-11-02 Fernando Perez <fperez@colorado.edu>
3770 2002-11-02 Fernando Perez <fperez@colorado.edu>
3750
3771
3751 * IPython/genutils.py (warn): changed so that level 1 prints no
3772 * IPython/genutils.py (warn): changed so that level 1 prints no
3752 header. Level 2 is now the default (with 'WARNING' header, as
3773 header. Level 2 is now the default (with 'WARNING' header, as
3753 before). I think I tracked all places where changes were needed in
3774 before). I think I tracked all places where changes were needed in
3754 IPython, but outside code using the old level numbering may have
3775 IPython, but outside code using the old level numbering may have
3755 broken.
3776 broken.
3756
3777
3757 * IPython/iplib.py (InteractiveShell.runcode): added this to
3778 * IPython/iplib.py (InteractiveShell.runcode): added this to
3758 handle the tracebacks in SystemExit traps correctly. The previous
3779 handle the tracebacks in SystemExit traps correctly. The previous
3759 code (through interact) was printing more of the stack than
3780 code (through interact) was printing more of the stack than
3760 necessary, showing IPython internal code to the user.
3781 necessary, showing IPython internal code to the user.
3761
3782
3762 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3783 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3763 default. Now that the default at the confirmation prompt is yes,
3784 default. Now that the default at the confirmation prompt is yes,
3764 it's not so intrusive. François' argument that ipython sessions
3785 it's not so intrusive. François' argument that ipython sessions
3765 tend to be complex enough not to lose them from an accidental C-d,
3786 tend to be complex enough not to lose them from an accidental C-d,
3766 is a valid one.
3787 is a valid one.
3767
3788
3768 * IPython/iplib.py (InteractiveShell.interact): added a
3789 * IPython/iplib.py (InteractiveShell.interact): added a
3769 showtraceback() call to the SystemExit trap, and modified the exit
3790 showtraceback() call to the SystemExit trap, and modified the exit
3770 confirmation to have yes as the default.
3791 confirmation to have yes as the default.
3771
3792
3772 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3793 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3773 this file. It's been gone from the code for a long time, this was
3794 this file. It's been gone from the code for a long time, this was
3774 simply leftover junk.
3795 simply leftover junk.
3775
3796
3776 2002-11-01 Fernando Perez <fperez@colorado.edu>
3797 2002-11-01 Fernando Perez <fperez@colorado.edu>
3777
3798
3778 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3799 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3779 added. If set, IPython now traps EOF and asks for
3800 added. If set, IPython now traps EOF and asks for
3780 confirmation. After a request by François Pinard.
3801 confirmation. After a request by François Pinard.
3781
3802
3782 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3803 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3783 of @abort, and with a new (better) mechanism for handling the
3804 of @abort, and with a new (better) mechanism for handling the
3784 exceptions.
3805 exceptions.
3785
3806
3786 2002-10-27 Fernando Perez <fperez@colorado.edu>
3807 2002-10-27 Fernando Perez <fperez@colorado.edu>
3787
3808
3788 * IPython/usage.py (__doc__): updated the --help information and
3809 * IPython/usage.py (__doc__): updated the --help information and
3789 the ipythonrc file to indicate that -log generates
3810 the ipythonrc file to indicate that -log generates
3790 ./ipython.log. Also fixed the corresponding info in @logstart.
3811 ./ipython.log. Also fixed the corresponding info in @logstart.
3791 This and several other fixes in the manuals thanks to reports by
3812 This and several other fixes in the manuals thanks to reports by
3792 François Pinard <pinard-AT-iro.umontreal.ca>.
3813 François Pinard <pinard-AT-iro.umontreal.ca>.
3793
3814
3794 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3815 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3795 refer to @logstart (instead of @log, which doesn't exist).
3816 refer to @logstart (instead of @log, which doesn't exist).
3796
3817
3797 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3818 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3798 AttributeError crash. Thanks to Christopher Armstrong
3819 AttributeError crash. Thanks to Christopher Armstrong
3799 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3820 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3800 introduced recently (in 0.2.14pre37) with the fix to the eval
3821 introduced recently (in 0.2.14pre37) with the fix to the eval
3801 problem mentioned below.
3822 problem mentioned below.
3802
3823
3803 2002-10-17 Fernando Perez <fperez@colorado.edu>
3824 2002-10-17 Fernando Perez <fperez@colorado.edu>
3804
3825
3805 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3826 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3806 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3827 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3807
3828
3808 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3829 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3809 this function to fix a problem reported by Alex Schmolck. He saw
3830 this function to fix a problem reported by Alex Schmolck. He saw
3810 it with list comprehensions and generators, which were getting
3831 it with list comprehensions and generators, which were getting
3811 called twice. The real problem was an 'eval' call in testing for
3832 called twice. The real problem was an 'eval' call in testing for
3812 automagic which was evaluating the input line silently.
3833 automagic which was evaluating the input line silently.
3813
3834
3814 This is a potentially very nasty bug, if the input has side
3835 This is a potentially very nasty bug, if the input has side
3815 effects which must not be repeated. The code is much cleaner now,
3836 effects which must not be repeated. The code is much cleaner now,
3816 without any blanket 'except' left and with a regexp test for
3837 without any blanket 'except' left and with a regexp test for
3817 actual function names.
3838 actual function names.
3818
3839
3819 But an eval remains, which I'm not fully comfortable with. I just
3840 But an eval remains, which I'm not fully comfortable with. I just
3820 don't know how to find out if an expression could be a callable in
3841 don't know how to find out if an expression could be a callable in
3821 the user's namespace without doing an eval on the string. However
3842 the user's namespace without doing an eval on the string. However
3822 that string is now much more strictly checked so that no code
3843 that string is now much more strictly checked so that no code
3823 slips by, so the eval should only happen for things that can
3844 slips by, so the eval should only happen for things that can
3824 really be only function/method names.
3845 really be only function/method names.
3825
3846
3826 2002-10-15 Fernando Perez <fperez@colorado.edu>
3847 2002-10-15 Fernando Perez <fperez@colorado.edu>
3827
3848
3828 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3849 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3829 OSX information to main manual, removed README_Mac_OSX file from
3850 OSX information to main manual, removed README_Mac_OSX file from
3830 distribution. Also updated credits for recent additions.
3851 distribution. Also updated credits for recent additions.
3831
3852
3832 2002-10-10 Fernando Perez <fperez@colorado.edu>
3853 2002-10-10 Fernando Perez <fperez@colorado.edu>
3833
3854
3834 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3855 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3835 terminal-related issues. Many thanks to Andrea Riciputi
3856 terminal-related issues. Many thanks to Andrea Riciputi
3836 <andrea.riciputi-AT-libero.it> for writing it.
3857 <andrea.riciputi-AT-libero.it> for writing it.
3837
3858
3838 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3859 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3839 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3860 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3840
3861
3841 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3862 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3842 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3863 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3843 <syver-en-AT-online.no> who both submitted patches for this problem.
3864 <syver-en-AT-online.no> who both submitted patches for this problem.
3844
3865
3845 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3866 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3846 global embedding to make sure that things don't overwrite user
3867 global embedding to make sure that things don't overwrite user
3847 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3868 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3848
3869
3849 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3870 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3850 compatibility. Thanks to Hayden Callow
3871 compatibility. Thanks to Hayden Callow
3851 <h.callow-AT-elec.canterbury.ac.nz>
3872 <h.callow-AT-elec.canterbury.ac.nz>
3852
3873
3853 2002-10-04 Fernando Perez <fperez@colorado.edu>
3874 2002-10-04 Fernando Perez <fperez@colorado.edu>
3854
3875
3855 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3876 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3856 Gnuplot.File objects.
3877 Gnuplot.File objects.
3857
3878
3858 2002-07-23 Fernando Perez <fperez@colorado.edu>
3879 2002-07-23 Fernando Perez <fperez@colorado.edu>
3859
3880
3860 * IPython/genutils.py (timing): Added timings() and timing() for
3881 * IPython/genutils.py (timing): Added timings() and timing() for
3861 quick access to the most commonly needed data, the execution
3882 quick access to the most commonly needed data, the execution
3862 times. Old timing() renamed to timings_out().
3883 times. Old timing() renamed to timings_out().
3863
3884
3864 2002-07-18 Fernando Perez <fperez@colorado.edu>
3885 2002-07-18 Fernando Perez <fperez@colorado.edu>
3865
3886
3866 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3887 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3867 bug with nested instances disrupting the parent's tab completion.
3888 bug with nested instances disrupting the parent's tab completion.
3868
3889
3869 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3890 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3870 all_completions code to begin the emacs integration.
3891 all_completions code to begin the emacs integration.
3871
3892
3872 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3893 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3873 argument to allow titling individual arrays when plotting.
3894 argument to allow titling individual arrays when plotting.
3874
3895
3875 2002-07-15 Fernando Perez <fperez@colorado.edu>
3896 2002-07-15 Fernando Perez <fperez@colorado.edu>
3876
3897
3877 * setup.py (make_shortcut): changed to retrieve the value of
3898 * setup.py (make_shortcut): changed to retrieve the value of
3878 'Program Files' directory from the registry (this value changes in
3899 'Program Files' directory from the registry (this value changes in
3879 non-english versions of Windows). Thanks to Thomas Fanslau
3900 non-english versions of Windows). Thanks to Thomas Fanslau
3880 <tfanslau-AT-gmx.de> for the report.
3901 <tfanslau-AT-gmx.de> for the report.
3881
3902
3882 2002-07-10 Fernando Perez <fperez@colorado.edu>
3903 2002-07-10 Fernando Perez <fperez@colorado.edu>
3883
3904
3884 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3905 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3885 a bug in pdb, which crashes if a line with only whitespace is
3906 a bug in pdb, which crashes if a line with only whitespace is
3886 entered. Bug report submitted to sourceforge.
3907 entered. Bug report submitted to sourceforge.
3887
3908
3888 2002-07-09 Fernando Perez <fperez@colorado.edu>
3909 2002-07-09 Fernando Perez <fperez@colorado.edu>
3889
3910
3890 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3911 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3891 reporting exceptions (it's a bug in inspect.py, I just set a
3912 reporting exceptions (it's a bug in inspect.py, I just set a
3892 workaround).
3913 workaround).
3893
3914
3894 2002-07-08 Fernando Perez <fperez@colorado.edu>
3915 2002-07-08 Fernando Perez <fperez@colorado.edu>
3895
3916
3896 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3917 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3897 __IPYTHON__ in __builtins__ to show up in user_ns.
3918 __IPYTHON__ in __builtins__ to show up in user_ns.
3898
3919
3899 2002-07-03 Fernando Perez <fperez@colorado.edu>
3920 2002-07-03 Fernando Perez <fperez@colorado.edu>
3900
3921
3901 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3922 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3902 name from @gp_set_instance to @gp_set_default.
3923 name from @gp_set_instance to @gp_set_default.
3903
3924
3904 * IPython/ipmaker.py (make_IPython): default editor value set to
3925 * IPython/ipmaker.py (make_IPython): default editor value set to
3905 '0' (a string), to match the rc file. Otherwise will crash when
3926 '0' (a string), to match the rc file. Otherwise will crash when
3906 .strip() is called on it.
3927 .strip() is called on it.
3907
3928
3908
3929
3909 2002-06-28 Fernando Perez <fperez@colorado.edu>
3930 2002-06-28 Fernando Perez <fperez@colorado.edu>
3910
3931
3911 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3932 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3912 of files in current directory when a file is executed via
3933 of files in current directory when a file is executed via
3913 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3934 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3914
3935
3915 * setup.py (manfiles): fix for rpm builds, submitted by RA
3936 * setup.py (manfiles): fix for rpm builds, submitted by RA
3916 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3937 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3917
3938
3918 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3939 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3919 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3940 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3920 string!). A. Schmolck caught this one.
3941 string!). A. Schmolck caught this one.
3921
3942
3922 2002-06-27 Fernando Perez <fperez@colorado.edu>
3943 2002-06-27 Fernando Perez <fperez@colorado.edu>
3923
3944
3924 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3945 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3925 defined files at the cmd line. __name__ wasn't being set to
3946 defined files at the cmd line. __name__ wasn't being set to
3926 __main__.
3947 __main__.
3927
3948
3928 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3949 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3929 regular lists and tuples besides Numeric arrays.
3950 regular lists and tuples besides Numeric arrays.
3930
3951
3931 * IPython/Prompts.py (CachedOutput.__call__): Added output
3952 * IPython/Prompts.py (CachedOutput.__call__): Added output
3932 supression for input ending with ';'. Similar to Mathematica and
3953 supression for input ending with ';'. Similar to Mathematica and
3933 Matlab. The _* vars and Out[] list are still updated, just like
3954 Matlab. The _* vars and Out[] list are still updated, just like
3934 Mathematica behaves.
3955 Mathematica behaves.
3935
3956
3936 2002-06-25 Fernando Perez <fperez@colorado.edu>
3957 2002-06-25 Fernando Perez <fperez@colorado.edu>
3937
3958
3938 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3959 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3939 .ini extensions for profiels under Windows.
3960 .ini extensions for profiels under Windows.
3940
3961
3941 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3962 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3942 string form. Fix contributed by Alexander Schmolck
3963 string form. Fix contributed by Alexander Schmolck
3943 <a.schmolck-AT-gmx.net>
3964 <a.schmolck-AT-gmx.net>
3944
3965
3945 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3966 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3946 pre-configured Gnuplot instance.
3967 pre-configured Gnuplot instance.
3947
3968
3948 2002-06-21 Fernando Perez <fperez@colorado.edu>
3969 2002-06-21 Fernando Perez <fperez@colorado.edu>
3949
3970
3950 * IPython/numutils.py (exp_safe): new function, works around the
3971 * IPython/numutils.py (exp_safe): new function, works around the
3951 underflow problems in Numeric.
3972 underflow problems in Numeric.
3952 (log2): New fn. Safe log in base 2: returns exact integer answer
3973 (log2): New fn. Safe log in base 2: returns exact integer answer
3953 for exact integer powers of 2.
3974 for exact integer powers of 2.
3954
3975
3955 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3976 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3956 properly.
3977 properly.
3957
3978
3958 2002-06-20 Fernando Perez <fperez@colorado.edu>
3979 2002-06-20 Fernando Perez <fperez@colorado.edu>
3959
3980
3960 * IPython/genutils.py (timing): new function like
3981 * IPython/genutils.py (timing): new function like
3961 Mathematica's. Similar to time_test, but returns more info.
3982 Mathematica's. Similar to time_test, but returns more info.
3962
3983
3963 2002-06-18 Fernando Perez <fperez@colorado.edu>
3984 2002-06-18 Fernando Perez <fperez@colorado.edu>
3964
3985
3965 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3986 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3966 according to Mike Heeter's suggestions.
3987 according to Mike Heeter's suggestions.
3967
3988
3968 2002-06-16 Fernando Perez <fperez@colorado.edu>
3989 2002-06-16 Fernando Perez <fperez@colorado.edu>
3969
3990
3970 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3991 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3971 system. GnuplotMagic is gone as a user-directory option. New files
3992 system. GnuplotMagic is gone as a user-directory option. New files
3972 make it easier to use all the gnuplot stuff both from external
3993 make it easier to use all the gnuplot stuff both from external
3973 programs as well as from IPython. Had to rewrite part of
3994 programs as well as from IPython. Had to rewrite part of
3974 hardcopy() b/c of a strange bug: often the ps files simply don't
3995 hardcopy() b/c of a strange bug: often the ps files simply don't
3975 get created, and require a repeat of the command (often several
3996 get created, and require a repeat of the command (often several
3976 times).
3997 times).
3977
3998
3978 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3999 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3979 resolve output channel at call time, so that if sys.stderr has
4000 resolve output channel at call time, so that if sys.stderr has
3980 been redirected by user this gets honored.
4001 been redirected by user this gets honored.
3981
4002
3982 2002-06-13 Fernando Perez <fperez@colorado.edu>
4003 2002-06-13 Fernando Perez <fperez@colorado.edu>
3983
4004
3984 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4005 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3985 IPShell. Kept a copy with the old names to avoid breaking people's
4006 IPShell. Kept a copy with the old names to avoid breaking people's
3986 embedded code.
4007 embedded code.
3987
4008
3988 * IPython/ipython: simplified it to the bare minimum after
4009 * IPython/ipython: simplified it to the bare minimum after
3989 Holger's suggestions. Added info about how to use it in
4010 Holger's suggestions. Added info about how to use it in
3990 PYTHONSTARTUP.
4011 PYTHONSTARTUP.
3991
4012
3992 * IPython/Shell.py (IPythonShell): changed the options passing
4013 * IPython/Shell.py (IPythonShell): changed the options passing
3993 from a string with funky %s replacements to a straight list. Maybe
4014 from a string with funky %s replacements to a straight list. Maybe
3994 a bit more typing, but it follows sys.argv conventions, so there's
4015 a bit more typing, but it follows sys.argv conventions, so there's
3995 less special-casing to remember.
4016 less special-casing to remember.
3996
4017
3997 2002-06-12 Fernando Perez <fperez@colorado.edu>
4018 2002-06-12 Fernando Perez <fperez@colorado.edu>
3998
4019
3999 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4020 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4000 command. Thanks to a suggestion by Mike Heeter.
4021 command. Thanks to a suggestion by Mike Heeter.
4001 (Magic.magic_pfile): added behavior to look at filenames if given
4022 (Magic.magic_pfile): added behavior to look at filenames if given
4002 arg is not a defined object.
4023 arg is not a defined object.
4003 (Magic.magic_save): New @save function to save code snippets. Also
4024 (Magic.magic_save): New @save function to save code snippets. Also
4004 a Mike Heeter idea.
4025 a Mike Heeter idea.
4005
4026
4006 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4027 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4007 plot() and replot(). Much more convenient now, especially for
4028 plot() and replot(). Much more convenient now, especially for
4008 interactive use.
4029 interactive use.
4009
4030
4010 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4031 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4011 filenames.
4032 filenames.
4012
4033
4013 2002-06-02 Fernando Perez <fperez@colorado.edu>
4034 2002-06-02 Fernando Perez <fperez@colorado.edu>
4014
4035
4015 * IPython/Struct.py (Struct.__init__): modified to admit
4036 * IPython/Struct.py (Struct.__init__): modified to admit
4016 initialization via another struct.
4037 initialization via another struct.
4017
4038
4018 * IPython/genutils.py (SystemExec.__init__): New stateful
4039 * IPython/genutils.py (SystemExec.__init__): New stateful
4019 interface to xsys and bq. Useful for writing system scripts.
4040 interface to xsys and bq. Useful for writing system scripts.
4020
4041
4021 2002-05-30 Fernando Perez <fperez@colorado.edu>
4042 2002-05-30 Fernando Perez <fperez@colorado.edu>
4022
4043
4023 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4044 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4024 documents. This will make the user download smaller (it's getting
4045 documents. This will make the user download smaller (it's getting
4025 too big).
4046 too big).
4026
4047
4027 2002-05-29 Fernando Perez <fperez@colorado.edu>
4048 2002-05-29 Fernando Perez <fperez@colorado.edu>
4028
4049
4029 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4050 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4030 fix problems with shelve and pickle. Seems to work, but I don't
4051 fix problems with shelve and pickle. Seems to work, but I don't
4031 know if corner cases break it. Thanks to Mike Heeter
4052 know if corner cases break it. Thanks to Mike Heeter
4032 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4053 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4033
4054
4034 2002-05-24 Fernando Perez <fperez@colorado.edu>
4055 2002-05-24 Fernando Perez <fperez@colorado.edu>
4035
4056
4036 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4057 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4037 macros having broken.
4058 macros having broken.
4038
4059
4039 2002-05-21 Fernando Perez <fperez@colorado.edu>
4060 2002-05-21 Fernando Perez <fperez@colorado.edu>
4040
4061
4041 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4062 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4042 introduced logging bug: all history before logging started was
4063 introduced logging bug: all history before logging started was
4043 being written one character per line! This came from the redesign
4064 being written one character per line! This came from the redesign
4044 of the input history as a special list which slices to strings,
4065 of the input history as a special list which slices to strings,
4045 not to lists.
4066 not to lists.
4046
4067
4047 2002-05-20 Fernando Perez <fperez@colorado.edu>
4068 2002-05-20 Fernando Perez <fperez@colorado.edu>
4048
4069
4049 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4070 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4050 be an attribute of all classes in this module. The design of these
4071 be an attribute of all classes in this module. The design of these
4051 classes needs some serious overhauling.
4072 classes needs some serious overhauling.
4052
4073
4053 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4074 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4054 which was ignoring '_' in option names.
4075 which was ignoring '_' in option names.
4055
4076
4056 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4077 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4057 'Verbose_novars' to 'Context' and made it the new default. It's a
4078 'Verbose_novars' to 'Context' and made it the new default. It's a
4058 bit more readable and also safer than verbose.
4079 bit more readable and also safer than verbose.
4059
4080
4060 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4081 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4061 triple-quoted strings.
4082 triple-quoted strings.
4062
4083
4063 * IPython/OInspect.py (__all__): new module exposing the object
4084 * IPython/OInspect.py (__all__): new module exposing the object
4064 introspection facilities. Now the corresponding magics are dummy
4085 introspection facilities. Now the corresponding magics are dummy
4065 wrappers around this. Having this module will make it much easier
4086 wrappers around this. Having this module will make it much easier
4066 to put these functions into our modified pdb.
4087 to put these functions into our modified pdb.
4067 This new object inspector system uses the new colorizing module,
4088 This new object inspector system uses the new colorizing module,
4068 so source code and other things are nicely syntax highlighted.
4089 so source code and other things are nicely syntax highlighted.
4069
4090
4070 2002-05-18 Fernando Perez <fperez@colorado.edu>
4091 2002-05-18 Fernando Perez <fperez@colorado.edu>
4071
4092
4072 * IPython/ColorANSI.py: Split the coloring tools into a separate
4093 * IPython/ColorANSI.py: Split the coloring tools into a separate
4073 module so I can use them in other code easier (they were part of
4094 module so I can use them in other code easier (they were part of
4074 ultraTB).
4095 ultraTB).
4075
4096
4076 2002-05-17 Fernando Perez <fperez@colorado.edu>
4097 2002-05-17 Fernando Perez <fperez@colorado.edu>
4077
4098
4078 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4099 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4079 fixed it to set the global 'g' also to the called instance, as
4100 fixed it to set the global 'g' also to the called instance, as
4080 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4101 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4081 user's 'g' variables).
4102 user's 'g' variables).
4082
4103
4083 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4104 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4084 global variables (aliases to _ih,_oh) so that users which expect
4105 global variables (aliases to _ih,_oh) so that users which expect
4085 In[5] or Out[7] to work aren't unpleasantly surprised.
4106 In[5] or Out[7] to work aren't unpleasantly surprised.
4086 (InputList.__getslice__): new class to allow executing slices of
4107 (InputList.__getslice__): new class to allow executing slices of
4087 input history directly. Very simple class, complements the use of
4108 input history directly. Very simple class, complements the use of
4088 macros.
4109 macros.
4089
4110
4090 2002-05-16 Fernando Perez <fperez@colorado.edu>
4111 2002-05-16 Fernando Perez <fperez@colorado.edu>
4091
4112
4092 * setup.py (docdirbase): make doc directory be just doc/IPython
4113 * setup.py (docdirbase): make doc directory be just doc/IPython
4093 without version numbers, it will reduce clutter for users.
4114 without version numbers, it will reduce clutter for users.
4094
4115
4095 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4116 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4096 execfile call to prevent possible memory leak. See for details:
4117 execfile call to prevent possible memory leak. See for details:
4097 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4118 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4098
4119
4099 2002-05-15 Fernando Perez <fperez@colorado.edu>
4120 2002-05-15 Fernando Perez <fperez@colorado.edu>
4100
4121
4101 * IPython/Magic.py (Magic.magic_psource): made the object
4122 * IPython/Magic.py (Magic.magic_psource): made the object
4102 introspection names be more standard: pdoc, pdef, pfile and
4123 introspection names be more standard: pdoc, pdef, pfile and
4103 psource. They all print/page their output, and it makes
4124 psource. They all print/page their output, and it makes
4104 remembering them easier. Kept old names for compatibility as
4125 remembering them easier. Kept old names for compatibility as
4105 aliases.
4126 aliases.
4106
4127
4107 2002-05-14 Fernando Perez <fperez@colorado.edu>
4128 2002-05-14 Fernando Perez <fperez@colorado.edu>
4108
4129
4109 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4130 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4110 what the mouse problem was. The trick is to use gnuplot with temp
4131 what the mouse problem was. The trick is to use gnuplot with temp
4111 files and NOT with pipes (for data communication), because having
4132 files and NOT with pipes (for data communication), because having
4112 both pipes and the mouse on is bad news.
4133 both pipes and the mouse on is bad news.
4113
4134
4114 2002-05-13 Fernando Perez <fperez@colorado.edu>
4135 2002-05-13 Fernando Perez <fperez@colorado.edu>
4115
4136
4116 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4137 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4117 bug. Information would be reported about builtins even when
4138 bug. Information would be reported about builtins even when
4118 user-defined functions overrode them.
4139 user-defined functions overrode them.
4119
4140
4120 2002-05-11 Fernando Perez <fperez@colorado.edu>
4141 2002-05-11 Fernando Perez <fperez@colorado.edu>
4121
4142
4122 * IPython/__init__.py (__all__): removed FlexCompleter from
4143 * IPython/__init__.py (__all__): removed FlexCompleter from
4123 __all__ so that things don't fail in platforms without readline.
4144 __all__ so that things don't fail in platforms without readline.
4124
4145
4125 2002-05-10 Fernando Perez <fperez@colorado.edu>
4146 2002-05-10 Fernando Perez <fperez@colorado.edu>
4126
4147
4127 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4148 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4128 it requires Numeric, effectively making Numeric a dependency for
4149 it requires Numeric, effectively making Numeric a dependency for
4129 IPython.
4150 IPython.
4130
4151
4131 * Released 0.2.13
4152 * Released 0.2.13
4132
4153
4133 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4154 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4134 profiler interface. Now all the major options from the profiler
4155 profiler interface. Now all the major options from the profiler
4135 module are directly supported in IPython, both for single
4156 module are directly supported in IPython, both for single
4136 expressions (@prun) and for full programs (@run -p).
4157 expressions (@prun) and for full programs (@run -p).
4137
4158
4138 2002-05-09 Fernando Perez <fperez@colorado.edu>
4159 2002-05-09 Fernando Perez <fperez@colorado.edu>
4139
4160
4140 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4161 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4141 magic properly formatted for screen.
4162 magic properly formatted for screen.
4142
4163
4143 * setup.py (make_shortcut): Changed things to put pdf version in
4164 * setup.py (make_shortcut): Changed things to put pdf version in
4144 doc/ instead of doc/manual (had to change lyxport a bit).
4165 doc/ instead of doc/manual (had to change lyxport a bit).
4145
4166
4146 * IPython/Magic.py (Profile.string_stats): made profile runs go
4167 * IPython/Magic.py (Profile.string_stats): made profile runs go
4147 through pager (they are long and a pager allows searching, saving,
4168 through pager (they are long and a pager allows searching, saving,
4148 etc.)
4169 etc.)
4149
4170
4150 2002-05-08 Fernando Perez <fperez@colorado.edu>
4171 2002-05-08 Fernando Perez <fperez@colorado.edu>
4151
4172
4152 * Released 0.2.12
4173 * Released 0.2.12
4153
4174
4154 2002-05-06 Fernando Perez <fperez@colorado.edu>
4175 2002-05-06 Fernando Perez <fperez@colorado.edu>
4155
4176
4156 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4177 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4157 introduced); 'hist n1 n2' was broken.
4178 introduced); 'hist n1 n2' was broken.
4158 (Magic.magic_pdb): added optional on/off arguments to @pdb
4179 (Magic.magic_pdb): added optional on/off arguments to @pdb
4159 (Magic.magic_run): added option -i to @run, which executes code in
4180 (Magic.magic_run): added option -i to @run, which executes code in
4160 the IPython namespace instead of a clean one. Also added @irun as
4181 the IPython namespace instead of a clean one. Also added @irun as
4161 an alias to @run -i.
4182 an alias to @run -i.
4162
4183
4163 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4184 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4164 fixed (it didn't really do anything, the namespaces were wrong).
4185 fixed (it didn't really do anything, the namespaces were wrong).
4165
4186
4166 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4187 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4167
4188
4168 * IPython/__init__.py (__all__): Fixed package namespace, now
4189 * IPython/__init__.py (__all__): Fixed package namespace, now
4169 'import IPython' does give access to IPython.<all> as
4190 'import IPython' does give access to IPython.<all> as
4170 expected. Also renamed __release__ to Release.
4191 expected. Also renamed __release__ to Release.
4171
4192
4172 * IPython/Debugger.py (__license__): created new Pdb class which
4193 * IPython/Debugger.py (__license__): created new Pdb class which
4173 functions like a drop-in for the normal pdb.Pdb but does NOT
4194 functions like a drop-in for the normal pdb.Pdb but does NOT
4174 import readline by default. This way it doesn't muck up IPython's
4195 import readline by default. This way it doesn't muck up IPython's
4175 readline handling, and now tab-completion finally works in the
4196 readline handling, and now tab-completion finally works in the
4176 debugger -- sort of. It completes things globally visible, but the
4197 debugger -- sort of. It completes things globally visible, but the
4177 completer doesn't track the stack as pdb walks it. That's a bit
4198 completer doesn't track the stack as pdb walks it. That's a bit
4178 tricky, and I'll have to implement it later.
4199 tricky, and I'll have to implement it later.
4179
4200
4180 2002-05-05 Fernando Perez <fperez@colorado.edu>
4201 2002-05-05 Fernando Perez <fperez@colorado.edu>
4181
4202
4182 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4203 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4183 magic docstrings when printed via ? (explicit \'s were being
4204 magic docstrings when printed via ? (explicit \'s were being
4184 printed).
4205 printed).
4185
4206
4186 * IPython/ipmaker.py (make_IPython): fixed namespace
4207 * IPython/ipmaker.py (make_IPython): fixed namespace
4187 identification bug. Now variables loaded via logs or command-line
4208 identification bug. Now variables loaded via logs or command-line
4188 files are recognized in the interactive namespace by @who.
4209 files are recognized in the interactive namespace by @who.
4189
4210
4190 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4211 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4191 log replay system stemming from the string form of Structs.
4212 log replay system stemming from the string form of Structs.
4192
4213
4193 * IPython/Magic.py (Macro.__init__): improved macros to properly
4214 * IPython/Magic.py (Macro.__init__): improved macros to properly
4194 handle magic commands in them.
4215 handle magic commands in them.
4195 (Magic.magic_logstart): usernames are now expanded so 'logstart
4216 (Magic.magic_logstart): usernames are now expanded so 'logstart
4196 ~/mylog' now works.
4217 ~/mylog' now works.
4197
4218
4198 * IPython/iplib.py (complete): fixed bug where paths starting with
4219 * IPython/iplib.py (complete): fixed bug where paths starting with
4199 '/' would be completed as magic names.
4220 '/' would be completed as magic names.
4200
4221
4201 2002-05-04 Fernando Perez <fperez@colorado.edu>
4222 2002-05-04 Fernando Perez <fperez@colorado.edu>
4202
4223
4203 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4224 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4204 allow running full programs under the profiler's control.
4225 allow running full programs under the profiler's control.
4205
4226
4206 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4227 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4207 mode to report exceptions verbosely but without formatting
4228 mode to report exceptions verbosely but without formatting
4208 variables. This addresses the issue of ipython 'freezing' (it's
4229 variables. This addresses the issue of ipython 'freezing' (it's
4209 not frozen, but caught in an expensive formatting loop) when huge
4230 not frozen, but caught in an expensive formatting loop) when huge
4210 variables are in the context of an exception.
4231 variables are in the context of an exception.
4211 (VerboseTB.text): Added '--->' markers at line where exception was
4232 (VerboseTB.text): Added '--->' markers at line where exception was
4212 triggered. Much clearer to read, especially in NoColor modes.
4233 triggered. Much clearer to read, especially in NoColor modes.
4213
4234
4214 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4235 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4215 implemented in reverse when changing to the new parse_options().
4236 implemented in reverse when changing to the new parse_options().
4216
4237
4217 2002-05-03 Fernando Perez <fperez@colorado.edu>
4238 2002-05-03 Fernando Perez <fperez@colorado.edu>
4218
4239
4219 * IPython/Magic.py (Magic.parse_options): new function so that
4240 * IPython/Magic.py (Magic.parse_options): new function so that
4220 magics can parse options easier.
4241 magics can parse options easier.
4221 (Magic.magic_prun): new function similar to profile.run(),
4242 (Magic.magic_prun): new function similar to profile.run(),
4222 suggested by Chris Hart.
4243 suggested by Chris Hart.
4223 (Magic.magic_cd): fixed behavior so that it only changes if
4244 (Magic.magic_cd): fixed behavior so that it only changes if
4224 directory actually is in history.
4245 directory actually is in history.
4225
4246
4226 * IPython/usage.py (__doc__): added information about potential
4247 * IPython/usage.py (__doc__): added information about potential
4227 slowness of Verbose exception mode when there are huge data
4248 slowness of Verbose exception mode when there are huge data
4228 structures to be formatted (thanks to Archie Paulson).
4249 structures to be formatted (thanks to Archie Paulson).
4229
4250
4230 * IPython/ipmaker.py (make_IPython): Changed default logging
4251 * IPython/ipmaker.py (make_IPython): Changed default logging
4231 (when simply called with -log) to use curr_dir/ipython.log in
4252 (when simply called with -log) to use curr_dir/ipython.log in
4232 rotate mode. Fixed crash which was occuring with -log before
4253 rotate mode. Fixed crash which was occuring with -log before
4233 (thanks to Jim Boyle).
4254 (thanks to Jim Boyle).
4234
4255
4235 2002-05-01 Fernando Perez <fperez@colorado.edu>
4256 2002-05-01 Fernando Perez <fperez@colorado.edu>
4236
4257
4237 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4258 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4238 was nasty -- though somewhat of a corner case).
4259 was nasty -- though somewhat of a corner case).
4239
4260
4240 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4261 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4241 text (was a bug).
4262 text (was a bug).
4242
4263
4243 2002-04-30 Fernando Perez <fperez@colorado.edu>
4264 2002-04-30 Fernando Perez <fperez@colorado.edu>
4244
4265
4245 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4266 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4246 a print after ^D or ^C from the user so that the In[] prompt
4267 a print after ^D or ^C from the user so that the In[] prompt
4247 doesn't over-run the gnuplot one.
4268 doesn't over-run the gnuplot one.
4248
4269
4249 2002-04-29 Fernando Perez <fperez@colorado.edu>
4270 2002-04-29 Fernando Perez <fperez@colorado.edu>
4250
4271
4251 * Released 0.2.10
4272 * Released 0.2.10
4252
4273
4253 * IPython/__release__.py (version): get date dynamically.
4274 * IPython/__release__.py (version): get date dynamically.
4254
4275
4255 * Misc. documentation updates thanks to Arnd's comments. Also ran
4276 * Misc. documentation updates thanks to Arnd's comments. Also ran
4256 a full spellcheck on the manual (hadn't been done in a while).
4277 a full spellcheck on the manual (hadn't been done in a while).
4257
4278
4258 2002-04-27 Fernando Perez <fperez@colorado.edu>
4279 2002-04-27 Fernando Perez <fperez@colorado.edu>
4259
4280
4260 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4281 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4261 starting a log in mid-session would reset the input history list.
4282 starting a log in mid-session would reset the input history list.
4262
4283
4263 2002-04-26 Fernando Perez <fperez@colorado.edu>
4284 2002-04-26 Fernando Perez <fperez@colorado.edu>
4264
4285
4265 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4286 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4266 all files were being included in an update. Now anything in
4287 all files were being included in an update. Now anything in
4267 UserConfig that matches [A-Za-z]*.py will go (this excludes
4288 UserConfig that matches [A-Za-z]*.py will go (this excludes
4268 __init__.py)
4289 __init__.py)
4269
4290
4270 2002-04-25 Fernando Perez <fperez@colorado.edu>
4291 2002-04-25 Fernando Perez <fperez@colorado.edu>
4271
4292
4272 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4293 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4273 to __builtins__ so that any form of embedded or imported code can
4294 to __builtins__ so that any form of embedded or imported code can
4274 test for being inside IPython.
4295 test for being inside IPython.
4275
4296
4276 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4297 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4277 changed to GnuplotMagic because it's now an importable module,
4298 changed to GnuplotMagic because it's now an importable module,
4278 this makes the name follow that of the standard Gnuplot module.
4299 this makes the name follow that of the standard Gnuplot module.
4279 GnuplotMagic can now be loaded at any time in mid-session.
4300 GnuplotMagic can now be loaded at any time in mid-session.
4280
4301
4281 2002-04-24 Fernando Perez <fperez@colorado.edu>
4302 2002-04-24 Fernando Perez <fperez@colorado.edu>
4282
4303
4283 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4304 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4284 the globals (IPython has its own namespace) and the
4305 the globals (IPython has its own namespace) and the
4285 PhysicalQuantity stuff is much better anyway.
4306 PhysicalQuantity stuff is much better anyway.
4286
4307
4287 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4308 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4288 embedding example to standard user directory for
4309 embedding example to standard user directory for
4289 distribution. Also put it in the manual.
4310 distribution. Also put it in the manual.
4290
4311
4291 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4312 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4292 instance as first argument (so it doesn't rely on some obscure
4313 instance as first argument (so it doesn't rely on some obscure
4293 hidden global).
4314 hidden global).
4294
4315
4295 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4316 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4296 delimiters. While it prevents ().TAB from working, it allows
4317 delimiters. While it prevents ().TAB from working, it allows
4297 completions in open (... expressions. This is by far a more common
4318 completions in open (... expressions. This is by far a more common
4298 case.
4319 case.
4299
4320
4300 2002-04-23 Fernando Perez <fperez@colorado.edu>
4321 2002-04-23 Fernando Perez <fperez@colorado.edu>
4301
4322
4302 * IPython/Extensions/InterpreterPasteInput.py: new
4323 * IPython/Extensions/InterpreterPasteInput.py: new
4303 syntax-processing module for pasting lines with >>> or ... at the
4324 syntax-processing module for pasting lines with >>> or ... at the
4304 start.
4325 start.
4305
4326
4306 * IPython/Extensions/PhysicalQ_Interactive.py
4327 * IPython/Extensions/PhysicalQ_Interactive.py
4307 (PhysicalQuantityInteractive.__int__): fixed to work with either
4328 (PhysicalQuantityInteractive.__int__): fixed to work with either
4308 Numeric or math.
4329 Numeric or math.
4309
4330
4310 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4331 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4311 provided profiles. Now we have:
4332 provided profiles. Now we have:
4312 -math -> math module as * and cmath with its own namespace.
4333 -math -> math module as * and cmath with its own namespace.
4313 -numeric -> Numeric as *, plus gnuplot & grace
4334 -numeric -> Numeric as *, plus gnuplot & grace
4314 -physics -> same as before
4335 -physics -> same as before
4315
4336
4316 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4337 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4317 user-defined magics wouldn't be found by @magic if they were
4338 user-defined magics wouldn't be found by @magic if they were
4318 defined as class methods. Also cleaned up the namespace search
4339 defined as class methods. Also cleaned up the namespace search
4319 logic and the string building (to use %s instead of many repeated
4340 logic and the string building (to use %s instead of many repeated
4320 string adds).
4341 string adds).
4321
4342
4322 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4343 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4323 of user-defined magics to operate with class methods (cleaner, in
4344 of user-defined magics to operate with class methods (cleaner, in
4324 line with the gnuplot code).
4345 line with the gnuplot code).
4325
4346
4326 2002-04-22 Fernando Perez <fperez@colorado.edu>
4347 2002-04-22 Fernando Perez <fperez@colorado.edu>
4327
4348
4328 * setup.py: updated dependency list so that manual is updated when
4349 * setup.py: updated dependency list so that manual is updated when
4329 all included files change.
4350 all included files change.
4330
4351
4331 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4352 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4332 the delimiter removal option (the fix is ugly right now).
4353 the delimiter removal option (the fix is ugly right now).
4333
4354
4334 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4355 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4335 all of the math profile (quicker loading, no conflict between
4356 all of the math profile (quicker loading, no conflict between
4336 g-9.8 and g-gnuplot).
4357 g-9.8 and g-gnuplot).
4337
4358
4338 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4359 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4339 name of post-mortem files to IPython_crash_report.txt.
4360 name of post-mortem files to IPython_crash_report.txt.
4340
4361
4341 * Cleanup/update of the docs. Added all the new readline info and
4362 * Cleanup/update of the docs. Added all the new readline info and
4342 formatted all lists as 'real lists'.
4363 formatted all lists as 'real lists'.
4343
4364
4344 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4365 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4345 tab-completion options, since the full readline parse_and_bind is
4366 tab-completion options, since the full readline parse_and_bind is
4346 now accessible.
4367 now accessible.
4347
4368
4348 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4369 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4349 handling of readline options. Now users can specify any string to
4370 handling of readline options. Now users can specify any string to
4350 be passed to parse_and_bind(), as well as the delimiters to be
4371 be passed to parse_and_bind(), as well as the delimiters to be
4351 removed.
4372 removed.
4352 (InteractiveShell.__init__): Added __name__ to the global
4373 (InteractiveShell.__init__): Added __name__ to the global
4353 namespace so that things like Itpl which rely on its existence
4374 namespace so that things like Itpl which rely on its existence
4354 don't crash.
4375 don't crash.
4355 (InteractiveShell._prefilter): Defined the default with a _ so
4376 (InteractiveShell._prefilter): Defined the default with a _ so
4356 that prefilter() is easier to override, while the default one
4377 that prefilter() is easier to override, while the default one
4357 remains available.
4378 remains available.
4358
4379
4359 2002-04-18 Fernando Perez <fperez@colorado.edu>
4380 2002-04-18 Fernando Perez <fperez@colorado.edu>
4360
4381
4361 * Added information about pdb in the docs.
4382 * Added information about pdb in the docs.
4362
4383
4363 2002-04-17 Fernando Perez <fperez@colorado.edu>
4384 2002-04-17 Fernando Perez <fperez@colorado.edu>
4364
4385
4365 * IPython/ipmaker.py (make_IPython): added rc_override option to
4386 * IPython/ipmaker.py (make_IPython): added rc_override option to
4366 allow passing config options at creation time which may override
4387 allow passing config options at creation time which may override
4367 anything set in the config files or command line. This is
4388 anything set in the config files or command line. This is
4368 particularly useful for configuring embedded instances.
4389 particularly useful for configuring embedded instances.
4369
4390
4370 2002-04-15 Fernando Perez <fperez@colorado.edu>
4391 2002-04-15 Fernando Perez <fperez@colorado.edu>
4371
4392
4372 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4393 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4373 crash embedded instances because of the input cache falling out of
4394 crash embedded instances because of the input cache falling out of
4374 sync with the output counter.
4395 sync with the output counter.
4375
4396
4376 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4397 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4377 mode which calls pdb after an uncaught exception in IPython itself.
4398 mode which calls pdb after an uncaught exception in IPython itself.
4378
4399
4379 2002-04-14 Fernando Perez <fperez@colorado.edu>
4400 2002-04-14 Fernando Perez <fperez@colorado.edu>
4380
4401
4381 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4402 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4382 readline, fix it back after each call.
4403 readline, fix it back after each call.
4383
4404
4384 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4405 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4385 method to force all access via __call__(), which guarantees that
4406 method to force all access via __call__(), which guarantees that
4386 traceback references are properly deleted.
4407 traceback references are properly deleted.
4387
4408
4388 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4409 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4389 improve printing when pprint is in use.
4410 improve printing when pprint is in use.
4390
4411
4391 2002-04-13 Fernando Perez <fperez@colorado.edu>
4412 2002-04-13 Fernando Perez <fperez@colorado.edu>
4392
4413
4393 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4414 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4394 exceptions aren't caught anymore. If the user triggers one, he
4415 exceptions aren't caught anymore. If the user triggers one, he
4395 should know why he's doing it and it should go all the way up,
4416 should know why he's doing it and it should go all the way up,
4396 just like any other exception. So now @abort will fully kill the
4417 just like any other exception. So now @abort will fully kill the
4397 embedded interpreter and the embedding code (unless that happens
4418 embedded interpreter and the embedding code (unless that happens
4398 to catch SystemExit).
4419 to catch SystemExit).
4399
4420
4400 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4421 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4401 and a debugger() method to invoke the interactive pdb debugger
4422 and a debugger() method to invoke the interactive pdb debugger
4402 after printing exception information. Also added the corresponding
4423 after printing exception information. Also added the corresponding
4403 -pdb option and @pdb magic to control this feature, and updated
4424 -pdb option and @pdb magic to control this feature, and updated
4404 the docs. After a suggestion from Christopher Hart
4425 the docs. After a suggestion from Christopher Hart
4405 (hart-AT-caltech.edu).
4426 (hart-AT-caltech.edu).
4406
4427
4407 2002-04-12 Fernando Perez <fperez@colorado.edu>
4428 2002-04-12 Fernando Perez <fperez@colorado.edu>
4408
4429
4409 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4430 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4410 the exception handlers defined by the user (not the CrashHandler)
4431 the exception handlers defined by the user (not the CrashHandler)
4411 so that user exceptions don't trigger an ipython bug report.
4432 so that user exceptions don't trigger an ipython bug report.
4412
4433
4413 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4434 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4414 configurable (it should have always been so).
4435 configurable (it should have always been so).
4415
4436
4416 2002-03-26 Fernando Perez <fperez@colorado.edu>
4437 2002-03-26 Fernando Perez <fperez@colorado.edu>
4417
4438
4418 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4439 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4419 and there to fix embedding namespace issues. This should all be
4440 and there to fix embedding namespace issues. This should all be
4420 done in a more elegant way.
4441 done in a more elegant way.
4421
4442
4422 2002-03-25 Fernando Perez <fperez@colorado.edu>
4443 2002-03-25 Fernando Perez <fperez@colorado.edu>
4423
4444
4424 * IPython/genutils.py (get_home_dir): Try to make it work under
4445 * IPython/genutils.py (get_home_dir): Try to make it work under
4425 win9x also.
4446 win9x also.
4426
4447
4427 2002-03-20 Fernando Perez <fperez@colorado.edu>
4448 2002-03-20 Fernando Perez <fperez@colorado.edu>
4428
4449
4429 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4450 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4430 sys.displayhook untouched upon __init__.
4451 sys.displayhook untouched upon __init__.
4431
4452
4432 2002-03-19 Fernando Perez <fperez@colorado.edu>
4453 2002-03-19 Fernando Perez <fperez@colorado.edu>
4433
4454
4434 * Released 0.2.9 (for embedding bug, basically).
4455 * Released 0.2.9 (for embedding bug, basically).
4435
4456
4436 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4457 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4437 exceptions so that enclosing shell's state can be restored.
4458 exceptions so that enclosing shell's state can be restored.
4438
4459
4439 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4460 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4440 naming conventions in the .ipython/ dir.
4461 naming conventions in the .ipython/ dir.
4441
4462
4442 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4463 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4443 from delimiters list so filenames with - in them get expanded.
4464 from delimiters list so filenames with - in them get expanded.
4444
4465
4445 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4466 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4446 sys.displayhook not being properly restored after an embedded call.
4467 sys.displayhook not being properly restored after an embedded call.
4447
4468
4448 2002-03-18 Fernando Perez <fperez@colorado.edu>
4469 2002-03-18 Fernando Perez <fperez@colorado.edu>
4449
4470
4450 * Released 0.2.8
4471 * Released 0.2.8
4451
4472
4452 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4473 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4453 some files weren't being included in a -upgrade.
4474 some files weren't being included in a -upgrade.
4454 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4475 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4455 on' so that the first tab completes.
4476 on' so that the first tab completes.
4456 (InteractiveShell.handle_magic): fixed bug with spaces around
4477 (InteractiveShell.handle_magic): fixed bug with spaces around
4457 quotes breaking many magic commands.
4478 quotes breaking many magic commands.
4458
4479
4459 * setup.py: added note about ignoring the syntax error messages at
4480 * setup.py: added note about ignoring the syntax error messages at
4460 installation.
4481 installation.
4461
4482
4462 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4483 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4463 streamlining the gnuplot interface, now there's only one magic @gp.
4484 streamlining the gnuplot interface, now there's only one magic @gp.
4464
4485
4465 2002-03-17 Fernando Perez <fperez@colorado.edu>
4486 2002-03-17 Fernando Perez <fperez@colorado.edu>
4466
4487
4467 * IPython/UserConfig/magic_gnuplot.py: new name for the
4488 * IPython/UserConfig/magic_gnuplot.py: new name for the
4468 example-magic_pm.py file. Much enhanced system, now with a shell
4489 example-magic_pm.py file. Much enhanced system, now with a shell
4469 for communicating directly with gnuplot, one command at a time.
4490 for communicating directly with gnuplot, one command at a time.
4470
4491
4471 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4492 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4472 setting __name__=='__main__'.
4493 setting __name__=='__main__'.
4473
4494
4474 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4495 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4475 mini-shell for accessing gnuplot from inside ipython. Should
4496 mini-shell for accessing gnuplot from inside ipython. Should
4476 extend it later for grace access too. Inspired by Arnd's
4497 extend it later for grace access too. Inspired by Arnd's
4477 suggestion.
4498 suggestion.
4478
4499
4479 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4500 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4480 calling magic functions with () in their arguments. Thanks to Arnd
4501 calling magic functions with () in their arguments. Thanks to Arnd
4481 Baecker for pointing this to me.
4502 Baecker for pointing this to me.
4482
4503
4483 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4504 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4484 infinitely for integer or complex arrays (only worked with floats).
4505 infinitely for integer or complex arrays (only worked with floats).
4485
4506
4486 2002-03-16 Fernando Perez <fperez@colorado.edu>
4507 2002-03-16 Fernando Perez <fperez@colorado.edu>
4487
4508
4488 * setup.py: Merged setup and setup_windows into a single script
4509 * setup.py: Merged setup and setup_windows into a single script
4489 which properly handles things for windows users.
4510 which properly handles things for windows users.
4490
4511
4491 2002-03-15 Fernando Perez <fperez@colorado.edu>
4512 2002-03-15 Fernando Perez <fperez@colorado.edu>
4492
4513
4493 * Big change to the manual: now the magics are all automatically
4514 * Big change to the manual: now the magics are all automatically
4494 documented. This information is generated from their docstrings
4515 documented. This information is generated from their docstrings
4495 and put in a latex file included by the manual lyx file. This way
4516 and put in a latex file included by the manual lyx file. This way
4496 we get always up to date information for the magics. The manual
4517 we get always up to date information for the magics. The manual
4497 now also has proper version information, also auto-synced.
4518 now also has proper version information, also auto-synced.
4498
4519
4499 For this to work, an undocumented --magic_docstrings option was added.
4520 For this to work, an undocumented --magic_docstrings option was added.
4500
4521
4501 2002-03-13 Fernando Perez <fperez@colorado.edu>
4522 2002-03-13 Fernando Perez <fperez@colorado.edu>
4502
4523
4503 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4524 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4504 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4525 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4505
4526
4506 2002-03-12 Fernando Perez <fperez@colorado.edu>
4527 2002-03-12 Fernando Perez <fperez@colorado.edu>
4507
4528
4508 * IPython/ultraTB.py (TermColors): changed color escapes again to
4529 * IPython/ultraTB.py (TermColors): changed color escapes again to
4509 fix the (old, reintroduced) line-wrapping bug. Basically, if
4530 fix the (old, reintroduced) line-wrapping bug. Basically, if
4510 \001..\002 aren't given in the color escapes, lines get wrapped
4531 \001..\002 aren't given in the color escapes, lines get wrapped
4511 weirdly. But giving those screws up old xterms and emacs terms. So
4532 weirdly. But giving those screws up old xterms and emacs terms. So
4512 I added some logic for emacs terms to be ok, but I can't identify old
4533 I added some logic for emacs terms to be ok, but I can't identify old
4513 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4534 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4514
4535
4515 2002-03-10 Fernando Perez <fperez@colorado.edu>
4536 2002-03-10 Fernando Perez <fperez@colorado.edu>
4516
4537
4517 * IPython/usage.py (__doc__): Various documentation cleanups and
4538 * IPython/usage.py (__doc__): Various documentation cleanups and
4518 updates, both in usage docstrings and in the manual.
4539 updates, both in usage docstrings and in the manual.
4519
4540
4520 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4541 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4521 handling of caching. Set minimum acceptabe value for having a
4542 handling of caching. Set minimum acceptabe value for having a
4522 cache at 20 values.
4543 cache at 20 values.
4523
4544
4524 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4545 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4525 install_first_time function to a method, renamed it and added an
4546 install_first_time function to a method, renamed it and added an
4526 'upgrade' mode. Now people can update their config directory with
4547 'upgrade' mode. Now people can update their config directory with
4527 a simple command line switch (-upgrade, also new).
4548 a simple command line switch (-upgrade, also new).
4528
4549
4529 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4550 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4530 @file (convenient for automagic users under Python >= 2.2).
4551 @file (convenient for automagic users under Python >= 2.2).
4531 Removed @files (it seemed more like a plural than an abbrev. of
4552 Removed @files (it seemed more like a plural than an abbrev. of
4532 'file show').
4553 'file show').
4533
4554
4534 * IPython/iplib.py (install_first_time): Fixed crash if there were
4555 * IPython/iplib.py (install_first_time): Fixed crash if there were
4535 backup files ('~') in .ipython/ install directory.
4556 backup files ('~') in .ipython/ install directory.
4536
4557
4537 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4558 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4538 system. Things look fine, but these changes are fairly
4559 system. Things look fine, but these changes are fairly
4539 intrusive. Test them for a few days.
4560 intrusive. Test them for a few days.
4540
4561
4541 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4562 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4542 the prompts system. Now all in/out prompt strings are user
4563 the prompts system. Now all in/out prompt strings are user
4543 controllable. This is particularly useful for embedding, as one
4564 controllable. This is particularly useful for embedding, as one
4544 can tag embedded instances with particular prompts.
4565 can tag embedded instances with particular prompts.
4545
4566
4546 Also removed global use of sys.ps1/2, which now allows nested
4567 Also removed global use of sys.ps1/2, which now allows nested
4547 embeddings without any problems. Added command-line options for
4568 embeddings without any problems. Added command-line options for
4548 the prompt strings.
4569 the prompt strings.
4549
4570
4550 2002-03-08 Fernando Perez <fperez@colorado.edu>
4571 2002-03-08 Fernando Perez <fperez@colorado.edu>
4551
4572
4552 * IPython/UserConfig/example-embed-short.py (ipshell): added
4573 * IPython/UserConfig/example-embed-short.py (ipshell): added
4553 example file with the bare minimum code for embedding.
4574 example file with the bare minimum code for embedding.
4554
4575
4555 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4576 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4556 functionality for the embeddable shell to be activated/deactivated
4577 functionality for the embeddable shell to be activated/deactivated
4557 either globally or at each call.
4578 either globally or at each call.
4558
4579
4559 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4580 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4560 rewriting the prompt with '--->' for auto-inputs with proper
4581 rewriting the prompt with '--->' for auto-inputs with proper
4561 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4582 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4562 this is handled by the prompts class itself, as it should.
4583 this is handled by the prompts class itself, as it should.
4563
4584
4564 2002-03-05 Fernando Perez <fperez@colorado.edu>
4585 2002-03-05 Fernando Perez <fperez@colorado.edu>
4565
4586
4566 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4587 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4567 @logstart to avoid name clashes with the math log function.
4588 @logstart to avoid name clashes with the math log function.
4568
4589
4569 * Big updates to X/Emacs section of the manual.
4590 * Big updates to X/Emacs section of the manual.
4570
4591
4571 * Removed ipython_emacs. Milan explained to me how to pass
4592 * Removed ipython_emacs. Milan explained to me how to pass
4572 arguments to ipython through Emacs. Some day I'm going to end up
4593 arguments to ipython through Emacs. Some day I'm going to end up
4573 learning some lisp...
4594 learning some lisp...
4574
4595
4575 2002-03-04 Fernando Perez <fperez@colorado.edu>
4596 2002-03-04 Fernando Perez <fperez@colorado.edu>
4576
4597
4577 * IPython/ipython_emacs: Created script to be used as the
4598 * IPython/ipython_emacs: Created script to be used as the
4578 py-python-command Emacs variable so we can pass IPython
4599 py-python-command Emacs variable so we can pass IPython
4579 parameters. I can't figure out how to tell Emacs directly to pass
4600 parameters. I can't figure out how to tell Emacs directly to pass
4580 parameters to IPython, so a dummy shell script will do it.
4601 parameters to IPython, so a dummy shell script will do it.
4581
4602
4582 Other enhancements made for things to work better under Emacs'
4603 Other enhancements made for things to work better under Emacs'
4583 various types of terminals. Many thanks to Milan Zamazal
4604 various types of terminals. Many thanks to Milan Zamazal
4584 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4605 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4585
4606
4586 2002-03-01 Fernando Perez <fperez@colorado.edu>
4607 2002-03-01 Fernando Perez <fperez@colorado.edu>
4587
4608
4588 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4609 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4589 that loading of readline is now optional. This gives better
4610 that loading of readline is now optional. This gives better
4590 control to emacs users.
4611 control to emacs users.
4591
4612
4592 * IPython/ultraTB.py (__date__): Modified color escape sequences
4613 * IPython/ultraTB.py (__date__): Modified color escape sequences
4593 and now things work fine under xterm and in Emacs' term buffers
4614 and now things work fine under xterm and in Emacs' term buffers
4594 (though not shell ones). Well, in emacs you get colors, but all
4615 (though not shell ones). Well, in emacs you get colors, but all
4595 seem to be 'light' colors (no difference between dark and light
4616 seem to be 'light' colors (no difference between dark and light
4596 ones). But the garbage chars are gone, and also in xterms. It
4617 ones). But the garbage chars are gone, and also in xterms. It
4597 seems that now I'm using 'cleaner' ansi sequences.
4618 seems that now I'm using 'cleaner' ansi sequences.
4598
4619
4599 2002-02-21 Fernando Perez <fperez@colorado.edu>
4620 2002-02-21 Fernando Perez <fperez@colorado.edu>
4600
4621
4601 * Released 0.2.7 (mainly to publish the scoping fix).
4622 * Released 0.2.7 (mainly to publish the scoping fix).
4602
4623
4603 * IPython/Logger.py (Logger.logstate): added. A corresponding
4624 * IPython/Logger.py (Logger.logstate): added. A corresponding
4604 @logstate magic was created.
4625 @logstate magic was created.
4605
4626
4606 * IPython/Magic.py: fixed nested scoping problem under Python
4627 * IPython/Magic.py: fixed nested scoping problem under Python
4607 2.1.x (automagic wasn't working).
4628 2.1.x (automagic wasn't working).
4608
4629
4609 2002-02-20 Fernando Perez <fperez@colorado.edu>
4630 2002-02-20 Fernando Perez <fperez@colorado.edu>
4610
4631
4611 * Released 0.2.6.
4632 * Released 0.2.6.
4612
4633
4613 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4634 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4614 option so that logs can come out without any headers at all.
4635 option so that logs can come out without any headers at all.
4615
4636
4616 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4637 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4617 SciPy.
4638 SciPy.
4618
4639
4619 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4640 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4620 that embedded IPython calls don't require vars() to be explicitly
4641 that embedded IPython calls don't require vars() to be explicitly
4621 passed. Now they are extracted from the caller's frame (code
4642 passed. Now they are extracted from the caller's frame (code
4622 snatched from Eric Jones' weave). Added better documentation to
4643 snatched from Eric Jones' weave). Added better documentation to
4623 the section on embedding and the example file.
4644 the section on embedding and the example file.
4624
4645
4625 * IPython/genutils.py (page): Changed so that under emacs, it just
4646 * IPython/genutils.py (page): Changed so that under emacs, it just
4626 prints the string. You can then page up and down in the emacs
4647 prints the string. You can then page up and down in the emacs
4627 buffer itself. This is how the builtin help() works.
4648 buffer itself. This is how the builtin help() works.
4628
4649
4629 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4650 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4630 macro scoping: macros need to be executed in the user's namespace
4651 macro scoping: macros need to be executed in the user's namespace
4631 to work as if they had been typed by the user.
4652 to work as if they had been typed by the user.
4632
4653
4633 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4654 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4634 execute automatically (no need to type 'exec...'). They then
4655 execute automatically (no need to type 'exec...'). They then
4635 behave like 'true macros'. The printing system was also modified
4656 behave like 'true macros'. The printing system was also modified
4636 for this to work.
4657 for this to work.
4637
4658
4638 2002-02-19 Fernando Perez <fperez@colorado.edu>
4659 2002-02-19 Fernando Perez <fperez@colorado.edu>
4639
4660
4640 * IPython/genutils.py (page_file): new function for paging files
4661 * IPython/genutils.py (page_file): new function for paging files
4641 in an OS-independent way. Also necessary for file viewing to work
4662 in an OS-independent way. Also necessary for file viewing to work
4642 well inside Emacs buffers.
4663 well inside Emacs buffers.
4643 (page): Added checks for being in an emacs buffer.
4664 (page): Added checks for being in an emacs buffer.
4644 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4665 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4645 same bug in iplib.
4666 same bug in iplib.
4646
4667
4647 2002-02-18 Fernando Perez <fperez@colorado.edu>
4668 2002-02-18 Fernando Perez <fperez@colorado.edu>
4648
4669
4649 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4670 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4650 of readline so that IPython can work inside an Emacs buffer.
4671 of readline so that IPython can work inside an Emacs buffer.
4651
4672
4652 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4673 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4653 method signatures (they weren't really bugs, but it looks cleaner
4674 method signatures (they weren't really bugs, but it looks cleaner
4654 and keeps PyChecker happy).
4675 and keeps PyChecker happy).
4655
4676
4656 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4677 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4657 for implementing various user-defined hooks. Currently only
4678 for implementing various user-defined hooks. Currently only
4658 display is done.
4679 display is done.
4659
4680
4660 * IPython/Prompts.py (CachedOutput._display): changed display
4681 * IPython/Prompts.py (CachedOutput._display): changed display
4661 functions so that they can be dynamically changed by users easily.
4682 functions so that they can be dynamically changed by users easily.
4662
4683
4663 * IPython/Extensions/numeric_formats.py (num_display): added an
4684 * IPython/Extensions/numeric_formats.py (num_display): added an
4664 extension for printing NumPy arrays in flexible manners. It
4685 extension for printing NumPy arrays in flexible manners. It
4665 doesn't do anything yet, but all the structure is in
4686 doesn't do anything yet, but all the structure is in
4666 place. Ultimately the plan is to implement output format control
4687 place. Ultimately the plan is to implement output format control
4667 like in Octave.
4688 like in Octave.
4668
4689
4669 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4690 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4670 methods are found at run-time by all the automatic machinery.
4691 methods are found at run-time by all the automatic machinery.
4671
4692
4672 2002-02-17 Fernando Perez <fperez@colorado.edu>
4693 2002-02-17 Fernando Perez <fperez@colorado.edu>
4673
4694
4674 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4695 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4675 whole file a little.
4696 whole file a little.
4676
4697
4677 * ToDo: closed this document. Now there's a new_design.lyx
4698 * ToDo: closed this document. Now there's a new_design.lyx
4678 document for all new ideas. Added making a pdf of it for the
4699 document for all new ideas. Added making a pdf of it for the
4679 end-user distro.
4700 end-user distro.
4680
4701
4681 * IPython/Logger.py (Logger.switch_log): Created this to replace
4702 * IPython/Logger.py (Logger.switch_log): Created this to replace
4682 logon() and logoff(). It also fixes a nasty crash reported by
4703 logon() and logoff(). It also fixes a nasty crash reported by
4683 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4704 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4684
4705
4685 * IPython/iplib.py (complete): got auto-completion to work with
4706 * IPython/iplib.py (complete): got auto-completion to work with
4686 automagic (I had wanted this for a long time).
4707 automagic (I had wanted this for a long time).
4687
4708
4688 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4709 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4689 to @file, since file() is now a builtin and clashes with automagic
4710 to @file, since file() is now a builtin and clashes with automagic
4690 for @file.
4711 for @file.
4691
4712
4692 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4713 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4693 of this was previously in iplib, which had grown to more than 2000
4714 of this was previously in iplib, which had grown to more than 2000
4694 lines, way too long. No new functionality, but it makes managing
4715 lines, way too long. No new functionality, but it makes managing
4695 the code a bit easier.
4716 the code a bit easier.
4696
4717
4697 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4718 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4698 information to crash reports.
4719 information to crash reports.
4699
4720
4700 2002-02-12 Fernando Perez <fperez@colorado.edu>
4721 2002-02-12 Fernando Perez <fperez@colorado.edu>
4701
4722
4702 * Released 0.2.5.
4723 * Released 0.2.5.
4703
4724
4704 2002-02-11 Fernando Perez <fperez@colorado.edu>
4725 2002-02-11 Fernando Perez <fperez@colorado.edu>
4705
4726
4706 * Wrote a relatively complete Windows installer. It puts
4727 * Wrote a relatively complete Windows installer. It puts
4707 everything in place, creates Start Menu entries and fixes the
4728 everything in place, creates Start Menu entries and fixes the
4708 color issues. Nothing fancy, but it works.
4729 color issues. Nothing fancy, but it works.
4709
4730
4710 2002-02-10 Fernando Perez <fperez@colorado.edu>
4731 2002-02-10 Fernando Perez <fperez@colorado.edu>
4711
4732
4712 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4733 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4713 os.path.expanduser() call so that we can type @run ~/myfile.py and
4734 os.path.expanduser() call so that we can type @run ~/myfile.py and
4714 have thigs work as expected.
4735 have thigs work as expected.
4715
4736
4716 * IPython/genutils.py (page): fixed exception handling so things
4737 * IPython/genutils.py (page): fixed exception handling so things
4717 work both in Unix and Windows correctly. Quitting a pager triggers
4738 work both in Unix and Windows correctly. Quitting a pager triggers
4718 an IOError/broken pipe in Unix, and in windows not finding a pager
4739 an IOError/broken pipe in Unix, and in windows not finding a pager
4719 is also an IOError, so I had to actually look at the return value
4740 is also an IOError, so I had to actually look at the return value
4720 of the exception, not just the exception itself. Should be ok now.
4741 of the exception, not just the exception itself. Should be ok now.
4721
4742
4722 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4743 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4723 modified to allow case-insensitive color scheme changes.
4744 modified to allow case-insensitive color scheme changes.
4724
4745
4725 2002-02-09 Fernando Perez <fperez@colorado.edu>
4746 2002-02-09 Fernando Perez <fperez@colorado.edu>
4726
4747
4727 * IPython/genutils.py (native_line_ends): new function to leave
4748 * IPython/genutils.py (native_line_ends): new function to leave
4728 user config files with os-native line-endings.
4749 user config files with os-native line-endings.
4729
4750
4730 * README and manual updates.
4751 * README and manual updates.
4731
4752
4732 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4753 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4733 instead of StringType to catch Unicode strings.
4754 instead of StringType to catch Unicode strings.
4734
4755
4735 * IPython/genutils.py (filefind): fixed bug for paths with
4756 * IPython/genutils.py (filefind): fixed bug for paths with
4736 embedded spaces (very common in Windows).
4757 embedded spaces (very common in Windows).
4737
4758
4738 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4759 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4739 files under Windows, so that they get automatically associated
4760 files under Windows, so that they get automatically associated
4740 with a text editor. Windows makes it a pain to handle
4761 with a text editor. Windows makes it a pain to handle
4741 extension-less files.
4762 extension-less files.
4742
4763
4743 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4764 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4744 warning about readline only occur for Posix. In Windows there's no
4765 warning about readline only occur for Posix. In Windows there's no
4745 way to get readline, so why bother with the warning.
4766 way to get readline, so why bother with the warning.
4746
4767
4747 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4768 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4748 for __str__ instead of dir(self), since dir() changed in 2.2.
4769 for __str__ instead of dir(self), since dir() changed in 2.2.
4749
4770
4750 * Ported to Windows! Tested on XP, I suspect it should work fine
4771 * Ported to Windows! Tested on XP, I suspect it should work fine
4751 on NT/2000, but I don't think it will work on 98 et al. That
4772 on NT/2000, but I don't think it will work on 98 et al. That
4752 series of Windows is such a piece of junk anyway that I won't try
4773 series of Windows is such a piece of junk anyway that I won't try
4753 porting it there. The XP port was straightforward, showed a few
4774 porting it there. The XP port was straightforward, showed a few
4754 bugs here and there (fixed all), in particular some string
4775 bugs here and there (fixed all), in particular some string
4755 handling stuff which required considering Unicode strings (which
4776 handling stuff which required considering Unicode strings (which
4756 Windows uses). This is good, but hasn't been too tested :) No
4777 Windows uses). This is good, but hasn't been too tested :) No
4757 fancy installer yet, I'll put a note in the manual so people at
4778 fancy installer yet, I'll put a note in the manual so people at
4758 least make manually a shortcut.
4779 least make manually a shortcut.
4759
4780
4760 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4781 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4761 into a single one, "colors". This now controls both prompt and
4782 into a single one, "colors". This now controls both prompt and
4762 exception color schemes, and can be changed both at startup
4783 exception color schemes, and can be changed both at startup
4763 (either via command-line switches or via ipythonrc files) and at
4784 (either via command-line switches or via ipythonrc files) and at
4764 runtime, with @colors.
4785 runtime, with @colors.
4765 (Magic.magic_run): renamed @prun to @run and removed the old
4786 (Magic.magic_run): renamed @prun to @run and removed the old
4766 @run. The two were too similar to warrant keeping both.
4787 @run. The two were too similar to warrant keeping both.
4767
4788
4768 2002-02-03 Fernando Perez <fperez@colorado.edu>
4789 2002-02-03 Fernando Perez <fperez@colorado.edu>
4769
4790
4770 * IPython/iplib.py (install_first_time): Added comment on how to
4791 * IPython/iplib.py (install_first_time): Added comment on how to
4771 configure the color options for first-time users. Put a <return>
4792 configure the color options for first-time users. Put a <return>
4772 request at the end so that small-terminal users get a chance to
4793 request at the end so that small-terminal users get a chance to
4773 read the startup info.
4794 read the startup info.
4774
4795
4775 2002-01-23 Fernando Perez <fperez@colorado.edu>
4796 2002-01-23 Fernando Perez <fperez@colorado.edu>
4776
4797
4777 * IPython/iplib.py (CachedOutput.update): Changed output memory
4798 * IPython/iplib.py (CachedOutput.update): Changed output memory
4778 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4799 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4779 input history we still use _i. Did this b/c these variable are
4800 input history we still use _i. Did this b/c these variable are
4780 very commonly used in interactive work, so the less we need to
4801 very commonly used in interactive work, so the less we need to
4781 type the better off we are.
4802 type the better off we are.
4782 (Magic.magic_prun): updated @prun to better handle the namespaces
4803 (Magic.magic_prun): updated @prun to better handle the namespaces
4783 the file will run in, including a fix for __name__ not being set
4804 the file will run in, including a fix for __name__ not being set
4784 before.
4805 before.
4785
4806
4786 2002-01-20 Fernando Perez <fperez@colorado.edu>
4807 2002-01-20 Fernando Perez <fperez@colorado.edu>
4787
4808
4788 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4809 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4789 extra garbage for Python 2.2. Need to look more carefully into
4810 extra garbage for Python 2.2. Need to look more carefully into
4790 this later.
4811 this later.
4791
4812
4792 2002-01-19 Fernando Perez <fperez@colorado.edu>
4813 2002-01-19 Fernando Perez <fperez@colorado.edu>
4793
4814
4794 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4815 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4795 display SyntaxError exceptions properly formatted when they occur
4816 display SyntaxError exceptions properly formatted when they occur
4796 (they can be triggered by imported code).
4817 (they can be triggered by imported code).
4797
4818
4798 2002-01-18 Fernando Perez <fperez@colorado.edu>
4819 2002-01-18 Fernando Perez <fperez@colorado.edu>
4799
4820
4800 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4821 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4801 SyntaxError exceptions are reported nicely formatted, instead of
4822 SyntaxError exceptions are reported nicely formatted, instead of
4802 spitting out only offset information as before.
4823 spitting out only offset information as before.
4803 (Magic.magic_prun): Added the @prun function for executing
4824 (Magic.magic_prun): Added the @prun function for executing
4804 programs with command line args inside IPython.
4825 programs with command line args inside IPython.
4805
4826
4806 2002-01-16 Fernando Perez <fperez@colorado.edu>
4827 2002-01-16 Fernando Perez <fperez@colorado.edu>
4807
4828
4808 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4829 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4809 to *not* include the last item given in a range. This brings their
4830 to *not* include the last item given in a range. This brings their
4810 behavior in line with Python's slicing:
4831 behavior in line with Python's slicing:
4811 a[n1:n2] -> a[n1]...a[n2-1]
4832 a[n1:n2] -> a[n1]...a[n2-1]
4812 It may be a bit less convenient, but I prefer to stick to Python's
4833 It may be a bit less convenient, but I prefer to stick to Python's
4813 conventions *everywhere*, so users never have to wonder.
4834 conventions *everywhere*, so users never have to wonder.
4814 (Magic.magic_macro): Added @macro function to ease the creation of
4835 (Magic.magic_macro): Added @macro function to ease the creation of
4815 macros.
4836 macros.
4816
4837
4817 2002-01-05 Fernando Perez <fperez@colorado.edu>
4838 2002-01-05 Fernando Perez <fperez@colorado.edu>
4818
4839
4819 * Released 0.2.4.
4840 * Released 0.2.4.
4820
4841
4821 * IPython/iplib.py (Magic.magic_pdef):
4842 * IPython/iplib.py (Magic.magic_pdef):
4822 (InteractiveShell.safe_execfile): report magic lines and error
4843 (InteractiveShell.safe_execfile): report magic lines and error
4823 lines without line numbers so one can easily copy/paste them for
4844 lines without line numbers so one can easily copy/paste them for
4824 re-execution.
4845 re-execution.
4825
4846
4826 * Updated manual with recent changes.
4847 * Updated manual with recent changes.
4827
4848
4828 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4849 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4829 docstring printing when class? is called. Very handy for knowing
4850 docstring printing when class? is called. Very handy for knowing
4830 how to create class instances (as long as __init__ is well
4851 how to create class instances (as long as __init__ is well
4831 documented, of course :)
4852 documented, of course :)
4832 (Magic.magic_doc): print both class and constructor docstrings.
4853 (Magic.magic_doc): print both class and constructor docstrings.
4833 (Magic.magic_pdef): give constructor info if passed a class and
4854 (Magic.magic_pdef): give constructor info if passed a class and
4834 __call__ info for callable object instances.
4855 __call__ info for callable object instances.
4835
4856
4836 2002-01-04 Fernando Perez <fperez@colorado.edu>
4857 2002-01-04 Fernando Perez <fperez@colorado.edu>
4837
4858
4838 * Made deep_reload() off by default. It doesn't always work
4859 * Made deep_reload() off by default. It doesn't always work
4839 exactly as intended, so it's probably safer to have it off. It's
4860 exactly as intended, so it's probably safer to have it off. It's
4840 still available as dreload() anyway, so nothing is lost.
4861 still available as dreload() anyway, so nothing is lost.
4841
4862
4842 2002-01-02 Fernando Perez <fperez@colorado.edu>
4863 2002-01-02 Fernando Perez <fperez@colorado.edu>
4843
4864
4844 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4865 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4845 so I wanted an updated release).
4866 so I wanted an updated release).
4846
4867
4847 2001-12-27 Fernando Perez <fperez@colorado.edu>
4868 2001-12-27 Fernando Perez <fperez@colorado.edu>
4848
4869
4849 * IPython/iplib.py (InteractiveShell.interact): Added the original
4870 * IPython/iplib.py (InteractiveShell.interact): Added the original
4850 code from 'code.py' for this module in order to change the
4871 code from 'code.py' for this module in order to change the
4851 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4872 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4852 the history cache would break when the user hit Ctrl-C, and
4873 the history cache would break when the user hit Ctrl-C, and
4853 interact() offers no way to add any hooks to it.
4874 interact() offers no way to add any hooks to it.
4854
4875
4855 2001-12-23 Fernando Perez <fperez@colorado.edu>
4876 2001-12-23 Fernando Perez <fperez@colorado.edu>
4856
4877
4857 * setup.py: added check for 'MANIFEST' before trying to remove
4878 * setup.py: added check for 'MANIFEST' before trying to remove
4858 it. Thanks to Sean Reifschneider.
4879 it. Thanks to Sean Reifschneider.
4859
4880
4860 2001-12-22 Fernando Perez <fperez@colorado.edu>
4881 2001-12-22 Fernando Perez <fperez@colorado.edu>
4861
4882
4862 * Released 0.2.2.
4883 * Released 0.2.2.
4863
4884
4864 * Finished (reasonably) writing the manual. Later will add the
4885 * Finished (reasonably) writing the manual. Later will add the
4865 python-standard navigation stylesheets, but for the time being
4886 python-standard navigation stylesheets, but for the time being
4866 it's fairly complete. Distribution will include html and pdf
4887 it's fairly complete. Distribution will include html and pdf
4867 versions.
4888 versions.
4868
4889
4869 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4890 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4870 (MayaVi author).
4891 (MayaVi author).
4871
4892
4872 2001-12-21 Fernando Perez <fperez@colorado.edu>
4893 2001-12-21 Fernando Perez <fperez@colorado.edu>
4873
4894
4874 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4895 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4875 good public release, I think (with the manual and the distutils
4896 good public release, I think (with the manual and the distutils
4876 installer). The manual can use some work, but that can go
4897 installer). The manual can use some work, but that can go
4877 slowly. Otherwise I think it's quite nice for end users. Next
4898 slowly. Otherwise I think it's quite nice for end users. Next
4878 summer, rewrite the guts of it...
4899 summer, rewrite the guts of it...
4879
4900
4880 * Changed format of ipythonrc files to use whitespace as the
4901 * Changed format of ipythonrc files to use whitespace as the
4881 separator instead of an explicit '='. Cleaner.
4902 separator instead of an explicit '='. Cleaner.
4882
4903
4883 2001-12-20 Fernando Perez <fperez@colorado.edu>
4904 2001-12-20 Fernando Perez <fperez@colorado.edu>
4884
4905
4885 * Started a manual in LyX. For now it's just a quick merge of the
4906 * Started a manual in LyX. For now it's just a quick merge of the
4886 various internal docstrings and READMEs. Later it may grow into a
4907 various internal docstrings and READMEs. Later it may grow into a
4887 nice, full-blown manual.
4908 nice, full-blown manual.
4888
4909
4889 * Set up a distutils based installer. Installation should now be
4910 * Set up a distutils based installer. Installation should now be
4890 trivially simple for end-users.
4911 trivially simple for end-users.
4891
4912
4892 2001-12-11 Fernando Perez <fperez@colorado.edu>
4913 2001-12-11 Fernando Perez <fperez@colorado.edu>
4893
4914
4894 * Released 0.2.0. First public release, announced it at
4915 * Released 0.2.0. First public release, announced it at
4895 comp.lang.python. From now on, just bugfixes...
4916 comp.lang.python. From now on, just bugfixes...
4896
4917
4897 * Went through all the files, set copyright/license notices and
4918 * Went through all the files, set copyright/license notices and
4898 cleaned up things. Ready for release.
4919 cleaned up things. Ready for release.
4899
4920
4900 2001-12-10 Fernando Perez <fperez@colorado.edu>
4921 2001-12-10 Fernando Perez <fperez@colorado.edu>
4901
4922
4902 * Changed the first-time installer not to use tarfiles. It's more
4923 * Changed the first-time installer not to use tarfiles. It's more
4903 robust now and less unix-dependent. Also makes it easier for
4924 robust now and less unix-dependent. Also makes it easier for
4904 people to later upgrade versions.
4925 people to later upgrade versions.
4905
4926
4906 * Changed @exit to @abort to reflect the fact that it's pretty
4927 * Changed @exit to @abort to reflect the fact that it's pretty
4907 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4928 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4908 becomes significant only when IPyhton is embedded: in that case,
4929 becomes significant only when IPyhton is embedded: in that case,
4909 C-D closes IPython only, but @abort kills the enclosing program
4930 C-D closes IPython only, but @abort kills the enclosing program
4910 too (unless it had called IPython inside a try catching
4931 too (unless it had called IPython inside a try catching
4911 SystemExit).
4932 SystemExit).
4912
4933
4913 * Created Shell module which exposes the actuall IPython Shell
4934 * Created Shell module which exposes the actuall IPython Shell
4914 classes, currently the normal and the embeddable one. This at
4935 classes, currently the normal and the embeddable one. This at
4915 least offers a stable interface we won't need to change when
4936 least offers a stable interface we won't need to change when
4916 (later) the internals are rewritten. That rewrite will be confined
4937 (later) the internals are rewritten. That rewrite will be confined
4917 to iplib and ipmaker, but the Shell interface should remain as is.
4938 to iplib and ipmaker, but the Shell interface should remain as is.
4918
4939
4919 * Added embed module which offers an embeddable IPShell object,
4940 * Added embed module which offers an embeddable IPShell object,
4920 useful to fire up IPython *inside* a running program. Great for
4941 useful to fire up IPython *inside* a running program. Great for
4921 debugging or dynamical data analysis.
4942 debugging or dynamical data analysis.
4922
4943
4923 2001-12-08 Fernando Perez <fperez@colorado.edu>
4944 2001-12-08 Fernando Perez <fperez@colorado.edu>
4924
4945
4925 * Fixed small bug preventing seeing info from methods of defined
4946 * Fixed small bug preventing seeing info from methods of defined
4926 objects (incorrect namespace in _ofind()).
4947 objects (incorrect namespace in _ofind()).
4927
4948
4928 * Documentation cleanup. Moved the main usage docstrings to a
4949 * Documentation cleanup. Moved the main usage docstrings to a
4929 separate file, usage.py (cleaner to maintain, and hopefully in the
4950 separate file, usage.py (cleaner to maintain, and hopefully in the
4930 future some perlpod-like way of producing interactive, man and
4951 future some perlpod-like way of producing interactive, man and
4931 html docs out of it will be found).
4952 html docs out of it will be found).
4932
4953
4933 * Added @profile to see your profile at any time.
4954 * Added @profile to see your profile at any time.
4934
4955
4935 * Added @p as an alias for 'print'. It's especially convenient if
4956 * Added @p as an alias for 'print'. It's especially convenient if
4936 using automagic ('p x' prints x).
4957 using automagic ('p x' prints x).
4937
4958
4938 * Small cleanups and fixes after a pychecker run.
4959 * Small cleanups and fixes after a pychecker run.
4939
4960
4940 * Changed the @cd command to handle @cd - and @cd -<n> for
4961 * Changed the @cd command to handle @cd - and @cd -<n> for
4941 visiting any directory in _dh.
4962 visiting any directory in _dh.
4942
4963
4943 * Introduced _dh, a history of visited directories. @dhist prints
4964 * Introduced _dh, a history of visited directories. @dhist prints
4944 it out with numbers.
4965 it out with numbers.
4945
4966
4946 2001-12-07 Fernando Perez <fperez@colorado.edu>
4967 2001-12-07 Fernando Perez <fperez@colorado.edu>
4947
4968
4948 * Released 0.1.22
4969 * Released 0.1.22
4949
4970
4950 * Made initialization a bit more robust against invalid color
4971 * Made initialization a bit more robust against invalid color
4951 options in user input (exit, not traceback-crash).
4972 options in user input (exit, not traceback-crash).
4952
4973
4953 * Changed the bug crash reporter to write the report only in the
4974 * Changed the bug crash reporter to write the report only in the
4954 user's .ipython directory. That way IPython won't litter people's
4975 user's .ipython directory. That way IPython won't litter people's
4955 hard disks with crash files all over the place. Also print on
4976 hard disks with crash files all over the place. Also print on
4956 screen the necessary mail command.
4977 screen the necessary mail command.
4957
4978
4958 * With the new ultraTB, implemented LightBG color scheme for light
4979 * With the new ultraTB, implemented LightBG color scheme for light
4959 background terminals. A lot of people like white backgrounds, so I
4980 background terminals. A lot of people like white backgrounds, so I
4960 guess we should at least give them something readable.
4981 guess we should at least give them something readable.
4961
4982
4962 2001-12-06 Fernando Perez <fperez@colorado.edu>
4983 2001-12-06 Fernando Perez <fperez@colorado.edu>
4963
4984
4964 * Modified the structure of ultraTB. Now there's a proper class
4985 * Modified the structure of ultraTB. Now there's a proper class
4965 for tables of color schemes which allow adding schemes easily and
4986 for tables of color schemes which allow adding schemes easily and
4966 switching the active scheme without creating a new instance every
4987 switching the active scheme without creating a new instance every
4967 time (which was ridiculous). The syntax for creating new schemes
4988 time (which was ridiculous). The syntax for creating new schemes
4968 is also cleaner. I think ultraTB is finally done, with a clean
4989 is also cleaner. I think ultraTB is finally done, with a clean
4969 class structure. Names are also much cleaner (now there's proper
4990 class structure. Names are also much cleaner (now there's proper
4970 color tables, no need for every variable to also have 'color' in
4991 color tables, no need for every variable to also have 'color' in
4971 its name).
4992 its name).
4972
4993
4973 * Broke down genutils into separate files. Now genutils only
4994 * Broke down genutils into separate files. Now genutils only
4974 contains utility functions, and classes have been moved to their
4995 contains utility functions, and classes have been moved to their
4975 own files (they had enough independent functionality to warrant
4996 own files (they had enough independent functionality to warrant
4976 it): ConfigLoader, OutputTrap, Struct.
4997 it): ConfigLoader, OutputTrap, Struct.
4977
4998
4978 2001-12-05 Fernando Perez <fperez@colorado.edu>
4999 2001-12-05 Fernando Perez <fperez@colorado.edu>
4979
5000
4980 * IPython turns 21! Released version 0.1.21, as a candidate for
5001 * IPython turns 21! Released version 0.1.21, as a candidate for
4981 public consumption. If all goes well, release in a few days.
5002 public consumption. If all goes well, release in a few days.
4982
5003
4983 * Fixed path bug (files in Extensions/ directory wouldn't be found
5004 * Fixed path bug (files in Extensions/ directory wouldn't be found
4984 unless IPython/ was explicitly in sys.path).
5005 unless IPython/ was explicitly in sys.path).
4985
5006
4986 * Extended the FlexCompleter class as MagicCompleter to allow
5007 * Extended the FlexCompleter class as MagicCompleter to allow
4987 completion of @-starting lines.
5008 completion of @-starting lines.
4988
5009
4989 * Created __release__.py file as a central repository for release
5010 * Created __release__.py file as a central repository for release
4990 info that other files can read from.
5011 info that other files can read from.
4991
5012
4992 * Fixed small bug in logging: when logging was turned on in
5013 * Fixed small bug in logging: when logging was turned on in
4993 mid-session, old lines with special meanings (!@?) were being
5014 mid-session, old lines with special meanings (!@?) were being
4994 logged without the prepended comment, which is necessary since
5015 logged without the prepended comment, which is necessary since
4995 they are not truly valid python syntax. This should make session
5016 they are not truly valid python syntax. This should make session
4996 restores produce less errors.
5017 restores produce less errors.
4997
5018
4998 * The namespace cleanup forced me to make a FlexCompleter class
5019 * The namespace cleanup forced me to make a FlexCompleter class
4999 which is nothing but a ripoff of rlcompleter, but with selectable
5020 which is nothing but a ripoff of rlcompleter, but with selectable
5000 namespace (rlcompleter only works in __main__.__dict__). I'll try
5021 namespace (rlcompleter only works in __main__.__dict__). I'll try
5001 to submit a note to the authors to see if this change can be
5022 to submit a note to the authors to see if this change can be
5002 incorporated in future rlcompleter releases (Dec.6: done)
5023 incorporated in future rlcompleter releases (Dec.6: done)
5003
5024
5004 * More fixes to namespace handling. It was a mess! Now all
5025 * More fixes to namespace handling. It was a mess! Now all
5005 explicit references to __main__.__dict__ are gone (except when
5026 explicit references to __main__.__dict__ are gone (except when
5006 really needed) and everything is handled through the namespace
5027 really needed) and everything is handled through the namespace
5007 dicts in the IPython instance. We seem to be getting somewhere
5028 dicts in the IPython instance. We seem to be getting somewhere
5008 with this, finally...
5029 with this, finally...
5009
5030
5010 * Small documentation updates.
5031 * Small documentation updates.
5011
5032
5012 * Created the Extensions directory under IPython (with an
5033 * Created the Extensions directory under IPython (with an
5013 __init__.py). Put the PhysicalQ stuff there. This directory should
5034 __init__.py). Put the PhysicalQ stuff there. This directory should
5014 be used for all special-purpose extensions.
5035 be used for all special-purpose extensions.
5015
5036
5016 * File renaming:
5037 * File renaming:
5017 ipythonlib --> ipmaker
5038 ipythonlib --> ipmaker
5018 ipplib --> iplib
5039 ipplib --> iplib
5019 This makes a bit more sense in terms of what these files actually do.
5040 This makes a bit more sense in terms of what these files actually do.
5020
5041
5021 * Moved all the classes and functions in ipythonlib to ipplib, so
5042 * Moved all the classes and functions in ipythonlib to ipplib, so
5022 now ipythonlib only has make_IPython(). This will ease up its
5043 now ipythonlib only has make_IPython(). This will ease up its
5023 splitting in smaller functional chunks later.
5044 splitting in smaller functional chunks later.
5024
5045
5025 * Cleaned up (done, I think) output of @whos. Better column
5046 * Cleaned up (done, I think) output of @whos. Better column
5026 formatting, and now shows str(var) for as much as it can, which is
5047 formatting, and now shows str(var) for as much as it can, which is
5027 typically what one gets with a 'print var'.
5048 typically what one gets with a 'print var'.
5028
5049
5029 2001-12-04 Fernando Perez <fperez@colorado.edu>
5050 2001-12-04 Fernando Perez <fperez@colorado.edu>
5030
5051
5031 * Fixed namespace problems. Now builtin/IPyhton/user names get
5052 * Fixed namespace problems. Now builtin/IPyhton/user names get
5032 properly reported in their namespace. Internal namespace handling
5053 properly reported in their namespace. Internal namespace handling
5033 is finally getting decent (not perfect yet, but much better than
5054 is finally getting decent (not perfect yet, but much better than
5034 the ad-hoc mess we had).
5055 the ad-hoc mess we had).
5035
5056
5036 * Removed -exit option. If people just want to run a python
5057 * Removed -exit option. If people just want to run a python
5037 script, that's what the normal interpreter is for. Less
5058 script, that's what the normal interpreter is for. Less
5038 unnecessary options, less chances for bugs.
5059 unnecessary options, less chances for bugs.
5039
5060
5040 * Added a crash handler which generates a complete post-mortem if
5061 * Added a crash handler which generates a complete post-mortem if
5041 IPython crashes. This will help a lot in tracking bugs down the
5062 IPython crashes. This will help a lot in tracking bugs down the
5042 road.
5063 road.
5043
5064
5044 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5065 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5045 which were boud to functions being reassigned would bypass the
5066 which were boud to functions being reassigned would bypass the
5046 logger, breaking the sync of _il with the prompt counter. This
5067 logger, breaking the sync of _il with the prompt counter. This
5047 would then crash IPython later when a new line was logged.
5068 would then crash IPython later when a new line was logged.
5048
5069
5049 2001-12-02 Fernando Perez <fperez@colorado.edu>
5070 2001-12-02 Fernando Perez <fperez@colorado.edu>
5050
5071
5051 * Made IPython a package. This means people don't have to clutter
5072 * Made IPython a package. This means people don't have to clutter
5052 their sys.path with yet another directory. Changed the INSTALL
5073 their sys.path with yet another directory. Changed the INSTALL
5053 file accordingly.
5074 file accordingly.
5054
5075
5055 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5076 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5056 sorts its output (so @who shows it sorted) and @whos formats the
5077 sorts its output (so @who shows it sorted) and @whos formats the
5057 table according to the width of the first column. Nicer, easier to
5078 table according to the width of the first column. Nicer, easier to
5058 read. Todo: write a generic table_format() which takes a list of
5079 read. Todo: write a generic table_format() which takes a list of
5059 lists and prints it nicely formatted, with optional row/column
5080 lists and prints it nicely formatted, with optional row/column
5060 separators and proper padding and justification.
5081 separators and proper padding and justification.
5061
5082
5062 * Released 0.1.20
5083 * Released 0.1.20
5063
5084
5064 * Fixed bug in @log which would reverse the inputcache list (a
5085 * Fixed bug in @log which would reverse the inputcache list (a
5065 copy operation was missing).
5086 copy operation was missing).
5066
5087
5067 * Code cleanup. @config was changed to use page(). Better, since
5088 * Code cleanup. @config was changed to use page(). Better, since
5068 its output is always quite long.
5089 its output is always quite long.
5069
5090
5070 * Itpl is back as a dependency. I was having too many problems
5091 * Itpl is back as a dependency. I was having too many problems
5071 getting the parametric aliases to work reliably, and it's just
5092 getting the parametric aliases to work reliably, and it's just
5072 easier to code weird string operations with it than playing %()s
5093 easier to code weird string operations with it than playing %()s
5073 games. It's only ~6k, so I don't think it's too big a deal.
5094 games. It's only ~6k, so I don't think it's too big a deal.
5074
5095
5075 * Found (and fixed) a very nasty bug with history. !lines weren't
5096 * Found (and fixed) a very nasty bug with history. !lines weren't
5076 getting cached, and the out of sync caches would crash
5097 getting cached, and the out of sync caches would crash
5077 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5098 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5078 division of labor a bit better. Bug fixed, cleaner structure.
5099 division of labor a bit better. Bug fixed, cleaner structure.
5079
5100
5080 2001-12-01 Fernando Perez <fperez@colorado.edu>
5101 2001-12-01 Fernando Perez <fperez@colorado.edu>
5081
5102
5082 * Released 0.1.19
5103 * Released 0.1.19
5083
5104
5084 * Added option -n to @hist to prevent line number printing. Much
5105 * Added option -n to @hist to prevent line number printing. Much
5085 easier to copy/paste code this way.
5106 easier to copy/paste code this way.
5086
5107
5087 * Created global _il to hold the input list. Allows easy
5108 * Created global _il to hold the input list. Allows easy
5088 re-execution of blocks of code by slicing it (inspired by Janko's
5109 re-execution of blocks of code by slicing it (inspired by Janko's
5089 comment on 'macros').
5110 comment on 'macros').
5090
5111
5091 * Small fixes and doc updates.
5112 * Small fixes and doc updates.
5092
5113
5093 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5114 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5094 much too fragile with automagic. Handles properly multi-line
5115 much too fragile with automagic. Handles properly multi-line
5095 statements and takes parameters.
5116 statements and takes parameters.
5096
5117
5097 2001-11-30 Fernando Perez <fperez@colorado.edu>
5118 2001-11-30 Fernando Perez <fperez@colorado.edu>
5098
5119
5099 * Version 0.1.18 released.
5120 * Version 0.1.18 released.
5100
5121
5101 * Fixed nasty namespace bug in initial module imports.
5122 * Fixed nasty namespace bug in initial module imports.
5102
5123
5103 * Added copyright/license notes to all code files (except
5124 * Added copyright/license notes to all code files (except
5104 DPyGetOpt). For the time being, LGPL. That could change.
5125 DPyGetOpt). For the time being, LGPL. That could change.
5105
5126
5106 * Rewrote a much nicer README, updated INSTALL, cleaned up
5127 * Rewrote a much nicer README, updated INSTALL, cleaned up
5107 ipythonrc-* samples.
5128 ipythonrc-* samples.
5108
5129
5109 * Overall code/documentation cleanup. Basically ready for
5130 * Overall code/documentation cleanup. Basically ready for
5110 release. Only remaining thing: licence decision (LGPL?).
5131 release. Only remaining thing: licence decision (LGPL?).
5111
5132
5112 * Converted load_config to a class, ConfigLoader. Now recursion
5133 * Converted load_config to a class, ConfigLoader. Now recursion
5113 control is better organized. Doesn't include the same file twice.
5134 control is better organized. Doesn't include the same file twice.
5114
5135
5115 2001-11-29 Fernando Perez <fperez@colorado.edu>
5136 2001-11-29 Fernando Perez <fperez@colorado.edu>
5116
5137
5117 * Got input history working. Changed output history variables from
5138 * Got input history working. Changed output history variables from
5118 _p to _o so that _i is for input and _o for output. Just cleaner
5139 _p to _o so that _i is for input and _o for output. Just cleaner
5119 convention.
5140 convention.
5120
5141
5121 * Implemented parametric aliases. This pretty much allows the
5142 * Implemented parametric aliases. This pretty much allows the
5122 alias system to offer full-blown shell convenience, I think.
5143 alias system to offer full-blown shell convenience, I think.
5123
5144
5124 * Version 0.1.17 released, 0.1.18 opened.
5145 * Version 0.1.17 released, 0.1.18 opened.
5125
5146
5126 * dot_ipython/ipythonrc (alias): added documentation.
5147 * dot_ipython/ipythonrc (alias): added documentation.
5127 (xcolor): Fixed small bug (xcolors -> xcolor)
5148 (xcolor): Fixed small bug (xcolors -> xcolor)
5128
5149
5129 * Changed the alias system. Now alias is a magic command to define
5150 * Changed the alias system. Now alias is a magic command to define
5130 aliases just like the shell. Rationale: the builtin magics should
5151 aliases just like the shell. Rationale: the builtin magics should
5131 be there for things deeply connected to IPython's
5152 be there for things deeply connected to IPython's
5132 architecture. And this is a much lighter system for what I think
5153 architecture. And this is a much lighter system for what I think
5133 is the really important feature: allowing users to define quickly
5154 is the really important feature: allowing users to define quickly
5134 magics that will do shell things for them, so they can customize
5155 magics that will do shell things for them, so they can customize
5135 IPython easily to match their work habits. If someone is really
5156 IPython easily to match their work habits. If someone is really
5136 desperate to have another name for a builtin alias, they can
5157 desperate to have another name for a builtin alias, they can
5137 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5158 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5138 works.
5159 works.
5139
5160
5140 2001-11-28 Fernando Perez <fperez@colorado.edu>
5161 2001-11-28 Fernando Perez <fperez@colorado.edu>
5141
5162
5142 * Changed @file so that it opens the source file at the proper
5163 * Changed @file so that it opens the source file at the proper
5143 line. Since it uses less, if your EDITOR environment is
5164 line. Since it uses less, if your EDITOR environment is
5144 configured, typing v will immediately open your editor of choice
5165 configured, typing v will immediately open your editor of choice
5145 right at the line where the object is defined. Not as quick as
5166 right at the line where the object is defined. Not as quick as
5146 having a direct @edit command, but for all intents and purposes it
5167 having a direct @edit command, but for all intents and purposes it
5147 works. And I don't have to worry about writing @edit to deal with
5168 works. And I don't have to worry about writing @edit to deal with
5148 all the editors, less does that.
5169 all the editors, less does that.
5149
5170
5150 * Version 0.1.16 released, 0.1.17 opened.
5171 * Version 0.1.16 released, 0.1.17 opened.
5151
5172
5152 * Fixed some nasty bugs in the page/page_dumb combo that could
5173 * Fixed some nasty bugs in the page/page_dumb combo that could
5153 crash IPython.
5174 crash IPython.
5154
5175
5155 2001-11-27 Fernando Perez <fperez@colorado.edu>
5176 2001-11-27 Fernando Perez <fperez@colorado.edu>
5156
5177
5157 * Version 0.1.15 released, 0.1.16 opened.
5178 * Version 0.1.15 released, 0.1.16 opened.
5158
5179
5159 * Finally got ? and ?? to work for undefined things: now it's
5180 * Finally got ? and ?? to work for undefined things: now it's
5160 possible to type {}.get? and get information about the get method
5181 possible to type {}.get? and get information about the get method
5161 of dicts, or os.path? even if only os is defined (so technically
5182 of dicts, or os.path? even if only os is defined (so technically
5162 os.path isn't). Works at any level. For example, after import os,
5183 os.path isn't). Works at any level. For example, after import os,
5163 os?, os.path?, os.path.abspath? all work. This is great, took some
5184 os?, os.path?, os.path.abspath? all work. This is great, took some
5164 work in _ofind.
5185 work in _ofind.
5165
5186
5166 * Fixed more bugs with logging. The sanest way to do it was to add
5187 * Fixed more bugs with logging. The sanest way to do it was to add
5167 to @log a 'mode' parameter. Killed two in one shot (this mode
5188 to @log a 'mode' parameter. Killed two in one shot (this mode
5168 option was a request of Janko's). I think it's finally clean
5189 option was a request of Janko's). I think it's finally clean
5169 (famous last words).
5190 (famous last words).
5170
5191
5171 * Added a page_dumb() pager which does a decent job of paging on
5192 * Added a page_dumb() pager which does a decent job of paging on
5172 screen, if better things (like less) aren't available. One less
5193 screen, if better things (like less) aren't available. One less
5173 unix dependency (someday maybe somebody will port this to
5194 unix dependency (someday maybe somebody will port this to
5174 windows).
5195 windows).
5175
5196
5176 * Fixed problem in magic_log: would lock of logging out if log
5197 * Fixed problem in magic_log: would lock of logging out if log
5177 creation failed (because it would still think it had succeeded).
5198 creation failed (because it would still think it had succeeded).
5178
5199
5179 * Improved the page() function using curses to auto-detect screen
5200 * Improved the page() function using curses to auto-detect screen
5180 size. Now it can make a much better decision on whether to print
5201 size. Now it can make a much better decision on whether to print
5181 or page a string. Option screen_length was modified: a value 0
5202 or page a string. Option screen_length was modified: a value 0
5182 means auto-detect, and that's the default now.
5203 means auto-detect, and that's the default now.
5183
5204
5184 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5205 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5185 go out. I'll test it for a few days, then talk to Janko about
5206 go out. I'll test it for a few days, then talk to Janko about
5186 licences and announce it.
5207 licences and announce it.
5187
5208
5188 * Fixed the length of the auto-generated ---> prompt which appears
5209 * Fixed the length of the auto-generated ---> prompt which appears
5189 for auto-parens and auto-quotes. Getting this right isn't trivial,
5210 for auto-parens and auto-quotes. Getting this right isn't trivial,
5190 with all the color escapes, different prompt types and optional
5211 with all the color escapes, different prompt types and optional
5191 separators. But it seems to be working in all the combinations.
5212 separators. But it seems to be working in all the combinations.
5192
5213
5193 2001-11-26 Fernando Perez <fperez@colorado.edu>
5214 2001-11-26 Fernando Perez <fperez@colorado.edu>
5194
5215
5195 * Wrote a regexp filter to get option types from the option names
5216 * Wrote a regexp filter to get option types from the option names
5196 string. This eliminates the need to manually keep two duplicate
5217 string. This eliminates the need to manually keep two duplicate
5197 lists.
5218 lists.
5198
5219
5199 * Removed the unneeded check_option_names. Now options are handled
5220 * Removed the unneeded check_option_names. Now options are handled
5200 in a much saner manner and it's easy to visually check that things
5221 in a much saner manner and it's easy to visually check that things
5201 are ok.
5222 are ok.
5202
5223
5203 * Updated version numbers on all files I modified to carry a
5224 * Updated version numbers on all files I modified to carry a
5204 notice so Janko and Nathan have clear version markers.
5225 notice so Janko and Nathan have clear version markers.
5205
5226
5206 * Updated docstring for ultraTB with my changes. I should send
5227 * Updated docstring for ultraTB with my changes. I should send
5207 this to Nathan.
5228 this to Nathan.
5208
5229
5209 * Lots of small fixes. Ran everything through pychecker again.
5230 * Lots of small fixes. Ran everything through pychecker again.
5210
5231
5211 * Made loading of deep_reload an cmd line option. If it's not too
5232 * Made loading of deep_reload an cmd line option. If it's not too
5212 kosher, now people can just disable it. With -nodeep_reload it's
5233 kosher, now people can just disable it. With -nodeep_reload it's
5213 still available as dreload(), it just won't overwrite reload().
5234 still available as dreload(), it just won't overwrite reload().
5214
5235
5215 * Moved many options to the no| form (-opt and -noopt
5236 * Moved many options to the no| form (-opt and -noopt
5216 accepted). Cleaner.
5237 accepted). Cleaner.
5217
5238
5218 * Changed magic_log so that if called with no parameters, it uses
5239 * Changed magic_log so that if called with no parameters, it uses
5219 'rotate' mode. That way auto-generated logs aren't automatically
5240 'rotate' mode. That way auto-generated logs aren't automatically
5220 over-written. For normal logs, now a backup is made if it exists
5241 over-written. For normal logs, now a backup is made if it exists
5221 (only 1 level of backups). A new 'backup' mode was added to the
5242 (only 1 level of backups). A new 'backup' mode was added to the
5222 Logger class to support this. This was a request by Janko.
5243 Logger class to support this. This was a request by Janko.
5223
5244
5224 * Added @logoff/@logon to stop/restart an active log.
5245 * Added @logoff/@logon to stop/restart an active log.
5225
5246
5226 * Fixed a lot of bugs in log saving/replay. It was pretty
5247 * Fixed a lot of bugs in log saving/replay. It was pretty
5227 broken. Now special lines (!@,/) appear properly in the command
5248 broken. Now special lines (!@,/) appear properly in the command
5228 history after a log replay.
5249 history after a log replay.
5229
5250
5230 * Tried and failed to implement full session saving via pickle. My
5251 * Tried and failed to implement full session saving via pickle. My
5231 idea was to pickle __main__.__dict__, but modules can't be
5252 idea was to pickle __main__.__dict__, but modules can't be
5232 pickled. This would be a better alternative to replaying logs, but
5253 pickled. This would be a better alternative to replaying logs, but
5233 seems quite tricky to get to work. Changed -session to be called
5254 seems quite tricky to get to work. Changed -session to be called
5234 -logplay, which more accurately reflects what it does. And if we
5255 -logplay, which more accurately reflects what it does. And if we
5235 ever get real session saving working, -session is now available.
5256 ever get real session saving working, -session is now available.
5236
5257
5237 * Implemented color schemes for prompts also. As for tracebacks,
5258 * Implemented color schemes for prompts also. As for tracebacks,
5238 currently only NoColor and Linux are supported. But now the
5259 currently only NoColor and Linux are supported. But now the
5239 infrastructure is in place, based on a generic ColorScheme
5260 infrastructure is in place, based on a generic ColorScheme
5240 class. So writing and activating new schemes both for the prompts
5261 class. So writing and activating new schemes both for the prompts
5241 and the tracebacks should be straightforward.
5262 and the tracebacks should be straightforward.
5242
5263
5243 * Version 0.1.13 released, 0.1.14 opened.
5264 * Version 0.1.13 released, 0.1.14 opened.
5244
5265
5245 * Changed handling of options for output cache. Now counter is
5266 * Changed handling of options for output cache. Now counter is
5246 hardwired starting at 1 and one specifies the maximum number of
5267 hardwired starting at 1 and one specifies the maximum number of
5247 entries *in the outcache* (not the max prompt counter). This is
5268 entries *in the outcache* (not the max prompt counter). This is
5248 much better, since many statements won't increase the cache
5269 much better, since many statements won't increase the cache
5249 count. It also eliminated some confusing options, now there's only
5270 count. It also eliminated some confusing options, now there's only
5250 one: cache_size.
5271 one: cache_size.
5251
5272
5252 * Added 'alias' magic function and magic_alias option in the
5273 * Added 'alias' magic function and magic_alias option in the
5253 ipythonrc file. Now the user can easily define whatever names he
5274 ipythonrc file. Now the user can easily define whatever names he
5254 wants for the magic functions without having to play weird
5275 wants for the magic functions without having to play weird
5255 namespace games. This gives IPython a real shell-like feel.
5276 namespace games. This gives IPython a real shell-like feel.
5256
5277
5257 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5278 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5258 @ or not).
5279 @ or not).
5259
5280
5260 This was one of the last remaining 'visible' bugs (that I know
5281 This was one of the last remaining 'visible' bugs (that I know
5261 of). I think if I can clean up the session loading so it works
5282 of). I think if I can clean up the session loading so it works
5262 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5283 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5263 about licensing).
5284 about licensing).
5264
5285
5265 2001-11-25 Fernando Perez <fperez@colorado.edu>
5286 2001-11-25 Fernando Perez <fperez@colorado.edu>
5266
5287
5267 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5288 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5268 there's a cleaner distinction between what ? and ?? show.
5289 there's a cleaner distinction between what ? and ?? show.
5269
5290
5270 * Added screen_length option. Now the user can define his own
5291 * Added screen_length option. Now the user can define his own
5271 screen size for page() operations.
5292 screen size for page() operations.
5272
5293
5273 * Implemented magic shell-like functions with automatic code
5294 * Implemented magic shell-like functions with automatic code
5274 generation. Now adding another function is just a matter of adding
5295 generation. Now adding another function is just a matter of adding
5275 an entry to a dict, and the function is dynamically generated at
5296 an entry to a dict, and the function is dynamically generated at
5276 run-time. Python has some really cool features!
5297 run-time. Python has some really cool features!
5277
5298
5278 * Renamed many options to cleanup conventions a little. Now all
5299 * Renamed many options to cleanup conventions a little. Now all
5279 are lowercase, and only underscores where needed. Also in the code
5300 are lowercase, and only underscores where needed. Also in the code
5280 option name tables are clearer.
5301 option name tables are clearer.
5281
5302
5282 * Changed prompts a little. Now input is 'In [n]:' instead of
5303 * Changed prompts a little. Now input is 'In [n]:' instead of
5283 'In[n]:='. This allows it the numbers to be aligned with the
5304 'In[n]:='. This allows it the numbers to be aligned with the
5284 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5305 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5285 Python (it was a Mathematica thing). The '...' continuation prompt
5306 Python (it was a Mathematica thing). The '...' continuation prompt
5286 was also changed a little to align better.
5307 was also changed a little to align better.
5287
5308
5288 * Fixed bug when flushing output cache. Not all _p<n> variables
5309 * Fixed bug when flushing output cache. Not all _p<n> variables
5289 exist, so their deletion needs to be wrapped in a try:
5310 exist, so their deletion needs to be wrapped in a try:
5290
5311
5291 * Figured out how to properly use inspect.formatargspec() (it
5312 * Figured out how to properly use inspect.formatargspec() (it
5292 requires the args preceded by *). So I removed all the code from
5313 requires the args preceded by *). So I removed all the code from
5293 _get_pdef in Magic, which was just replicating that.
5314 _get_pdef in Magic, which was just replicating that.
5294
5315
5295 * Added test to prefilter to allow redefining magic function names
5316 * Added test to prefilter to allow redefining magic function names
5296 as variables. This is ok, since the @ form is always available,
5317 as variables. This is ok, since the @ form is always available,
5297 but whe should allow the user to define a variable called 'ls' if
5318 but whe should allow the user to define a variable called 'ls' if
5298 he needs it.
5319 he needs it.
5299
5320
5300 * Moved the ToDo information from README into a separate ToDo.
5321 * Moved the ToDo information from README into a separate ToDo.
5301
5322
5302 * General code cleanup and small bugfixes. I think it's close to a
5323 * General code cleanup and small bugfixes. I think it's close to a
5303 state where it can be released, obviously with a big 'beta'
5324 state where it can be released, obviously with a big 'beta'
5304 warning on it.
5325 warning on it.
5305
5326
5306 * Got the magic function split to work. Now all magics are defined
5327 * Got the magic function split to work. Now all magics are defined
5307 in a separate class. It just organizes things a bit, and now
5328 in a separate class. It just organizes things a bit, and now
5308 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5329 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5309 was too long).
5330 was too long).
5310
5331
5311 * Changed @clear to @reset to avoid potential confusions with
5332 * Changed @clear to @reset to avoid potential confusions with
5312 the shell command clear. Also renamed @cl to @clear, which does
5333 the shell command clear. Also renamed @cl to @clear, which does
5313 exactly what people expect it to from their shell experience.
5334 exactly what people expect it to from their shell experience.
5314
5335
5315 Added a check to the @reset command (since it's so
5336 Added a check to the @reset command (since it's so
5316 destructive, it's probably a good idea to ask for confirmation).
5337 destructive, it's probably a good idea to ask for confirmation).
5317 But now reset only works for full namespace resetting. Since the
5338 But now reset only works for full namespace resetting. Since the
5318 del keyword is already there for deleting a few specific
5339 del keyword is already there for deleting a few specific
5319 variables, I don't see the point of having a redundant magic
5340 variables, I don't see the point of having a redundant magic
5320 function for the same task.
5341 function for the same task.
5321
5342
5322 2001-11-24 Fernando Perez <fperez@colorado.edu>
5343 2001-11-24 Fernando Perez <fperez@colorado.edu>
5323
5344
5324 * Updated the builtin docs (esp. the ? ones).
5345 * Updated the builtin docs (esp. the ? ones).
5325
5346
5326 * Ran all the code through pychecker. Not terribly impressed with
5347 * Ran all the code through pychecker. Not terribly impressed with
5327 it: lots of spurious warnings and didn't really find anything of
5348 it: lots of spurious warnings and didn't really find anything of
5328 substance (just a few modules being imported and not used).
5349 substance (just a few modules being imported and not used).
5329
5350
5330 * Implemented the new ultraTB functionality into IPython. New
5351 * Implemented the new ultraTB functionality into IPython. New
5331 option: xcolors. This chooses color scheme. xmode now only selects
5352 option: xcolors. This chooses color scheme. xmode now only selects
5332 between Plain and Verbose. Better orthogonality.
5353 between Plain and Verbose. Better orthogonality.
5333
5354
5334 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5355 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5335 mode and color scheme for the exception handlers. Now it's
5356 mode and color scheme for the exception handlers. Now it's
5336 possible to have the verbose traceback with no coloring.
5357 possible to have the verbose traceback with no coloring.
5337
5358
5338 2001-11-23 Fernando Perez <fperez@colorado.edu>
5359 2001-11-23 Fernando Perez <fperez@colorado.edu>
5339
5360
5340 * Version 0.1.12 released, 0.1.13 opened.
5361 * Version 0.1.12 released, 0.1.13 opened.
5341
5362
5342 * Removed option to set auto-quote and auto-paren escapes by
5363 * Removed option to set auto-quote and auto-paren escapes by
5343 user. The chances of breaking valid syntax are just too high. If
5364 user. The chances of breaking valid syntax are just too high. If
5344 someone *really* wants, they can always dig into the code.
5365 someone *really* wants, they can always dig into the code.
5345
5366
5346 * Made prompt separators configurable.
5367 * Made prompt separators configurable.
5347
5368
5348 2001-11-22 Fernando Perez <fperez@colorado.edu>
5369 2001-11-22 Fernando Perez <fperez@colorado.edu>
5349
5370
5350 * Small bugfixes in many places.
5371 * Small bugfixes in many places.
5351
5372
5352 * Removed the MyCompleter class from ipplib. It seemed redundant
5373 * Removed the MyCompleter class from ipplib. It seemed redundant
5353 with the C-p,C-n history search functionality. Less code to
5374 with the C-p,C-n history search functionality. Less code to
5354 maintain.
5375 maintain.
5355
5376
5356 * Moved all the original ipython.py code into ipythonlib.py. Right
5377 * Moved all the original ipython.py code into ipythonlib.py. Right
5357 now it's just one big dump into a function called make_IPython, so
5378 now it's just one big dump into a function called make_IPython, so
5358 no real modularity has been gained. But at least it makes the
5379 no real modularity has been gained. But at least it makes the
5359 wrapper script tiny, and since ipythonlib is a module, it gets
5380 wrapper script tiny, and since ipythonlib is a module, it gets
5360 compiled and startup is much faster.
5381 compiled and startup is much faster.
5361
5382
5362 This is a reasobably 'deep' change, so we should test it for a
5383 This is a reasobably 'deep' change, so we should test it for a
5363 while without messing too much more with the code.
5384 while without messing too much more with the code.
5364
5385
5365 2001-11-21 Fernando Perez <fperez@colorado.edu>
5386 2001-11-21 Fernando Perez <fperez@colorado.edu>
5366
5387
5367 * Version 0.1.11 released, 0.1.12 opened for further work.
5388 * Version 0.1.11 released, 0.1.12 opened for further work.
5368
5389
5369 * Removed dependency on Itpl. It was only needed in one place. It
5390 * Removed dependency on Itpl. It was only needed in one place. It
5370 would be nice if this became part of python, though. It makes life
5391 would be nice if this became part of python, though. It makes life
5371 *a lot* easier in some cases.
5392 *a lot* easier in some cases.
5372
5393
5373 * Simplified the prefilter code a bit. Now all handlers are
5394 * Simplified the prefilter code a bit. Now all handlers are
5374 expected to explicitly return a value (at least a blank string).
5395 expected to explicitly return a value (at least a blank string).
5375
5396
5376 * Heavy edits in ipplib. Removed the help system altogether. Now
5397 * Heavy edits in ipplib. Removed the help system altogether. Now
5377 obj?/?? is used for inspecting objects, a magic @doc prints
5398 obj?/?? is used for inspecting objects, a magic @doc prints
5378 docstrings, and full-blown Python help is accessed via the 'help'
5399 docstrings, and full-blown Python help is accessed via the 'help'
5379 keyword. This cleans up a lot of code (less to maintain) and does
5400 keyword. This cleans up a lot of code (less to maintain) and does
5380 the job. Since 'help' is now a standard Python component, might as
5401 the job. Since 'help' is now a standard Python component, might as
5381 well use it and remove duplicate functionality.
5402 well use it and remove duplicate functionality.
5382
5403
5383 Also removed the option to use ipplib as a standalone program. By
5404 Also removed the option to use ipplib as a standalone program. By
5384 now it's too dependent on other parts of IPython to function alone.
5405 now it's too dependent on other parts of IPython to function alone.
5385
5406
5386 * Fixed bug in genutils.pager. It would crash if the pager was
5407 * Fixed bug in genutils.pager. It would crash if the pager was
5387 exited immediately after opening (broken pipe).
5408 exited immediately after opening (broken pipe).
5388
5409
5389 * Trimmed down the VerboseTB reporting a little. The header is
5410 * Trimmed down the VerboseTB reporting a little. The header is
5390 much shorter now and the repeated exception arguments at the end
5411 much shorter now and the repeated exception arguments at the end
5391 have been removed. For interactive use the old header seemed a bit
5412 have been removed. For interactive use the old header seemed a bit
5392 excessive.
5413 excessive.
5393
5414
5394 * Fixed small bug in output of @whos for variables with multi-word
5415 * Fixed small bug in output of @whos for variables with multi-word
5395 types (only first word was displayed).
5416 types (only first word was displayed).
5396
5417
5397 2001-11-17 Fernando Perez <fperez@colorado.edu>
5418 2001-11-17 Fernando Perez <fperez@colorado.edu>
5398
5419
5399 * Version 0.1.10 released, 0.1.11 opened for further work.
5420 * Version 0.1.10 released, 0.1.11 opened for further work.
5400
5421
5401 * Modified dirs and friends. dirs now *returns* the stack (not
5422 * Modified dirs and friends. dirs now *returns* the stack (not
5402 prints), so one can manipulate it as a variable. Convenient to
5423 prints), so one can manipulate it as a variable. Convenient to
5403 travel along many directories.
5424 travel along many directories.
5404
5425
5405 * Fixed bug in magic_pdef: would only work with functions with
5426 * Fixed bug in magic_pdef: would only work with functions with
5406 arguments with default values.
5427 arguments with default values.
5407
5428
5408 2001-11-14 Fernando Perez <fperez@colorado.edu>
5429 2001-11-14 Fernando Perez <fperez@colorado.edu>
5409
5430
5410 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5431 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5411 example with IPython. Various other minor fixes and cleanups.
5432 example with IPython. Various other minor fixes and cleanups.
5412
5433
5413 * Version 0.1.9 released, 0.1.10 opened for further work.
5434 * Version 0.1.9 released, 0.1.10 opened for further work.
5414
5435
5415 * Added sys.path to the list of directories searched in the
5436 * Added sys.path to the list of directories searched in the
5416 execfile= option. It used to be the current directory and the
5437 execfile= option. It used to be the current directory and the
5417 user's IPYTHONDIR only.
5438 user's IPYTHONDIR only.
5418
5439
5419 2001-11-13 Fernando Perez <fperez@colorado.edu>
5440 2001-11-13 Fernando Perez <fperez@colorado.edu>
5420
5441
5421 * Reinstated the raw_input/prefilter separation that Janko had
5442 * Reinstated the raw_input/prefilter separation that Janko had
5422 initially. This gives a more convenient setup for extending the
5443 initially. This gives a more convenient setup for extending the
5423 pre-processor from the outside: raw_input always gets a string,
5444 pre-processor from the outside: raw_input always gets a string,
5424 and prefilter has to process it. We can then redefine prefilter
5445 and prefilter has to process it. We can then redefine prefilter
5425 from the outside and implement extensions for special
5446 from the outside and implement extensions for special
5426 purposes.
5447 purposes.
5427
5448
5428 Today I got one for inputting PhysicalQuantity objects
5449 Today I got one for inputting PhysicalQuantity objects
5429 (from Scientific) without needing any function calls at
5450 (from Scientific) without needing any function calls at
5430 all. Extremely convenient, and it's all done as a user-level
5451 all. Extremely convenient, and it's all done as a user-level
5431 extension (no IPython code was touched). Now instead of:
5452 extension (no IPython code was touched). Now instead of:
5432 a = PhysicalQuantity(4.2,'m/s**2')
5453 a = PhysicalQuantity(4.2,'m/s**2')
5433 one can simply say
5454 one can simply say
5434 a = 4.2 m/s**2
5455 a = 4.2 m/s**2
5435 or even
5456 or even
5436 a = 4.2 m/s^2
5457 a = 4.2 m/s^2
5437
5458
5438 I use this, but it's also a proof of concept: IPython really is
5459 I use this, but it's also a proof of concept: IPython really is
5439 fully user-extensible, even at the level of the parsing of the
5460 fully user-extensible, even at the level of the parsing of the
5440 command line. It's not trivial, but it's perfectly doable.
5461 command line. It's not trivial, but it's perfectly doable.
5441
5462
5442 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5463 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5443 the problem of modules being loaded in the inverse order in which
5464 the problem of modules being loaded in the inverse order in which
5444 they were defined in
5465 they were defined in
5445
5466
5446 * Version 0.1.8 released, 0.1.9 opened for further work.
5467 * Version 0.1.8 released, 0.1.9 opened for further work.
5447
5468
5448 * Added magics pdef, source and file. They respectively show the
5469 * Added magics pdef, source and file. They respectively show the
5449 definition line ('prototype' in C), source code and full python
5470 definition line ('prototype' in C), source code and full python
5450 file for any callable object. The object inspector oinfo uses
5471 file for any callable object. The object inspector oinfo uses
5451 these to show the same information.
5472 these to show the same information.
5452
5473
5453 * Version 0.1.7 released, 0.1.8 opened for further work.
5474 * Version 0.1.7 released, 0.1.8 opened for further work.
5454
5475
5455 * Separated all the magic functions into a class called Magic. The
5476 * Separated all the magic functions into a class called Magic. The
5456 InteractiveShell class was becoming too big for Xemacs to handle
5477 InteractiveShell class was becoming too big for Xemacs to handle
5457 (de-indenting a line would lock it up for 10 seconds while it
5478 (de-indenting a line would lock it up for 10 seconds while it
5458 backtracked on the whole class!)
5479 backtracked on the whole class!)
5459
5480
5460 FIXME: didn't work. It can be done, but right now namespaces are
5481 FIXME: didn't work. It can be done, but right now namespaces are
5461 all messed up. Do it later (reverted it for now, so at least
5482 all messed up. Do it later (reverted it for now, so at least
5462 everything works as before).
5483 everything works as before).
5463
5484
5464 * Got the object introspection system (magic_oinfo) working! I
5485 * Got the object introspection system (magic_oinfo) working! I
5465 think this is pretty much ready for release to Janko, so he can
5486 think this is pretty much ready for release to Janko, so he can
5466 test it for a while and then announce it. Pretty much 100% of what
5487 test it for a while and then announce it. Pretty much 100% of what
5467 I wanted for the 'phase 1' release is ready. Happy, tired.
5488 I wanted for the 'phase 1' release is ready. Happy, tired.
5468
5489
5469 2001-11-12 Fernando Perez <fperez@colorado.edu>
5490 2001-11-12 Fernando Perez <fperez@colorado.edu>
5470
5491
5471 * Version 0.1.6 released, 0.1.7 opened for further work.
5492 * Version 0.1.6 released, 0.1.7 opened for further work.
5472
5493
5473 * Fixed bug in printing: it used to test for truth before
5494 * Fixed bug in printing: it used to test for truth before
5474 printing, so 0 wouldn't print. Now checks for None.
5495 printing, so 0 wouldn't print. Now checks for None.
5475
5496
5476 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5497 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5477 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5498 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5478 reaches by hand into the outputcache. Think of a better way to do
5499 reaches by hand into the outputcache. Think of a better way to do
5479 this later.
5500 this later.
5480
5501
5481 * Various small fixes thanks to Nathan's comments.
5502 * Various small fixes thanks to Nathan's comments.
5482
5503
5483 * Changed magic_pprint to magic_Pprint. This way it doesn't
5504 * Changed magic_pprint to magic_Pprint. This way it doesn't
5484 collide with pprint() and the name is consistent with the command
5505 collide with pprint() and the name is consistent with the command
5485 line option.
5506 line option.
5486
5507
5487 * Changed prompt counter behavior to be fully like
5508 * Changed prompt counter behavior to be fully like
5488 Mathematica's. That is, even input that doesn't return a result
5509 Mathematica's. That is, even input that doesn't return a result
5489 raises the prompt counter. The old behavior was kind of confusing
5510 raises the prompt counter. The old behavior was kind of confusing
5490 (getting the same prompt number several times if the operation
5511 (getting the same prompt number several times if the operation
5491 didn't return a result).
5512 didn't return a result).
5492
5513
5493 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5514 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5494
5515
5495 * Fixed -Classic mode (wasn't working anymore).
5516 * Fixed -Classic mode (wasn't working anymore).
5496
5517
5497 * Added colored prompts using Nathan's new code. Colors are
5518 * Added colored prompts using Nathan's new code. Colors are
5498 currently hardwired, they can be user-configurable. For
5519 currently hardwired, they can be user-configurable. For
5499 developers, they can be chosen in file ipythonlib.py, at the
5520 developers, they can be chosen in file ipythonlib.py, at the
5500 beginning of the CachedOutput class def.
5521 beginning of the CachedOutput class def.
5501
5522
5502 2001-11-11 Fernando Perez <fperez@colorado.edu>
5523 2001-11-11 Fernando Perez <fperez@colorado.edu>
5503
5524
5504 * Version 0.1.5 released, 0.1.6 opened for further work.
5525 * Version 0.1.5 released, 0.1.6 opened for further work.
5505
5526
5506 * Changed magic_env to *return* the environment as a dict (not to
5527 * Changed magic_env to *return* the environment as a dict (not to
5507 print it). This way it prints, but it can also be processed.
5528 print it). This way it prints, but it can also be processed.
5508
5529
5509 * Added Verbose exception reporting to interactive
5530 * Added Verbose exception reporting to interactive
5510 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5531 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5511 traceback. Had to make some changes to the ultraTB file. This is
5532 traceback. Had to make some changes to the ultraTB file. This is
5512 probably the last 'big' thing in my mental todo list. This ties
5533 probably the last 'big' thing in my mental todo list. This ties
5513 in with the next entry:
5534 in with the next entry:
5514
5535
5515 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5536 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5516 has to specify is Plain, Color or Verbose for all exception
5537 has to specify is Plain, Color or Verbose for all exception
5517 handling.
5538 handling.
5518
5539
5519 * Removed ShellServices option. All this can really be done via
5540 * Removed ShellServices option. All this can really be done via
5520 the magic system. It's easier to extend, cleaner and has automatic
5541 the magic system. It's easier to extend, cleaner and has automatic
5521 namespace protection and documentation.
5542 namespace protection and documentation.
5522
5543
5523 2001-11-09 Fernando Perez <fperez@colorado.edu>
5544 2001-11-09 Fernando Perez <fperez@colorado.edu>
5524
5545
5525 * Fixed bug in output cache flushing (missing parameter to
5546 * Fixed bug in output cache flushing (missing parameter to
5526 __init__). Other small bugs fixed (found using pychecker).
5547 __init__). Other small bugs fixed (found using pychecker).
5527
5548
5528 * Version 0.1.4 opened for bugfixing.
5549 * Version 0.1.4 opened for bugfixing.
5529
5550
5530 2001-11-07 Fernando Perez <fperez@colorado.edu>
5551 2001-11-07 Fernando Perez <fperez@colorado.edu>
5531
5552
5532 * Version 0.1.3 released, mainly because of the raw_input bug.
5553 * Version 0.1.3 released, mainly because of the raw_input bug.
5533
5554
5534 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5555 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5535 and when testing for whether things were callable, a call could
5556 and when testing for whether things were callable, a call could
5536 actually be made to certain functions. They would get called again
5557 actually be made to certain functions. They would get called again
5537 once 'really' executed, with a resulting double call. A disaster
5558 once 'really' executed, with a resulting double call. A disaster
5538 in many cases (list.reverse() would never work!).
5559 in many cases (list.reverse() would never work!).
5539
5560
5540 * Removed prefilter() function, moved its code to raw_input (which
5561 * Removed prefilter() function, moved its code to raw_input (which
5541 after all was just a near-empty caller for prefilter). This saves
5562 after all was just a near-empty caller for prefilter). This saves
5542 a function call on every prompt, and simplifies the class a tiny bit.
5563 a function call on every prompt, and simplifies the class a tiny bit.
5543
5564
5544 * Fix _ip to __ip name in magic example file.
5565 * Fix _ip to __ip name in magic example file.
5545
5566
5546 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5567 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5547 work with non-gnu versions of tar.
5568 work with non-gnu versions of tar.
5548
5569
5549 2001-11-06 Fernando Perez <fperez@colorado.edu>
5570 2001-11-06 Fernando Perez <fperez@colorado.edu>
5550
5571
5551 * Version 0.1.2. Just to keep track of the recent changes.
5572 * Version 0.1.2. Just to keep track of the recent changes.
5552
5573
5553 * Fixed nasty bug in output prompt routine. It used to check 'if
5574 * Fixed nasty bug in output prompt routine. It used to check 'if
5554 arg != None...'. Problem is, this fails if arg implements a
5575 arg != None...'. Problem is, this fails if arg implements a
5555 special comparison (__cmp__) which disallows comparing to
5576 special comparison (__cmp__) which disallows comparing to
5556 None. Found it when trying to use the PhysicalQuantity module from
5577 None. Found it when trying to use the PhysicalQuantity module from
5557 ScientificPython.
5578 ScientificPython.
5558
5579
5559 2001-11-05 Fernando Perez <fperez@colorado.edu>
5580 2001-11-05 Fernando Perez <fperez@colorado.edu>
5560
5581
5561 * Also added dirs. Now the pushd/popd/dirs family functions
5582 * Also added dirs. Now the pushd/popd/dirs family functions
5562 basically like the shell, with the added convenience of going home
5583 basically like the shell, with the added convenience of going home
5563 when called with no args.
5584 when called with no args.
5564
5585
5565 * pushd/popd slightly modified to mimic shell behavior more
5586 * pushd/popd slightly modified to mimic shell behavior more
5566 closely.
5587 closely.
5567
5588
5568 * Added env,pushd,popd from ShellServices as magic functions. I
5589 * Added env,pushd,popd from ShellServices as magic functions. I
5569 think the cleanest will be to port all desired functions from
5590 think the cleanest will be to port all desired functions from
5570 ShellServices as magics and remove ShellServices altogether. This
5591 ShellServices as magics and remove ShellServices altogether. This
5571 will provide a single, clean way of adding functionality
5592 will provide a single, clean way of adding functionality
5572 (shell-type or otherwise) to IP.
5593 (shell-type or otherwise) to IP.
5573
5594
5574 2001-11-04 Fernando Perez <fperez@colorado.edu>
5595 2001-11-04 Fernando Perez <fperez@colorado.edu>
5575
5596
5576 * Added .ipython/ directory to sys.path. This way users can keep
5597 * Added .ipython/ directory to sys.path. This way users can keep
5577 customizations there and access them via import.
5598 customizations there and access them via import.
5578
5599
5579 2001-11-03 Fernando Perez <fperez@colorado.edu>
5600 2001-11-03 Fernando Perez <fperez@colorado.edu>
5580
5601
5581 * Opened version 0.1.1 for new changes.
5602 * Opened version 0.1.1 for new changes.
5582
5603
5583 * Changed version number to 0.1.0: first 'public' release, sent to
5604 * Changed version number to 0.1.0: first 'public' release, sent to
5584 Nathan and Janko.
5605 Nathan and Janko.
5585
5606
5586 * Lots of small fixes and tweaks.
5607 * Lots of small fixes and tweaks.
5587
5608
5588 * Minor changes to whos format. Now strings are shown, snipped if
5609 * Minor changes to whos format. Now strings are shown, snipped if
5589 too long.
5610 too long.
5590
5611
5591 * Changed ShellServices to work on __main__ so they show up in @who
5612 * Changed ShellServices to work on __main__ so they show up in @who
5592
5613
5593 * Help also works with ? at the end of a line:
5614 * Help also works with ? at the end of a line:
5594 ?sin and sin?
5615 ?sin and sin?
5595 both produce the same effect. This is nice, as often I use the
5616 both produce the same effect. This is nice, as often I use the
5596 tab-complete to find the name of a method, but I used to then have
5617 tab-complete to find the name of a method, but I used to then have
5597 to go to the beginning of the line to put a ? if I wanted more
5618 to go to the beginning of the line to put a ? if I wanted more
5598 info. Now I can just add the ? and hit return. Convenient.
5619 info. Now I can just add the ? and hit return. Convenient.
5599
5620
5600 2001-11-02 Fernando Perez <fperez@colorado.edu>
5621 2001-11-02 Fernando Perez <fperez@colorado.edu>
5601
5622
5602 * Python version check (>=2.1) added.
5623 * Python version check (>=2.1) added.
5603
5624
5604 * Added LazyPython documentation. At this point the docs are quite
5625 * Added LazyPython documentation. At this point the docs are quite
5605 a mess. A cleanup is in order.
5626 a mess. A cleanup is in order.
5606
5627
5607 * Auto-installer created. For some bizarre reason, the zipfiles
5628 * Auto-installer created. For some bizarre reason, the zipfiles
5608 module isn't working on my system. So I made a tar version
5629 module isn't working on my system. So I made a tar version
5609 (hopefully the command line options in various systems won't kill
5630 (hopefully the command line options in various systems won't kill
5610 me).
5631 me).
5611
5632
5612 * Fixes to Struct in genutils. Now all dictionary-like methods are
5633 * Fixes to Struct in genutils. Now all dictionary-like methods are
5613 protected (reasonably).
5634 protected (reasonably).
5614
5635
5615 * Added pager function to genutils and changed ? to print usage
5636 * Added pager function to genutils and changed ? to print usage
5616 note through it (it was too long).
5637 note through it (it was too long).
5617
5638
5618 * Added the LazyPython functionality. Works great! I changed the
5639 * Added the LazyPython functionality. Works great! I changed the
5619 auto-quote escape to ';', it's on home row and next to '. But
5640 auto-quote escape to ';', it's on home row and next to '. But
5620 both auto-quote and auto-paren (still /) escapes are command-line
5641 both auto-quote and auto-paren (still /) escapes are command-line
5621 parameters.
5642 parameters.
5622
5643
5623
5644
5624 2001-11-01 Fernando Perez <fperez@colorado.edu>
5645 2001-11-01 Fernando Perez <fperez@colorado.edu>
5625
5646
5626 * Version changed to 0.0.7. Fairly large change: configuration now
5647 * Version changed to 0.0.7. Fairly large change: configuration now
5627 is all stored in a directory, by default .ipython. There, all
5648 is all stored in a directory, by default .ipython. There, all
5628 config files have normal looking names (not .names)
5649 config files have normal looking names (not .names)
5629
5650
5630 * Version 0.0.6 Released first to Lucas and Archie as a test
5651 * Version 0.0.6 Released first to Lucas and Archie as a test
5631 run. Since it's the first 'semi-public' release, change version to
5652 run. Since it's the first 'semi-public' release, change version to
5632 > 0.0.6 for any changes now.
5653 > 0.0.6 for any changes now.
5633
5654
5634 * Stuff I had put in the ipplib.py changelog:
5655 * Stuff I had put in the ipplib.py changelog:
5635
5656
5636 Changes to InteractiveShell:
5657 Changes to InteractiveShell:
5637
5658
5638 - Made the usage message a parameter.
5659 - Made the usage message a parameter.
5639
5660
5640 - Require the name of the shell variable to be given. It's a bit
5661 - Require the name of the shell variable to be given. It's a bit
5641 of a hack, but allows the name 'shell' not to be hardwired in the
5662 of a hack, but allows the name 'shell' not to be hardwired in the
5642 magic (@) handler, which is problematic b/c it requires
5663 magic (@) handler, which is problematic b/c it requires
5643 polluting the global namespace with 'shell'. This in turn is
5664 polluting the global namespace with 'shell'. This in turn is
5644 fragile: if a user redefines a variable called shell, things
5665 fragile: if a user redefines a variable called shell, things
5645 break.
5666 break.
5646
5667
5647 - magic @: all functions available through @ need to be defined
5668 - magic @: all functions available through @ need to be defined
5648 as magic_<name>, even though they can be called simply as
5669 as magic_<name>, even though they can be called simply as
5649 @<name>. This allows the special command @magic to gather
5670 @<name>. This allows the special command @magic to gather
5650 information automatically about all existing magic functions,
5671 information automatically about all existing magic functions,
5651 even if they are run-time user extensions, by parsing the shell
5672 even if they are run-time user extensions, by parsing the shell
5652 instance __dict__ looking for special magic_ names.
5673 instance __dict__ looking for special magic_ names.
5653
5674
5654 - mainloop: added *two* local namespace parameters. This allows
5675 - mainloop: added *two* local namespace parameters. This allows
5655 the class to differentiate between parameters which were there
5676 the class to differentiate between parameters which were there
5656 before and after command line initialization was processed. This
5677 before and after command line initialization was processed. This
5657 way, later @who can show things loaded at startup by the
5678 way, later @who can show things loaded at startup by the
5658 user. This trick was necessary to make session saving/reloading
5679 user. This trick was necessary to make session saving/reloading
5659 really work: ideally after saving/exiting/reloading a session,
5680 really work: ideally after saving/exiting/reloading a session,
5660 *everything* should look the same, including the output of @who. I
5681 *everything* should look the same, including the output of @who. I
5661 was only able to make this work with this double namespace
5682 was only able to make this work with this double namespace
5662 trick.
5683 trick.
5663
5684
5664 - added a header to the logfile which allows (almost) full
5685 - added a header to the logfile which allows (almost) full
5665 session restoring.
5686 session restoring.
5666
5687
5667 - prepend lines beginning with @ or !, with a and log
5688 - prepend lines beginning with @ or !, with a and log
5668 them. Why? !lines: may be useful to know what you did @lines:
5689 them. Why? !lines: may be useful to know what you did @lines:
5669 they may affect session state. So when restoring a session, at
5690 they may affect session state. So when restoring a session, at
5670 least inform the user of their presence. I couldn't quite get
5691 least inform the user of their presence. I couldn't quite get
5671 them to properly re-execute, but at least the user is warned.
5692 them to properly re-execute, but at least the user is warned.
5672
5693
5673 * Started ChangeLog.
5694 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now