##// END OF EJS Templates
IPython/Extensions/ipipe.py (xiter): Make sure that iterating...
walter.doerwald -
Show More
@@ -1,1721 +1,1725 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 # Python 2.3 compatibility
15 # Python 2.3 compatibility
16 try:
16 try:
17 sorted
17 sorted
18 except NameError:
18 except NameError:
19 from ipipe import sorted
19 from ipipe import sorted
20
20
21
21
22 class UnassignedKeyError(Exception):
22 class UnassignedKeyError(Exception):
23 """
23 """
24 Exception that is used for reporting unassigned keys.
24 Exception that is used for reporting unassigned keys.
25 """
25 """
26
26
27
27
28 class UnknownCommandError(Exception):
28 class UnknownCommandError(Exception):
29 """
29 """
30 Exception that is used for reporting unknown commands (this should never
30 Exception that is used for reporting unknown commands (this should never
31 happen).
31 happen).
32 """
32 """
33
33
34
34
35 class CommandError(Exception):
35 class CommandError(Exception):
36 """
36 """
37 Exception that is used for reporting that a command can't be executed.
37 Exception that is used for reporting that a command can't be executed.
38 """
38 """
39
39
40
40
41 class Keymap(dict):
41 class Keymap(dict):
42 """
42 """
43 Stores mapping of keys to commands.
43 Stores mapping of keys to commands.
44 """
44 """
45 def __init__(self):
45 def __init__(self):
46 self._keymap = {}
46 self._keymap = {}
47
47
48 def __setitem__(self, key, command):
48 def __setitem__(self, key, command):
49 if isinstance(key, str):
49 if isinstance(key, str):
50 for c in key:
50 for c in key:
51 dict.__setitem__(self, ord(c), command)
51 dict.__setitem__(self, ord(c), command)
52 else:
52 else:
53 dict.__setitem__(self, key, command)
53 dict.__setitem__(self, key, command)
54
54
55 def __getitem__(self, key):
55 def __getitem__(self, key):
56 if isinstance(key, str):
56 if isinstance(key, str):
57 key = ord(key)
57 key = ord(key)
58 return dict.__getitem__(self, key)
58 return dict.__getitem__(self, key)
59
59
60 def __detitem__(self, key):
60 def __detitem__(self, key):
61 if isinstance(key, str):
61 if isinstance(key, str):
62 key = ord(key)
62 key = ord(key)
63 dict.__detitem__(self, key)
63 dict.__detitem__(self, key)
64
64
65 def register(self, command, *keys):
65 def register(self, command, *keys):
66 for key in keys:
66 for key in keys:
67 self[key] = command
67 self[key] = command
68
68
69 def get(self, key, default=None):
69 def get(self, key, default=None):
70 if isinstance(key, str):
70 if isinstance(key, str):
71 key = ord(key)
71 key = ord(key)
72 return dict.get(self, key, default)
72 return dict.get(self, key, default)
73
73
74 def findkey(self, command, default=ipipe.noitem):
74 def findkey(self, command, default=ipipe.noitem):
75 for (key, commandcandidate) in self.iteritems():
75 for (key, commandcandidate) in self.iteritems():
76 if commandcandidate == command:
76 if commandcandidate == command:
77 return key
77 return key
78 if default is ipipe.noitem:
78 if default is ipipe.noitem:
79 raise KeyError(command)
79 raise KeyError(command)
80 return default
80 return default
81
81
82
82
83 class _BrowserCachedItem(object):
83 class _BrowserCachedItem(object):
84 # This is used internally by ``ibrowse`` to store a item together with its
84 # This is used internally by ``ibrowse`` to store a item together with its
85 # marked status.
85 # marked status.
86 __slots__ = ("item", "marked")
86 __slots__ = ("item", "marked")
87
87
88 def __init__(self, item):
88 def __init__(self, item):
89 self.item = item
89 self.item = item
90 self.marked = False
90 self.marked = False
91
91
92
92
93 class _BrowserHelp(object):
93 class _BrowserHelp(object):
94 style_header = astyle.Style.fromstr("yellow:black:bold")
94 style_header = astyle.Style.fromstr("yellow:black:bold")
95 # This is used internally by ``ibrowse`` for displaying the help screen.
95 # This is used internally by ``ibrowse`` for displaying the help screen.
96 def __init__(self, browser):
96 def __init__(self, browser):
97 self.browser = browser
97 self.browser = browser
98
98
99 def __xrepr__(self, mode):
99 def __xrepr__(self, mode):
100 yield (-1, True)
100 yield (-1, True)
101 if mode == "header" or mode == "footer":
101 if mode == "header" or mode == "footer":
102 yield (astyle.style_default, "ibrowse help screen")
102 yield (astyle.style_default, "ibrowse help screen")
103 else:
103 else:
104 yield (astyle.style_default, repr(self))
104 yield (astyle.style_default, repr(self))
105
105
106 def __iter__(self):
106 def __iter__(self):
107 # Get reverse key mapping
107 # Get reverse key mapping
108 allkeys = {}
108 allkeys = {}
109 for (key, cmd) in self.browser.keymap.iteritems():
109 for (key, cmd) in self.browser.keymap.iteritems():
110 allkeys.setdefault(cmd, []).append(key)
110 allkeys.setdefault(cmd, []).append(key)
111
111
112 fields = ("key", "description")
112 fields = ("key", "description")
113
113
114 commands = []
114 commands = []
115 for name in dir(self.browser):
115 for name in dir(self.browser):
116 if name.startswith("cmd_"):
116 if name.startswith("cmd_"):
117 command = getattr(self.browser, name)
117 command = getattr(self.browser, name)
118 commands.append((inspect.getsourcelines(command)[-1], name[4:], command))
118 commands.append((inspect.getsourcelines(command)[-1], name[4:], command))
119 commands.sort()
119 commands.sort()
120 commands = [(c[1], c[2]) for c in commands]
120 commands = [(c[1], c[2]) for c in commands]
121 for (i, (name, command)) in enumerate(commands):
121 for (i, (name, command)) in enumerate(commands):
122 if i:
122 if i:
123 yield ipipe.Fields(fields, key="", description="")
123 yield ipipe.Fields(fields, key="", description="")
124
124
125 description = command.__doc__
125 description = command.__doc__
126 if description is None:
126 if description is None:
127 lines = []
127 lines = []
128 else:
128 else:
129 lines = [l.strip() for l in description.splitlines() if l.strip()]
129 lines = [l.strip() for l in description.splitlines() if l.strip()]
130 description = "\n".join(lines)
130 description = "\n".join(lines)
131 lines = textwrap.wrap(description, 60)
131 lines = textwrap.wrap(description, 60)
132 keys = allkeys.get(name, [])
132 keys = allkeys.get(name, [])
133
133
134 yield ipipe.Fields(fields, key="", description=astyle.Text((self.style_header, name)))
134 yield ipipe.Fields(fields, key="", description=astyle.Text((self.style_header, name)))
135 for i in xrange(max(len(keys), len(lines))):
135 for i in xrange(max(len(keys), len(lines))):
136 try:
136 try:
137 key = self.browser.keylabel(keys[i])
137 key = self.browser.keylabel(keys[i])
138 except IndexError:
138 except IndexError:
139 key = ""
139 key = ""
140 try:
140 try:
141 line = lines[i]
141 line = lines[i]
142 except IndexError:
142 except IndexError:
143 line = ""
143 line = ""
144 yield ipipe.Fields(fields, key=key, description=line)
144 yield ipipe.Fields(fields, key=key, description=line)
145
145
146
146
147 class _BrowserLevel(object):
147 class _BrowserLevel(object):
148 # This is used internally to store the state (iterator, fetch items,
148 # This is used internally to store the state (iterator, fetch items,
149 # position of cursor and screen, etc.) of one browser level
149 # position of cursor and screen, etc.) of one browser level
150 # An ``ibrowse`` object keeps multiple ``_BrowserLevel`` objects in
150 # An ``ibrowse`` object keeps multiple ``_BrowserLevel`` objects in
151 # a stack.
151 # a stack.
152 def __init__(self, browser, input,mainsizey, *attrs):
152 def __init__(self, browser, input, mainsizey, *attrs):
153 self.browser = browser
153 self.browser = browser
154 self.input = input
154 self.input = input
155 self.header = [x for x in ipipe.xrepr(input, "header") if not isinstance(x[0], int)]
155 self.header = [x for x in ipipe.xrepr(input, "header") if not isinstance(x[0], int)]
156 # iterator for the input
156 # iterator for the input
157 self.iterator = ipipe.xiter(input)
157 self.iterator = ipipe.xiter(input)
158
158
159 # is the iterator exhausted?
159 # is the iterator exhausted?
160 self.exhausted = False
160 self.exhausted = False
161
161
162 # attributes to be display (autodetected if empty)
162 # attributes to be display (autodetected if empty)
163 self.attrs = attrs
163 self.attrs = attrs
164
164
165 # fetched items (+ marked flag)
165 # fetched items (+ marked flag)
166 self.items = ipipe.deque()
166 self.items = ipipe.deque()
167
167
168 # Number of marked objects
168 # Number of marked objects
169 self.marked = 0
169 self.marked = 0
170
170
171 # Vertical cursor position
171 # Vertical cursor position
172 self.cury = 0
172 self.cury = 0
173
173
174 # Horizontal cursor position
174 # Horizontal cursor position
175 self.curx = 0
175 self.curx = 0
176
176
177 # Index of first data column
177 # Index of first data column
178 self.datastartx = 0
178 self.datastartx = 0
179
179
180 # Index of first data line
180 # Index of first data line
181 self.datastarty = 0
181 self.datastarty = 0
182
182
183 # height of the data display area
183 # height of the data display area
184 self.mainsizey = mainsizey
184 self.mainsizey = mainsizey
185
185
186 # width of the data display area (changes when scrolling)
186 # width of the data display area (changes when scrolling)
187 self.mainsizex = 0
187 self.mainsizex = 0
188
188
189 # Size of row number (changes when scrolling)
189 # Size of row number (changes when scrolling)
190 self.numbersizex = 0
190 self.numbersizex = 0
191
191
192 # Attributes to display (in this order)
192 # Attributes to display (in this order)
193 self.displayattrs = []
193 self.displayattrs = []
194
194
195 # index and attribute under the cursor
195 # index and attribute under the cursor
196 self.displayattr = (None, ipipe.noitem)
196 self.displayattr = (None, ipipe.noitem)
197
197
198 # Maps attributes to column widths
198 # Maps attributes to column widths
199 self.colwidths = {}
199 self.colwidths = {}
200
200
201 # Set of hidden attributes
201 # Set of hidden attributes
202 self.hiddenattrs = set()
202 self.hiddenattrs = set()
203
203
204 # This takes care of all the caches etc.
204 # This takes care of all the caches etc.
205 self.moveto(0, 0, refresh=True)
205 self.moveto(0, 0, refresh=True)
206
206
207 def fetch(self, count):
207 def fetch(self, count):
208 # Try to fill ``self.items`` with at least ``count`` objects.
208 # Try to fill ``self.items`` with at least ``count`` objects.
209 have = len(self.items)
209 have = len(self.items)
210 while not self.exhausted and have < count:
210 while not self.exhausted and have < count:
211 try:
211 try:
212 item = self.iterator.next()
212 item = self.iterator.next()
213 except StopIteration:
213 except StopIteration:
214 self.exhausted = True
214 self.exhausted = True
215 break
215 break
216 except (KeyboardInterrupt, SystemExit):
216 except (KeyboardInterrupt, SystemExit):
217 raise
217 raise
218 except Exception, exc:
218 except Exception, exc:
219 have += 1
219 have += 1
220 self.items.append(_BrowserCachedItem(exc))
220 self.items.append(_BrowserCachedItem(exc))
221 self.exhausted = True
221 self.exhausted = True
222 break
222 break
223 else:
223 else:
224 have += 1
224 have += 1
225 self.items.append(_BrowserCachedItem(item))
225 self.items.append(_BrowserCachedItem(item))
226
226
227 def calcdisplayattrs(self):
227 def calcdisplayattrs(self):
228 # Calculate which attributes are available from the objects that are
228 # Calculate which attributes are available from the objects that are
229 # currently visible on screen (and store it in ``self.displayattrs``)
229 # currently visible on screen (and store it in ``self.displayattrs``)
230
230
231 attrs = set()
231 attrs = set()
232 self.displayattrs = []
232 self.displayattrs = []
233 if self.attrs:
233 if self.attrs:
234 # If the browser object specifies a fixed list of attributes,
234 # If the browser object specifies a fixed list of attributes,
235 # simply use it (removing hidden attributes).
235 # simply use it (removing hidden attributes).
236 for attr in self.attrs:
236 for attr in self.attrs:
237 attr = ipipe.upgradexattr(attr)
237 attr = ipipe.upgradexattr(attr)
238 if attr not in attrs and attr not in self.hiddenattrs:
238 if attr not in attrs and attr not in self.hiddenattrs:
239 self.displayattrs.append(attr)
239 self.displayattrs.append(attr)
240 attrs.add(attr)
240 attrs.add(attr)
241 else:
241 else:
242 endy = min(self.datastarty+self.mainsizey, len(self.items))
242 endy = min(self.datastarty+self.mainsizey, len(self.items))
243 for i in xrange(self.datastarty, endy):
243 for i in xrange(self.datastarty, endy):
244 for attr in ipipe.xattrs(self.items[i].item, "default"):
244 for attr in ipipe.xattrs(self.items[i].item, "default"):
245 if attr not in attrs and attr not in self.hiddenattrs:
245 if attr not in attrs and attr not in self.hiddenattrs:
246 self.displayattrs.append(attr)
246 self.displayattrs.append(attr)
247 attrs.add(attr)
247 attrs.add(attr)
248
248
249 def getrow(self, i):
249 def getrow(self, i):
250 # Return a dictionary with the attributes for the object
250 # Return a dictionary with the attributes for the object
251 # ``self.items[i]``. Attribute names are taken from
251 # ``self.items[i]``. Attribute names are taken from
252 # ``self.displayattrs`` so ``calcdisplayattrs()`` must have been
252 # ``self.displayattrs`` so ``calcdisplayattrs()`` must have been
253 # called before.
253 # called before.
254 row = {}
254 row = {}
255 item = self.items[i].item
255 item = self.items[i].item
256 for attr in self.displayattrs:
256 for attr in self.displayattrs:
257 try:
257 try:
258 value = attr.value(item)
258 value = attr.value(item)
259 except (KeyboardInterrupt, SystemExit):
259 except (KeyboardInterrupt, SystemExit):
260 raise
260 raise
261 except Exception, exc:
261 except Exception, exc:
262 value = exc
262 value = exc
263 # only store attribute if it exists (or we got an exception)
263 # only store attribute if it exists (or we got an exception)
264 if value is not ipipe.noitem:
264 if value is not ipipe.noitem:
265 # remember alignment, length and colored text
265 # remember alignment, length and colored text
266 row[attr] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
266 row[attr] = ipipe.xformat(value, "cell", self.browser.maxattrlength)
267 return row
267 return row
268
268
269 def calcwidths(self):
269 def calcwidths(self):
270 # Recalculate the displayed fields and their widths.
270 # Recalculate the displayed fields and their widths.
271 # ``calcdisplayattrs()'' must have been called and the cache
271 # ``calcdisplayattrs()'' must have been called and the cache
272 # for attributes of the objects on screen (``self.displayrows``)
272 # for attributes of the objects on screen (``self.displayrows``)
273 # must have been filled. This sets ``self.colwidths`` which maps
273 # must have been filled. This sets ``self.colwidths`` which maps
274 # attribute descriptors to widths.
274 # attribute descriptors to widths.
275 self.colwidths = {}
275 self.colwidths = {}
276 for row in self.displayrows:
276 for row in self.displayrows:
277 for attr in self.displayattrs:
277 for attr in self.displayattrs:
278 try:
278 try:
279 length = row[attr][1]
279 length = row[attr][1]
280 except KeyError:
280 except KeyError:
281 length = 0
281 length = 0
282 # always add attribute to colwidths, even if it doesn't exist
282 # always add attribute to colwidths, even if it doesn't exist
283 if attr not in self.colwidths:
283 if attr not in self.colwidths:
284 self.colwidths[attr] = len(attr.name())
284 self.colwidths[attr] = len(attr.name())
285 newwidth = max(self.colwidths[attr], length)
285 newwidth = max(self.colwidths[attr], length)
286 self.colwidths[attr] = newwidth
286 self.colwidths[attr] = newwidth
287
287
288 # How many characters do we need to paint the largest item number?
288 # How many characters do we need to paint the largest item number?
289 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
289 self.numbersizex = len(str(self.datastarty+self.mainsizey-1))
290 # How must space have we got to display data?
290 # How must space have we got to display data?
291 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
291 self.mainsizex = self.browser.scrsizex-self.numbersizex-3
292 # width of all columns
292 # width of all columns
293 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
293 self.datasizex = sum(self.colwidths.itervalues()) + len(self.colwidths)
294
294
295 def calcdisplayattr(self):
295 def calcdisplayattr(self):
296 # Find out which attribute the cursor is on and store this
296 # Find out which attribute the cursor is on and store this
297 # information in ``self.displayattr``.
297 # information in ``self.displayattr``.
298 pos = 0
298 pos = 0
299 for (i, attr) in enumerate(self.displayattrs):
299 for (i, attr) in enumerate(self.displayattrs):
300 if pos+self.colwidths[attr] >= self.curx:
300 if pos+self.colwidths[attr] >= self.curx:
301 self.displayattr = (i, attr)
301 self.displayattr = (i, attr)
302 break
302 break
303 pos += self.colwidths[attr]+1
303 pos += self.colwidths[attr]+1
304 else:
304 else:
305 self.displayattr = (None, ipipe.noitem)
305 self.displayattr = (None, ipipe.noitem)
306
306
307 def moveto(self, x, y, refresh=False):
307 def moveto(self, x, y, refresh=False):
308 # Move the cursor to the position ``(x,y)`` (in data coordinates,
308 # Move the cursor to the position ``(x,y)`` (in data coordinates,
309 # not in screen coordinates). If ``refresh`` is true, all cached
309 # not in screen coordinates). If ``refresh`` is true, all cached
310 # values will be recalculated (e.g. because the list has been
310 # values will be recalculated (e.g. because the list has been
311 # resorted, so screen positions etc. are no longer valid).
311 # resorted, so screen positions etc. are no longer valid).
312 olddatastarty = self.datastarty
312 olddatastarty = self.datastarty
313 oldx = self.curx
313 oldx = self.curx
314 oldy = self.cury
314 oldy = self.cury
315 x = int(x+0.5)
315 x = int(x+0.5)
316 y = int(y+0.5)
316 y = int(y+0.5)
317 newx = x # remember where we wanted to move
317 newx = x # remember where we wanted to move
318 newy = y # remember where we wanted to move
318 newy = y # remember where we wanted to move
319
319
320 scrollbordery = min(self.browser.scrollbordery, self.mainsizey//2)
320 scrollbordery = min(self.browser.scrollbordery, self.mainsizey//2)
321 scrollborderx = min(self.browser.scrollborderx, self.mainsizex//2)
321 scrollborderx = min(self.browser.scrollborderx, self.mainsizex//2)
322
322
323 # Make sure that the cursor didn't leave the main area vertically
323 # Make sure that the cursor didn't leave the main area vertically
324 if y < 0:
324 if y < 0:
325 y = 0
325 y = 0
326 # try to get enough items to fill the screen
326 # try to get enough items to fill the screen
327 self.fetch(max(y+scrollbordery+1, self.mainsizey))
327 self.fetch(max(y+scrollbordery+1, self.mainsizey))
328 if y >= len(self.items):
328 if y >= len(self.items):
329 y = max(0, len(self.items)-1)
329 y = max(0, len(self.items)-1)
330
330
331 # Make sure that the cursor stays on screen vertically
331 # Make sure that the cursor stays on screen vertically
332 if y < self.datastarty+scrollbordery:
332 if y < self.datastarty+scrollbordery:
333 self.datastarty = max(0, y-scrollbordery)
333 self.datastarty = max(0, y-scrollbordery)
334 elif y >= self.datastarty+self.mainsizey-scrollbordery:
334 elif y >= self.datastarty+self.mainsizey-scrollbordery:
335 self.datastarty = max(0, min(y-self.mainsizey+scrollbordery+1,
335 self.datastarty = max(0, min(y-self.mainsizey+scrollbordery+1,
336 len(self.items)-self.mainsizey))
336 len(self.items)-self.mainsizey))
337
337
338 if refresh: # Do we need to refresh the complete display?
338 if refresh: # Do we need to refresh the complete display?
339 self.calcdisplayattrs()
339 self.calcdisplayattrs()
340 endy = min(self.datastarty+self.mainsizey, len(self.items))
340 endy = min(self.datastarty+self.mainsizey, len(self.items))
341 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
341 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
342 self.calcwidths()
342 self.calcwidths()
343 # Did we scroll vertically => update displayrows
343 # Did we scroll vertically => update displayrows
344 # and various other attributes
344 # and various other attributes
345 elif self.datastarty != olddatastarty:
345 elif self.datastarty != olddatastarty:
346 # Recalculate which attributes we have to display
346 # Recalculate which attributes we have to display
347 olddisplayattrs = self.displayattrs
347 olddisplayattrs = self.displayattrs
348 self.calcdisplayattrs()
348 self.calcdisplayattrs()
349 # If there are new attributes, recreate the cache
349 # If there are new attributes, recreate the cache
350 if self.displayattrs != olddisplayattrs:
350 if self.displayattrs != olddisplayattrs:
351 endy = min(self.datastarty+self.mainsizey, len(self.items))
351 endy = min(self.datastarty+self.mainsizey, len(self.items))
352 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
352 self.displayrows = map(self.getrow, xrange(self.datastarty, endy))
353 elif self.datastarty<olddatastarty: # we did scroll up
353 elif self.datastarty<olddatastarty: # we did scroll up
354 # drop rows from the end
354 # drop rows from the end
355 del self.displayrows[self.datastarty-olddatastarty:]
355 del self.displayrows[self.datastarty-olddatastarty:]
356 # fetch new items
356 # fetch new items
357 for i in xrange(min(olddatastarty, self.datastarty+self.mainsizey)-1,
357 for i in xrange(min(olddatastarty, self.datastarty+self.mainsizey)-1,
358 self.datastarty-1, -1):
358 self.datastarty-1, -1):
359 try:
359 try:
360 row = self.getrow(i)
360 row = self.getrow(i)
361 except IndexError:
361 except IndexError:
362 # we didn't have enough objects to fill the screen
362 # we didn't have enough objects to fill the screen
363 break
363 break
364 self.displayrows.insert(0, row)
364 self.displayrows.insert(0, row)
365 else: # we did scroll down
365 else: # we did scroll down
366 # drop rows from the start
366 # drop rows from the start
367 del self.displayrows[:self.datastarty-olddatastarty]
367 del self.displayrows[:self.datastarty-olddatastarty]
368 # fetch new items
368 # fetch new items
369 for i in xrange(max(olddatastarty+self.mainsizey, self.datastarty),
369 for i in xrange(max(olddatastarty+self.mainsizey, self.datastarty),
370 self.datastarty+self.mainsizey):
370 self.datastarty+self.mainsizey):
371 try:
371 try:
372 row = self.getrow(i)
372 row = self.getrow(i)
373 except IndexError:
373 except IndexError:
374 # we didn't have enough objects to fill the screen
374 # we didn't have enough objects to fill the screen
375 break
375 break
376 self.displayrows.append(row)
376 self.displayrows.append(row)
377 self.calcwidths()
377 self.calcwidths()
378
378
379 # Make sure that the cursor didn't leave the data area horizontally
379 # Make sure that the cursor didn't leave the data area horizontally
380 if x < 0:
380 if x < 0:
381 x = 0
381 x = 0
382 elif x >= self.datasizex:
382 elif x >= self.datasizex:
383 x = max(0, self.datasizex-1)
383 x = max(0, self.datasizex-1)
384
384
385 # Make sure that the cursor stays on screen horizontally
385 # Make sure that the cursor stays on screen horizontally
386 if x < self.datastartx+scrollborderx:
386 if x < self.datastartx+scrollborderx:
387 self.datastartx = max(0, x-scrollborderx)
387 self.datastartx = max(0, x-scrollborderx)
388 elif x >= self.datastartx+self.mainsizex-scrollborderx:
388 elif x >= self.datastartx+self.mainsizex-scrollborderx:
389 self.datastartx = max(0, min(x-self.mainsizex+scrollborderx+1,
389 self.datastartx = max(0, min(x-self.mainsizex+scrollborderx+1,
390 self.datasizex-self.mainsizex))
390 self.datasizex-self.mainsizex))
391
391
392 if x == oldx and y == oldy and (x != newx or y != newy): # couldn't move
392 if x == oldx and y == oldy and (x != newx or y != newy): # couldn't move
393 self.browser.beep()
393 self.browser.beep()
394 else:
394 else:
395 self.curx = x
395 self.curx = x
396 self.cury = y
396 self.cury = y
397 self.calcdisplayattr()
397 self.calcdisplayattr()
398
398
399 def sort(self, key, reverse=False):
399 def sort(self, key, reverse=False):
400 """
400 """
401 Sort the currently list of items using the key function ``key``. If
401 Sort the currently list of items using the key function ``key``. If
402 ``reverse`` is true the sort order is reversed.
402 ``reverse`` is true the sort order is reversed.
403 """
403 """
404 curitem = self.items[self.cury] # Remember where the cursor is now
404 curitem = self.items[self.cury] # Remember where the cursor is now
405
405
406 # Sort items
406 # Sort items
407 def realkey(item):
407 def realkey(item):
408 return key(item.item)
408 return key(item.item)
409 self.items = ipipe.deque(sorted(self.items, key=realkey, reverse=reverse))
409 self.items = ipipe.deque(sorted(self.items, key=realkey, reverse=reverse))
410
410
411 # Find out where the object under the cursor went
411 # Find out where the object under the cursor went
412 cury = self.cury
412 cury = self.cury
413 for (i, item) in enumerate(self.items):
413 for (i, item) in enumerate(self.items):
414 if item is curitem:
414 if item is curitem:
415 cury = i
415 cury = i
416 break
416 break
417
417
418 self.moveto(self.curx, cury, refresh=True)
418 self.moveto(self.curx, cury, refresh=True)
419
419
420 def refresh(self):
420 def refresh(self):
421 """
421 """
422 Restart iterating the input.
422 Restart iterating the input.
423 """
423 """
424 self.iterator = ipipe.xiter(self.input)
424 self.iterator = ipipe.xiter(self.input)
425 self.items.clear()
425 self.items.clear()
426 self.exhausted = False
426 self.exhausted = False
427 self.datastartx = self.datastarty = 0
427 self.datastartx = self.datastarty = 0
428 self.moveto(0, 0, refresh=True)
428 self.moveto(0, 0, refresh=True)
429
429
430 def refreshfind(self):
430 def refreshfind(self):
431 """
431 """
432 Restart iterating the input and go back to the same object as before
432 Restart iterating the input and go back to the same object as before
433 (if it can be found in the new iterator).
433 (if it can be found in the new iterator).
434 """
434 """
435 try:
435 try:
436 oldobject = self.items[self.cury].item
436 oldobject = self.items[self.cury].item
437 except IndexError:
437 except IndexError:
438 oldobject = ipipe.noitem
438 oldobject = ipipe.noitem
439 self.iterator = ipipe.xiter(self.input)
439 self.iterator = ipipe.xiter(self.input)
440 self.items.clear()
440 self.items.clear()
441 self.exhausted = False
441 self.exhausted = False
442 while True:
442 while True:
443 self.fetch(len(self.items)+1)
443 self.fetch(len(self.items)+1)
444 if self.exhausted:
444 if self.exhausted:
445 curses.beep()
445 curses.beep()
446 self.datastartx = self.datastarty = 0
446 self.datastartx = self.datastarty = 0
447 self.moveto(self.curx, 0, refresh=True)
447 self.moveto(self.curx, 0, refresh=True)
448 break
448 break
449 if self.items[-1].item == oldobject:
449 if self.items[-1].item == oldobject:
450 self.datastartx = self.datastarty = 0
450 self.datastartx = self.datastarty = 0
451 self.moveto(self.curx, len(self.items)-1, refresh=True)
451 self.moveto(self.curx, len(self.items)-1, refresh=True)
452 break
452 break
453
453
454
454
455 class _CommandInput(object):
455 class _CommandInput(object):
456 keymap = Keymap()
456 keymap = Keymap()
457 keymap.register("left", curses.KEY_LEFT)
457 keymap.register("left", curses.KEY_LEFT)
458 keymap.register("right", curses.KEY_RIGHT)
458 keymap.register("right", curses.KEY_RIGHT)
459 keymap.register("home", curses.KEY_HOME, "\x01") # Ctrl-A
459 keymap.register("home", curses.KEY_HOME, "\x01") # Ctrl-A
460 keymap.register("end", curses.KEY_END, "\x05") # Ctrl-E
460 keymap.register("end", curses.KEY_END, "\x05") # Ctrl-E
461 # FIXME: What's happening here?
461 # FIXME: What's happening here?
462 keymap.register("backspace", curses.KEY_BACKSPACE, "\x08\x7f")
462 keymap.register("backspace", curses.KEY_BACKSPACE, "\x08\x7f")
463 keymap.register("delete", curses.KEY_DC)
463 keymap.register("delete", curses.KEY_DC)
464 keymap.register("delend", 0x0b) # Ctrl-K
464 keymap.register("delend", 0x0b) # Ctrl-K
465 keymap.register("execute", "\r\n")
465 keymap.register("execute", "\r\n")
466 keymap.register("up", curses.KEY_UP)
466 keymap.register("up", curses.KEY_UP)
467 keymap.register("down", curses.KEY_DOWN)
467 keymap.register("down", curses.KEY_DOWN)
468 keymap.register("incsearchup", curses.KEY_PPAGE)
468 keymap.register("incsearchup", curses.KEY_PPAGE)
469 keymap.register("incsearchdown", curses.KEY_NPAGE)
469 keymap.register("incsearchdown", curses.KEY_NPAGE)
470 keymap.register("exit", "\x18"), # Ctrl-X
470 keymap.register("exit", "\x18"), # Ctrl-X
471
471
472 def __init__(self, prompt):
472 def __init__(self, prompt):
473 self.prompt = prompt
473 self.prompt = prompt
474 self.history = []
474 self.history = []
475 self.maxhistory = 100
475 self.maxhistory = 100
476 self.input = ""
476 self.input = ""
477 self.curx = 0
477 self.curx = 0
478 self.cury = -1 # blank line
478 self.cury = -1 # blank line
479
479
480 def start(self):
480 def start(self):
481 self.input = ""
481 self.input = ""
482 self.curx = 0
482 self.curx = 0
483 self.cury = -1 # blank line
483 self.cury = -1 # blank line
484
484
485 def handlekey(self, browser, key):
485 def handlekey(self, browser, key):
486 cmdname = self.keymap.get(key, None)
486 cmdname = self.keymap.get(key, None)
487 if cmdname is not None:
487 if cmdname is not None:
488 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
488 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
489 if cmdfunc is not None:
489 if cmdfunc is not None:
490 return cmdfunc(browser)
490 return cmdfunc(browser)
491 curses.beep()
491 curses.beep()
492 elif key != -1:
492 elif key != -1:
493 try:
493 try:
494 char = chr(key)
494 char = chr(key)
495 except ValueError:
495 except ValueError:
496 curses.beep()
496 curses.beep()
497 else:
497 else:
498 return self.handlechar(browser, char)
498 return self.handlechar(browser, char)
499
499
500 def handlechar(self, browser, char):
500 def handlechar(self, browser, char):
501 self.input = self.input[:self.curx] + char + self.input[self.curx:]
501 self.input = self.input[:self.curx] + char + self.input[self.curx:]
502 self.curx += 1
502 self.curx += 1
503 return True
503 return True
504
504
505 def dohistory(self):
505 def dohistory(self):
506 self.history.insert(0, self.input)
506 self.history.insert(0, self.input)
507 del self.history[:-self.maxhistory]
507 del self.history[:-self.maxhistory]
508
508
509 def cmd_backspace(self, browser):
509 def cmd_backspace(self, browser):
510 if self.curx:
510 if self.curx:
511 self.input = self.input[:self.curx-1] + self.input[self.curx:]
511 self.input = self.input[:self.curx-1] + self.input[self.curx:]
512 self.curx -= 1
512 self.curx -= 1
513 return True
513 return True
514 else:
514 else:
515 curses.beep()
515 curses.beep()
516
516
517 def cmd_delete(self, browser):
517 def cmd_delete(self, browser):
518 if self.curx<len(self.input):
518 if self.curx<len(self.input):
519 self.input = self.input[:self.curx] + self.input[self.curx+1:]
519 self.input = self.input[:self.curx] + self.input[self.curx+1:]
520 return True
520 return True
521 else:
521 else:
522 curses.beep()
522 curses.beep()
523
523
524 def cmd_delend(self, browser):
524 def cmd_delend(self, browser):
525 if self.curx<len(self.input):
525 if self.curx<len(self.input):
526 self.input = self.input[:self.curx]
526 self.input = self.input[:self.curx]
527 return True
527 return True
528
528
529 def cmd_left(self, browser):
529 def cmd_left(self, browser):
530 if self.curx:
530 if self.curx:
531 self.curx -= 1
531 self.curx -= 1
532 return True
532 return True
533 else:
533 else:
534 curses.beep()
534 curses.beep()
535
535
536 def cmd_right(self, browser):
536 def cmd_right(self, browser):
537 if self.curx < len(self.input):
537 if self.curx < len(self.input):
538 self.curx += 1
538 self.curx += 1
539 return True
539 return True
540 else:
540 else:
541 curses.beep()
541 curses.beep()
542
542
543 def cmd_home(self, browser):
543 def cmd_home(self, browser):
544 if self.curx:
544 if self.curx:
545 self.curx = 0
545 self.curx = 0
546 return True
546 return True
547 else:
547 else:
548 curses.beep()
548 curses.beep()
549
549
550 def cmd_end(self, browser):
550 def cmd_end(self, browser):
551 if self.curx < len(self.input):
551 if self.curx < len(self.input):
552 self.curx = len(self.input)
552 self.curx = len(self.input)
553 return True
553 return True
554 else:
554 else:
555 curses.beep()
555 curses.beep()
556
556
557 def cmd_up(self, browser):
557 def cmd_up(self, browser):
558 if self.cury < len(self.history)-1:
558 if self.cury < len(self.history)-1:
559 self.cury += 1
559 self.cury += 1
560 self.input = self.history[self.cury]
560 self.input = self.history[self.cury]
561 self.curx = len(self.input)
561 self.curx = len(self.input)
562 return True
562 return True
563 else:
563 else:
564 curses.beep()
564 curses.beep()
565
565
566 def cmd_down(self, browser):
566 def cmd_down(self, browser):
567 if self.cury >= 0:
567 if self.cury >= 0:
568 self.cury -= 1
568 self.cury -= 1
569 if self.cury>=0:
569 if self.cury>=0:
570 self.input = self.history[self.cury]
570 self.input = self.history[self.cury]
571 else:
571 else:
572 self.input = ""
572 self.input = ""
573 self.curx = len(self.input)
573 self.curx = len(self.input)
574 return True
574 return True
575 else:
575 else:
576 curses.beep()
576 curses.beep()
577
577
578 def cmd_incsearchup(self, browser):
578 def cmd_incsearchup(self, browser):
579 prefix = self.input[:self.curx]
579 prefix = self.input[:self.curx]
580 cury = self.cury
580 cury = self.cury
581 while True:
581 while True:
582 cury += 1
582 cury += 1
583 if cury >= len(self.history):
583 if cury >= len(self.history):
584 break
584 break
585 if self.history[cury].startswith(prefix):
585 if self.history[cury].startswith(prefix):
586 self.input = self.history[cury]
586 self.input = self.history[cury]
587 self.cury = cury
587 self.cury = cury
588 return True
588 return True
589 curses.beep()
589 curses.beep()
590
590
591 def cmd_incsearchdown(self, browser):
591 def cmd_incsearchdown(self, browser):
592 prefix = self.input[:self.curx]
592 prefix = self.input[:self.curx]
593 cury = self.cury
593 cury = self.cury
594 while True:
594 while True:
595 cury -= 1
595 cury -= 1
596 if cury <= 0:
596 if cury <= 0:
597 break
597 break
598 if self.history[cury].startswith(prefix):
598 if self.history[cury].startswith(prefix):
599 self.input = self.history[self.cury]
599 self.input = self.history[self.cury]
600 self.cury = cury
600 self.cury = cury
601 return True
601 return True
602 curses.beep()
602 curses.beep()
603
603
604 def cmd_exit(self, browser):
604 def cmd_exit(self, browser):
605 browser.mode = "default"
605 browser.mode = "default"
606 return True
606 return True
607
607
608 def cmd_execute(self, browser):
608 def cmd_execute(self, browser):
609 raise NotImplementedError
609 raise NotImplementedError
610
610
611
611
612 class _CommandGoto(_CommandInput):
612 class _CommandGoto(_CommandInput):
613 def __init__(self):
613 def __init__(self):
614 _CommandInput.__init__(self, "goto object #")
614 _CommandInput.__init__(self, "goto object #")
615
615
616 def handlechar(self, browser, char):
616 def handlechar(self, browser, char):
617 # Only accept digits
617 # Only accept digits
618 if not "0" <= char <= "9":
618 if not "0" <= char <= "9":
619 curses.beep()
619 curses.beep()
620 else:
620 else:
621 return _CommandInput.handlechar(self, browser, char)
621 return _CommandInput.handlechar(self, browser, char)
622
622
623 def cmd_execute(self, browser):
623 def cmd_execute(self, browser):
624 level = browser.levels[-1]
624 level = browser.levels[-1]
625 if self.input:
625 if self.input:
626 self.dohistory()
626 self.dohistory()
627 level.moveto(level.curx, int(self.input))
627 level.moveto(level.curx, int(self.input))
628 browser.mode = "default"
628 browser.mode = "default"
629 return True
629 return True
630
630
631
631
632 class _CommandFind(_CommandInput):
632 class _CommandFind(_CommandInput):
633 def __init__(self):
633 def __init__(self):
634 _CommandInput.__init__(self, "find expression")
634 _CommandInput.__init__(self, "find expression")
635
635
636 def cmd_execute(self, browser):
636 def cmd_execute(self, browser):
637 level = browser.levels[-1]
637 level = browser.levels[-1]
638 if self.input:
638 if self.input:
639 self.dohistory()
639 self.dohistory()
640 while True:
640 while True:
641 cury = level.cury
641 cury = level.cury
642 level.moveto(level.curx, cury+1)
642 level.moveto(level.curx, cury+1)
643 if cury == level.cury:
643 if cury == level.cury:
644 curses.beep()
644 curses.beep()
645 break # hit end
645 break # hit end
646 item = level.items[level.cury].item
646 item = level.items[level.cury].item
647 try:
647 try:
648 globals = ipipe.getglobals(None)
648 globals = ipipe.getglobals(None)
649 if eval(self.input, globals, ipipe.AttrNamespace(item)):
649 if eval(self.input, globals, ipipe.AttrNamespace(item)):
650 break # found something
650 break # found something
651 except (KeyboardInterrupt, SystemExit):
651 except (KeyboardInterrupt, SystemExit):
652 raise
652 raise
653 except Exception, exc:
653 except Exception, exc:
654 browser.report(exc)
654 browser.report(exc)
655 curses.beep()
655 curses.beep()
656 break # break on error
656 break # break on error
657 browser.mode = "default"
657 browser.mode = "default"
658 return True
658 return True
659
659
660
660
661 class _CommandFindBackwards(_CommandInput):
661 class _CommandFindBackwards(_CommandInput):
662 def __init__(self):
662 def __init__(self):
663 _CommandInput.__init__(self, "find backwards expression")
663 _CommandInput.__init__(self, "find backwards expression")
664
664
665 def cmd_execute(self, browser):
665 def cmd_execute(self, browser):
666 level = browser.levels[-1]
666 level = browser.levels[-1]
667 if self.input:
667 if self.input:
668 self.dohistory()
668 self.dohistory()
669 while level.cury:
669 while level.cury:
670 level.moveto(level.curx, level.cury-1)
670 level.moveto(level.curx, level.cury-1)
671 item = level.items[level.cury].item
671 item = level.items[level.cury].item
672 try:
672 try:
673 globals = ipipe.getglobals(None)
673 globals = ipipe.getglobals(None)
674 if eval(self.input, globals, ipipe.AttrNamespace(item)):
674 if eval(self.input, globals, ipipe.AttrNamespace(item)):
675 break # found something
675 break # found something
676 except (KeyboardInterrupt, SystemExit):
676 except (KeyboardInterrupt, SystemExit):
677 raise
677 raise
678 except Exception, exc:
678 except Exception, exc:
679 browser.report(exc)
679 browser.report(exc)
680 curses.beep()
680 curses.beep()
681 break # break on error
681 break # break on error
682 else:
682 else:
683 curses.beep()
683 curses.beep()
684 browser.mode = "default"
684 browser.mode = "default"
685 return True
685 return True
686
686
687
687
688 class ibrowse(ipipe.Display):
688 class ibrowse(ipipe.Display):
689 # Show this many lines from the previous screen when paging horizontally
689 # Show this many lines from the previous screen when paging horizontally
690 pageoverlapx = 1
690 pageoverlapx = 1
691
691
692 # Show this many lines from the previous screen when paging vertically
692 # Show this many lines from the previous screen when paging vertically
693 pageoverlapy = 1
693 pageoverlapy = 1
694
694
695 # Start scrolling when the cursor is less than this number of columns
695 # Start scrolling when the cursor is less than this number of columns
696 # away from the left or right screen edge
696 # away from the left or right screen edge
697 scrollborderx = 10
697 scrollborderx = 10
698
698
699 # Start scrolling when the cursor is less than this number of lines
699 # Start scrolling when the cursor is less than this number of lines
700 # away from the top or bottom screen edge
700 # away from the top or bottom screen edge
701 scrollbordery = 5
701 scrollbordery = 5
702
702
703 # Accelerate by this factor when scrolling horizontally
703 # Accelerate by this factor when scrolling horizontally
704 acceleratex = 1.05
704 acceleratex = 1.05
705
705
706 # Accelerate by this factor when scrolling vertically
706 # Accelerate by this factor when scrolling vertically
707 acceleratey = 1.05
707 acceleratey = 1.05
708
708
709 # The maximum horizontal scroll speed
709 # The maximum horizontal scroll speed
710 # (as a factor of the screen width (i.e. 0.5 == half a screen width)
710 # (as a factor of the screen width (i.e. 0.5 == half a screen width)
711 maxspeedx = 0.5
711 maxspeedx = 0.5
712
712
713 # The maximum vertical scroll speed
713 # The maximum vertical scroll speed
714 # (as a factor of the screen height (i.e. 0.5 == half a screen height)
714 # (as a factor of the screen height (i.e. 0.5 == half a screen height)
715 maxspeedy = 0.5
715 maxspeedy = 0.5
716
716
717 # The maximum number of header lines for browser level
717 # The maximum number of header lines for browser level
718 # if the nesting is deeper, only the innermost levels are displayed
718 # if the nesting is deeper, only the innermost levels are displayed
719 maxheaders = 5
719 maxheaders = 5
720
720
721 # The approximate maximum length of a column entry
721 # The approximate maximum length of a column entry
722 maxattrlength = 200
722 maxattrlength = 200
723
723
724 # Styles for various parts of the GUI
724 # Styles for various parts of the GUI
725 style_objheadertext = astyle.Style.fromstr("white:black:bold|reverse")
725 style_objheadertext = astyle.Style.fromstr("white:black:bold|reverse")
726 style_objheadernumber = astyle.Style.fromstr("white:blue:bold|reverse")
726 style_objheadernumber = astyle.Style.fromstr("white:blue:bold|reverse")
727 style_objheaderobject = astyle.Style.fromstr("white:black:reverse")
727 style_objheaderobject = astyle.Style.fromstr("white:black:reverse")
728 style_colheader = astyle.Style.fromstr("blue:white:reverse")
728 style_colheader = astyle.Style.fromstr("blue:white:reverse")
729 style_colheaderhere = astyle.Style.fromstr("green:black:bold|reverse")
729 style_colheaderhere = astyle.Style.fromstr("green:black:bold|reverse")
730 style_colheadersep = astyle.Style.fromstr("blue:black:reverse")
730 style_colheadersep = astyle.Style.fromstr("blue:black:reverse")
731 style_number = astyle.Style.fromstr("blue:white:reverse")
731 style_number = astyle.Style.fromstr("blue:white:reverse")
732 style_numberhere = astyle.Style.fromstr("green:black:bold|reverse")
732 style_numberhere = astyle.Style.fromstr("green:black:bold|reverse")
733 style_sep = astyle.Style.fromstr("blue:black")
733 style_sep = astyle.Style.fromstr("blue:black")
734 style_data = astyle.Style.fromstr("white:black")
734 style_data = astyle.Style.fromstr("white:black")
735 style_datapad = astyle.Style.fromstr("blue:black:bold")
735 style_datapad = astyle.Style.fromstr("blue:black:bold")
736 style_footer = astyle.Style.fromstr("black:white")
736 style_footer = astyle.Style.fromstr("black:white")
737 style_report = astyle.Style.fromstr("white:black")
737 style_report = astyle.Style.fromstr("white:black")
738
738
739 # Column separator in header
739 # Column separator in header
740 headersepchar = "|"
740 headersepchar = "|"
741
741
742 # Character for padding data cell entries
742 # Character for padding data cell entries
743 datapadchar = "."
743 datapadchar = "."
744
744
745 # Column separator in data area
745 # Column separator in data area
746 datasepchar = "|"
746 datasepchar = "|"
747
747
748 # Character to use for "empty" cell (i.e. for non-existing attributes)
748 # Character to use for "empty" cell (i.e. for non-existing attributes)
749 nodatachar = "-"
749 nodatachar = "-"
750
750
751 # Prompts for modes that require keyboard input
751 # Prompts for modes that require keyboard input
752 prompts = {
752 prompts = {
753 "goto": _CommandGoto(),
753 "goto": _CommandGoto(),
754 "find": _CommandFind(),
754 "find": _CommandFind(),
755 "findbackwards": _CommandFindBackwards()
755 "findbackwards": _CommandFindBackwards()
756 }
756 }
757
757
758 # Maps curses key codes to "function" names
758 # Maps curses key codes to "function" names
759 keymap = Keymap()
759 keymap = Keymap()
760 keymap.register("quit", "q")
760 keymap.register("quit", "q")
761 keymap.register("up", curses.KEY_UP)
761 keymap.register("up", curses.KEY_UP)
762 keymap.register("down", curses.KEY_DOWN)
762 keymap.register("down", curses.KEY_DOWN)
763 keymap.register("pageup", curses.KEY_PPAGE)
763 keymap.register("pageup", curses.KEY_PPAGE)
764 keymap.register("pagedown", curses.KEY_NPAGE)
764 keymap.register("pagedown", curses.KEY_NPAGE)
765 keymap.register("left", curses.KEY_LEFT)
765 keymap.register("left", curses.KEY_LEFT)
766 keymap.register("right", curses.KEY_RIGHT)
766 keymap.register("right", curses.KEY_RIGHT)
767 keymap.register("home", curses.KEY_HOME, "\x01")
767 keymap.register("home", curses.KEY_HOME, "\x01")
768 keymap.register("end", curses.KEY_END, "\x05")
768 keymap.register("end", curses.KEY_END, "\x05")
769 keymap.register("prevattr", "<\x1b")
769 keymap.register("prevattr", "<\x1b")
770 keymap.register("nextattr", ">\t")
770 keymap.register("nextattr", ">\t")
771 keymap.register("pick", "p")
771 keymap.register("pick", "p")
772 keymap.register("pickattr", "P")
772 keymap.register("pickattr", "P")
773 keymap.register("pickallattrs", "C")
773 keymap.register("pickallattrs", "C")
774 keymap.register("pickmarked", "m")
774 keymap.register("pickmarked", "m")
775 keymap.register("pickmarkedattr", "M")
775 keymap.register("pickmarkedattr", "M")
776 keymap.register("hideattr", "h")
776 keymap.register("hideattr", "h")
777 keymap.register("unhideattrs", "H")
777 keymap.register("unhideattrs", "H")
778 keymap.register("help", "?")
778 keymap.register("help", "?")
779 keymap.register("enter", "\r\n")
779 keymap.register("enter", "\r\n")
780 keymap.register("enterattr", "E")
780 keymap.register("enterattr", "E")
781 # FIXME: What's happening here?
781 # FIXME: What's happening here?
782 keymap.register("leave", curses.KEY_BACKSPACE, "x\x08\x7f")
782 keymap.register("leave", curses.KEY_BACKSPACE, "x\x08\x7f")
783 keymap.register("detail", "d")
783 keymap.register("detail", "d")
784 keymap.register("detailattr", "D")
784 keymap.register("detailattr", "D")
785 keymap.register("tooglemark", " ")
785 keymap.register("tooglemark", " ")
786 keymap.register("markrange", "%")
786 keymap.register("markrange", "%")
787 keymap.register("sortattrasc", "v")
787 keymap.register("sortattrasc", "v")
788 keymap.register("sortattrdesc", "V")
788 keymap.register("sortattrdesc", "V")
789 keymap.register("goto", "g")
789 keymap.register("goto", "g")
790 keymap.register("find", "f")
790 keymap.register("find", "f")
791 keymap.register("findbackwards", "b")
791 keymap.register("findbackwards", "b")
792 keymap.register("refresh", "r")
792 keymap.register("refresh", "r")
793 keymap.register("refreshfind", "R")
793 keymap.register("refreshfind", "R")
794
794
795 def __init__(self, *attrs):
795 def __init__(self, *attrs):
796 """
796 """
797 Create a new browser. If ``attrs`` is not empty, it is the list
797 Create a new browser. If ``attrs`` is not empty, it is the list
798 of attributes that will be displayed in the browser, otherwise
798 of attributes that will be displayed in the browser, otherwise
799 these will be determined by the objects on screen.
799 these will be determined by the objects on screen.
800 """
800 """
801 self.attrs = attrs
801 self.attrs = attrs
802
802
803 # Stack of browser levels
803 # Stack of browser levels
804 self.levels = []
804 self.levels = []
805 # how many colums to scroll (Changes when accelerating)
805 # how many colums to scroll (Changes when accelerating)
806 self.stepx = 1.
806 self.stepx = 1.
807
807
808 # how many rows to scroll (Changes when accelerating)
808 # how many rows to scroll (Changes when accelerating)
809 self.stepy = 1.
809 self.stepy = 1.
810
810
811 # Beep on the edges of the data area? (Will be set to ``False``
811 # Beep on the edges of the data area? (Will be set to ``False``
812 # once the cursor hits the edge of the screen, so we don't get
812 # once the cursor hits the edge of the screen, so we don't get
813 # multiple beeps).
813 # multiple beeps).
814 self._dobeep = True
814 self._dobeep = True
815
815
816 # Cache for registered ``curses`` colors and styles.
816 # Cache for registered ``curses`` colors and styles.
817 self._styles = {}
817 self._styles = {}
818 self._colors = {}
818 self._colors = {}
819 self._maxcolor = 1
819 self._maxcolor = 1
820
820
821 # How many header lines do we want to paint (the numbers of levels
821 # How many header lines do we want to paint (the numbers of levels
822 # we have, but with an upper bound)
822 # we have, but with an upper bound)
823 self._headerlines = 1
823 self._headerlines = 1
824
824
825 # Index of first header line
825 # Index of first header line
826 self._firstheaderline = 0
826 self._firstheaderline = 0
827
827
828 # curses window
828 # curses window
829 self.scr = None
829 self.scr = None
830 # report in the footer line (error, executed command etc.)
830 # report in the footer line (error, executed command etc.)
831 self._report = None
831 self._report = None
832
832
833 # value to be returned to the caller (set by commands)
833 # value to be returned to the caller (set by commands)
834 self.returnvalue = None
834 self.returnvalue = None
835
835
836 # The mode the browser is in
836 # The mode the browser is in
837 # e.g. normal browsing or entering an argument for a command
837 # e.g. normal browsing or entering an argument for a command
838 self.mode = "default"
838 self.mode = "default"
839
839
840 # set by the SIGWINCH signal handler
840 # set by the SIGWINCH signal handler
841 self.resized = False
841 self.resized = False
842
842
843 def nextstepx(self, step):
843 def nextstepx(self, step):
844 """
844 """
845 Accelerate horizontally.
845 Accelerate horizontally.
846 """
846 """
847 return max(1., min(step*self.acceleratex,
847 return max(1., min(step*self.acceleratex,
848 self.maxspeedx*self.levels[-1].mainsizex))
848 self.maxspeedx*self.levels[-1].mainsizex))
849
849
850 def nextstepy(self, step):
850 def nextstepy(self, step):
851 """
851 """
852 Accelerate vertically.
852 Accelerate vertically.
853 """
853 """
854 return max(1., min(step*self.acceleratey,
854 return max(1., min(step*self.acceleratey,
855 self.maxspeedy*self.levels[-1].mainsizey))
855 self.maxspeedy*self.levels[-1].mainsizey))
856
856
857 def getstyle(self, style):
857 def getstyle(self, style):
858 """
858 """
859 Register the ``style`` with ``curses`` or get it from the cache,
859 Register the ``style`` with ``curses`` or get it from the cache,
860 if it has been registered before.
860 if it has been registered before.
861 """
861 """
862 try:
862 try:
863 return self._styles[style.fg, style.bg, style.attrs]
863 return self._styles[style.fg, style.bg, style.attrs]
864 except KeyError:
864 except KeyError:
865 attrs = 0
865 attrs = 0
866 for b in astyle.A2CURSES:
866 for b in astyle.A2CURSES:
867 if style.attrs & b:
867 if style.attrs & b:
868 attrs |= astyle.A2CURSES[b]
868 attrs |= astyle.A2CURSES[b]
869 try:
869 try:
870 color = self._colors[style.fg, style.bg]
870 color = self._colors[style.fg, style.bg]
871 except KeyError:
871 except KeyError:
872 curses.init_pair(
872 curses.init_pair(
873 self._maxcolor,
873 self._maxcolor,
874 astyle.COLOR2CURSES[style.fg],
874 astyle.COLOR2CURSES[style.fg],
875 astyle.COLOR2CURSES[style.bg]
875 astyle.COLOR2CURSES[style.bg]
876 )
876 )
877 color = curses.color_pair(self._maxcolor)
877 color = curses.color_pair(self._maxcolor)
878 self._colors[style.fg, style.bg] = color
878 self._colors[style.fg, style.bg] = color
879 self._maxcolor += 1
879 self._maxcolor += 1
880 c = color | attrs
880 c = color | attrs
881 self._styles[style.fg, style.bg, style.attrs] = c
881 self._styles[style.fg, style.bg, style.attrs] = c
882 return c
882 return c
883
883
884 def addstr(self, y, x, begx, endx, text, style):
884 def addstr(self, y, x, begx, endx, text, style):
885 """
885 """
886 A version of ``curses.addstr()`` that can handle ``x`` coordinates
886 A version of ``curses.addstr()`` that can handle ``x`` coordinates
887 that are outside the screen.
887 that are outside the screen.
888 """
888 """
889 text2 = text[max(0, begx-x):max(0, endx-x)]
889 text2 = text[max(0, begx-x):max(0, endx-x)]
890 if text2:
890 if text2:
891 self.scr.addstr(y, max(x, begx), text2, self.getstyle(style))
891 self.scr.addstr(y, max(x, begx), text2, self.getstyle(style))
892 return len(text)
892 return len(text)
893
893
894 def addchr(self, y, x, begx, endx, c, l, style):
894 def addchr(self, y, x, begx, endx, c, l, style):
895 x0 = max(x, begx)
895 x0 = max(x, begx)
896 x1 = min(x+l, endx)
896 x1 = min(x+l, endx)
897 if x1>x0:
897 if x1>x0:
898 self.scr.addstr(y, x0, c*(x1-x0), self.getstyle(style))
898 self.scr.addstr(y, x0, c*(x1-x0), self.getstyle(style))
899 return l
899 return l
900
900
901 def _calcheaderlines(self, levels):
901 def _calcheaderlines(self, levels):
902 # Calculate how many headerlines do we have to display, if we have
902 # Calculate how many headerlines do we have to display, if we have
903 # ``levels`` browser levels
903 # ``levels`` browser levels
904 if levels is None:
904 if levels is None:
905 levels = len(self.levels)
905 levels = len(self.levels)
906 self._headerlines = min(self.maxheaders, levels)
906 self._headerlines = min(self.maxheaders, levels)
907 self._firstheaderline = levels-self._headerlines
907 self._firstheaderline = levels-self._headerlines
908
908
909 def getstylehere(self, style):
909 def getstylehere(self, style):
910 """
910 """
911 Return a style for displaying the original style ``style``
911 Return a style for displaying the original style ``style``
912 in the row the cursor is on.
912 in the row the cursor is on.
913 """
913 """
914 return astyle.Style(style.fg, astyle.COLOR_BLUE, style.attrs | astyle.A_BOLD)
914 return astyle.Style(style.fg, astyle.COLOR_BLUE, style.attrs | astyle.A_BOLD)
915
915
916 def report(self, msg):
916 def report(self, msg):
917 """
917 """
918 Store the message ``msg`` for display below the footer line. This
918 Store the message ``msg`` for display below the footer line. This
919 will be displayed as soon as the screen is redrawn.
919 will be displayed as soon as the screen is redrawn.
920 """
920 """
921 self._report = msg
921 self._report = msg
922
922
923 def enter(self, item, *attrs):
923 def enter(self, item, *attrs):
924 """
924 """
925 Enter the object ``item``. If ``attrs`` is specified, it will be used
925 Enter the object ``item``. If ``attrs`` is specified, it will be used
926 as a fixed list of attributes to display.
926 as a fixed list of attributes to display.
927 """
927 """
928 oldlevels = len(self.levels)
928 if self.levels and item is self.levels[-1].input:
929 self._calcheaderlines(oldlevels+1)
930 try:
931 level = _BrowserLevel(
932 self,
933 item,
934 self.scrsizey-1-self._headerlines-2,
935 *attrs
936 )
937 except (KeyboardInterrupt, SystemExit):
938 raise
939 except Exception, exc:
940 self._calcheaderlines(oldlevels)
941 curses.beep()
929 curses.beep()
942 self.report(exc)
930 self.report(CommandError("Recursion on input object"))
943 else:
931 else:
944 self.levels.append(level)
932 oldlevels = len(self.levels)
933 self._calcheaderlines(oldlevels+1)
934 try:
935 level = _BrowserLevel(
936 self,
937 item,
938 self.scrsizey-1-self._headerlines-2,
939 *attrs
940 )
941 except (KeyboardInterrupt, SystemExit):
942 raise
943 except Exception, exc:
944 self._calcheaderlines(oldlevels)
945 curses.beep()
946 self.report(exc)
947 else:
948 self.levels.append(level)
945
949
946 def startkeyboardinput(self, mode):
950 def startkeyboardinput(self, mode):
947 """
951 """
948 Enter mode ``mode``, which requires keyboard input.
952 Enter mode ``mode``, which requires keyboard input.
949 """
953 """
950 self.mode = mode
954 self.mode = mode
951 self.prompts[mode].start()
955 self.prompts[mode].start()
952
956
953 def keylabel(self, keycode):
957 def keylabel(self, keycode):
954 """
958 """
955 Return a pretty name for the ``curses`` key ``keycode`` (used in the
959 Return a pretty name for the ``curses`` key ``keycode`` (used in the
956 help screen and in reports about unassigned keys).
960 help screen and in reports about unassigned keys).
957 """
961 """
958 if keycode <= 0xff:
962 if keycode <= 0xff:
959 specialsnames = {
963 specialsnames = {
960 ord("\n"): "RETURN",
964 ord("\n"): "RETURN",
961 ord(" "): "SPACE",
965 ord(" "): "SPACE",
962 ord("\t"): "TAB",
966 ord("\t"): "TAB",
963 ord("\x7f"): "DELETE",
967 ord("\x7f"): "DELETE",
964 ord("\x08"): "BACKSPACE",
968 ord("\x08"): "BACKSPACE",
965 }
969 }
966 if keycode in specialsnames:
970 if keycode in specialsnames:
967 return specialsnames[keycode]
971 return specialsnames[keycode]
968 elif 0x00 < keycode < 0x20:
972 elif 0x00 < keycode < 0x20:
969 return "CTRL-%s" % chr(keycode + 64)
973 return "CTRL-%s" % chr(keycode + 64)
970 return repr(chr(keycode))
974 return repr(chr(keycode))
971 for name in dir(curses):
975 for name in dir(curses):
972 if name.startswith("KEY_") and getattr(curses, name) == keycode:
976 if name.startswith("KEY_") and getattr(curses, name) == keycode:
973 return name
977 return name
974 return str(keycode)
978 return str(keycode)
975
979
976 def beep(self, force=False):
980 def beep(self, force=False):
977 if force or self._dobeep:
981 if force or self._dobeep:
978 curses.beep()
982 curses.beep()
979 # don't beep again (as long as the same key is pressed)
983 # don't beep again (as long as the same key is pressed)
980 self._dobeep = False
984 self._dobeep = False
981
985
982 def cmd_up(self):
986 def cmd_up(self):
983 """
987 """
984 Move the cursor to the previous row.
988 Move the cursor to the previous row.
985 """
989 """
986 level = self.levels[-1]
990 level = self.levels[-1]
987 self.report("up")
991 self.report("up")
988 level.moveto(level.curx, level.cury-self.stepy)
992 level.moveto(level.curx, level.cury-self.stepy)
989
993
990 def cmd_down(self):
994 def cmd_down(self):
991 """
995 """
992 Move the cursor to the next row.
996 Move the cursor to the next row.
993 """
997 """
994 level = self.levels[-1]
998 level = self.levels[-1]
995 self.report("down")
999 self.report("down")
996 level.moveto(level.curx, level.cury+self.stepy)
1000 level.moveto(level.curx, level.cury+self.stepy)
997
1001
998 def cmd_pageup(self):
1002 def cmd_pageup(self):
999 """
1003 """
1000 Move the cursor up one page.
1004 Move the cursor up one page.
1001 """
1005 """
1002 level = self.levels[-1]
1006 level = self.levels[-1]
1003 self.report("page up")
1007 self.report("page up")
1004 level.moveto(level.curx, level.cury-level.mainsizey+self.pageoverlapy)
1008 level.moveto(level.curx, level.cury-level.mainsizey+self.pageoverlapy)
1005
1009
1006 def cmd_pagedown(self):
1010 def cmd_pagedown(self):
1007 """
1011 """
1008 Move the cursor down one page.
1012 Move the cursor down one page.
1009 """
1013 """
1010 level = self.levels[-1]
1014 level = self.levels[-1]
1011 self.report("page down")
1015 self.report("page down")
1012 level.moveto(level.curx, level.cury+level.mainsizey-self.pageoverlapy)
1016 level.moveto(level.curx, level.cury+level.mainsizey-self.pageoverlapy)
1013
1017
1014 def cmd_left(self):
1018 def cmd_left(self):
1015 """
1019 """
1016 Move the cursor left.
1020 Move the cursor left.
1017 """
1021 """
1018 level = self.levels[-1]
1022 level = self.levels[-1]
1019 self.report("left")
1023 self.report("left")
1020 level.moveto(level.curx-self.stepx, level.cury)
1024 level.moveto(level.curx-self.stepx, level.cury)
1021
1025
1022 def cmd_right(self):
1026 def cmd_right(self):
1023 """
1027 """
1024 Move the cursor right.
1028 Move the cursor right.
1025 """
1029 """
1026 level = self.levels[-1]
1030 level = self.levels[-1]
1027 self.report("right")
1031 self.report("right")
1028 level.moveto(level.curx+self.stepx, level.cury)
1032 level.moveto(level.curx+self.stepx, level.cury)
1029
1033
1030 def cmd_home(self):
1034 def cmd_home(self):
1031 """
1035 """
1032 Move the cursor to the first column.
1036 Move the cursor to the first column.
1033 """
1037 """
1034 level = self.levels[-1]
1038 level = self.levels[-1]
1035 self.report("home")
1039 self.report("home")
1036 level.moveto(0, level.cury)
1040 level.moveto(0, level.cury)
1037
1041
1038 def cmd_end(self):
1042 def cmd_end(self):
1039 """
1043 """
1040 Move the cursor to the last column.
1044 Move the cursor to the last column.
1041 """
1045 """
1042 level = self.levels[-1]
1046 level = self.levels[-1]
1043 self.report("end")
1047 self.report("end")
1044 level.moveto(level.datasizex+level.mainsizey-self.pageoverlapx, level.cury)
1048 level.moveto(level.datasizex+level.mainsizey-self.pageoverlapx, level.cury)
1045
1049
1046 def cmd_prevattr(self):
1050 def cmd_prevattr(self):
1047 """
1051 """
1048 Move the cursor one attribute column to the left.
1052 Move the cursor one attribute column to the left.
1049 """
1053 """
1050 level = self.levels[-1]
1054 level = self.levels[-1]
1051 if level.displayattr[0] is None or level.displayattr[0] == 0:
1055 if level.displayattr[0] is None or level.displayattr[0] == 0:
1052 self.beep()
1056 self.beep()
1053 else:
1057 else:
1054 self.report("prevattr")
1058 self.report("prevattr")
1055 pos = 0
1059 pos = 0
1056 for (i, attrname) in enumerate(level.displayattrs):
1060 for (i, attrname) in enumerate(level.displayattrs):
1057 if i == level.displayattr[0]-1:
1061 if i == level.displayattr[0]-1:
1058 break
1062 break
1059 pos += level.colwidths[attrname] + 1
1063 pos += level.colwidths[attrname] + 1
1060 level.moveto(pos, level.cury)
1064 level.moveto(pos, level.cury)
1061
1065
1062 def cmd_nextattr(self):
1066 def cmd_nextattr(self):
1063 """
1067 """
1064 Move the cursor one attribute column to the right.
1068 Move the cursor one attribute column to the right.
1065 """
1069 """
1066 level = self.levels[-1]
1070 level = self.levels[-1]
1067 if level.displayattr[0] is None or level.displayattr[0] == len(level.displayattrs)-1:
1071 if level.displayattr[0] is None or level.displayattr[0] == len(level.displayattrs)-1:
1068 self.beep()
1072 self.beep()
1069 else:
1073 else:
1070 self.report("nextattr")
1074 self.report("nextattr")
1071 pos = 0
1075 pos = 0
1072 for (i, attrname) in enumerate(level.displayattrs):
1076 for (i, attrname) in enumerate(level.displayattrs):
1073 if i == level.displayattr[0]+1:
1077 if i == level.displayattr[0]+1:
1074 break
1078 break
1075 pos += level.colwidths[attrname] + 1
1079 pos += level.colwidths[attrname] + 1
1076 level.moveto(pos, level.cury)
1080 level.moveto(pos, level.cury)
1077
1081
1078 def cmd_pick(self):
1082 def cmd_pick(self):
1079 """
1083 """
1080 'Pick' the object under the cursor (i.e. the row the cursor is on).
1084 'Pick' the object under the cursor (i.e. the row the cursor is on).
1081 This leaves the browser and returns the picked object to the caller.
1085 This leaves the browser and returns the picked object to the caller.
1082 (In IPython this object will be available as the ``_`` variable.)
1086 (In IPython this object will be available as the ``_`` variable.)
1083 """
1087 """
1084 level = self.levels[-1]
1088 level = self.levels[-1]
1085 self.returnvalue = level.items[level.cury].item
1089 self.returnvalue = level.items[level.cury].item
1086 return True
1090 return True
1087
1091
1088 def cmd_pickattr(self):
1092 def cmd_pickattr(self):
1089 """
1093 """
1090 'Pick' the attribute under the cursor (i.e. the row/column the
1094 'Pick' the attribute under the cursor (i.e. the row/column the
1091 cursor is on).
1095 cursor is on).
1092 """
1096 """
1093 level = self.levels[-1]
1097 level = self.levels[-1]
1094 attr = level.displayattr[1]
1098 attr = level.displayattr[1]
1095 if attr is ipipe.noitem:
1099 if attr is ipipe.noitem:
1096 curses.beep()
1100 curses.beep()
1097 self.report(CommandError("no column under cursor"))
1101 self.report(CommandError("no column under cursor"))
1098 return
1102 return
1099 value = attr.value(level.items[level.cury].item)
1103 value = attr.value(level.items[level.cury].item)
1100 if value is ipipe.noitem:
1104 if value is ipipe.noitem:
1101 curses.beep()
1105 curses.beep()
1102 self.report(AttributeError(attr.name()))
1106 self.report(AttributeError(attr.name()))
1103 else:
1107 else:
1104 self.returnvalue = value
1108 self.returnvalue = value
1105 return True
1109 return True
1106
1110
1107 def cmd_pickallattrs(self):
1111 def cmd_pickallattrs(self):
1108 """
1112 """
1109 Pick' the complete column under the cursor (i.e. the attribute under
1113 Pick' the complete column under the cursor (i.e. the attribute under
1110 the cursor) from all currently fetched objects. These attributes
1114 the cursor) from all currently fetched objects. These attributes
1111 will be returned as a list.
1115 will be returned as a list.
1112 """
1116 """
1113 level = self.levels[-1]
1117 level = self.levels[-1]
1114 attr = level.displayattr[1]
1118 attr = level.displayattr[1]
1115 if attr is ipipe.noitem:
1119 if attr is ipipe.noitem:
1116 curses.beep()
1120 curses.beep()
1117 self.report(CommandError("no column under cursor"))
1121 self.report(CommandError("no column under cursor"))
1118 return
1122 return
1119 result = []
1123 result = []
1120 for cache in level.items:
1124 for cache in level.items:
1121 value = attr.value(cache.item)
1125 value = attr.value(cache.item)
1122 if value is not ipipe.noitem:
1126 if value is not ipipe.noitem:
1123 result.append(value)
1127 result.append(value)
1124 self.returnvalue = result
1128 self.returnvalue = result
1125 return True
1129 return True
1126
1130
1127 def cmd_pickmarked(self):
1131 def cmd_pickmarked(self):
1128 """
1132 """
1129 'Pick' marked objects. Marked objects will be returned as a list.
1133 'Pick' marked objects. Marked objects will be returned as a list.
1130 """
1134 """
1131 level = self.levels[-1]
1135 level = self.levels[-1]
1132 self.returnvalue = [cache.item for cache in level.items if cache.marked]
1136 self.returnvalue = [cache.item for cache in level.items if cache.marked]
1133 return True
1137 return True
1134
1138
1135 def cmd_pickmarkedattr(self):
1139 def cmd_pickmarkedattr(self):
1136 """
1140 """
1137 'Pick' the attribute under the cursor from all marked objects
1141 'Pick' the attribute under the cursor from all marked objects
1138 (This returns a list).
1142 (This returns a list).
1139 """
1143 """
1140
1144
1141 level = self.levels[-1]
1145 level = self.levels[-1]
1142 attr = level.displayattr[1]
1146 attr = level.displayattr[1]
1143 if attr is ipipe.noitem:
1147 if attr is ipipe.noitem:
1144 curses.beep()
1148 curses.beep()
1145 self.report(CommandError("no column under cursor"))
1149 self.report(CommandError("no column under cursor"))
1146 return
1150 return
1147 result = []
1151 result = []
1148 for cache in level.items:
1152 for cache in level.items:
1149 if cache.marked:
1153 if cache.marked:
1150 value = attr.value(cache.item)
1154 value = attr.value(cache.item)
1151 if value is not ipipe.noitem:
1155 if value is not ipipe.noitem:
1152 result.append(value)
1156 result.append(value)
1153 self.returnvalue = result
1157 self.returnvalue = result
1154 return True
1158 return True
1155
1159
1156 def cmd_markrange(self):
1160 def cmd_markrange(self):
1157 """
1161 """
1158 Mark all objects from the last marked object before the current cursor
1162 Mark all objects from the last marked object before the current cursor
1159 position to the cursor position.
1163 position to the cursor position.
1160 """
1164 """
1161 level = self.levels[-1]
1165 level = self.levels[-1]
1162 self.report("markrange")
1166 self.report("markrange")
1163 start = None
1167 start = None
1164 if level.items:
1168 if level.items:
1165 for i in xrange(level.cury, -1, -1):
1169 for i in xrange(level.cury, -1, -1):
1166 if level.items[i].marked:
1170 if level.items[i].marked:
1167 start = i
1171 start = i
1168 break
1172 break
1169 if start is None:
1173 if start is None:
1170 self.report(CommandError("no mark before cursor"))
1174 self.report(CommandError("no mark before cursor"))
1171 curses.beep()
1175 curses.beep()
1172 else:
1176 else:
1173 for i in xrange(start, level.cury+1):
1177 for i in xrange(start, level.cury+1):
1174 cache = level.items[i]
1178 cache = level.items[i]
1175 if not cache.marked:
1179 if not cache.marked:
1176 cache.marked = True
1180 cache.marked = True
1177 level.marked += 1
1181 level.marked += 1
1178
1182
1179 def cmd_enter(self):
1183 def cmd_enter(self):
1180 """
1184 """
1181 Enter the object under the cursor. (what this mean depends on the object
1185 Enter the object under the cursor. (what this mean depends on the object
1182 itself (i.e. how it implements iteration). This opens a new browser 'level'.
1186 itself (i.e. how it implements iteration). This opens a new browser 'level'.
1183 """
1187 """
1184 level = self.levels[-1]
1188 level = self.levels[-1]
1185 try:
1189 try:
1186 item = level.items[level.cury].item
1190 item = level.items[level.cury].item
1187 except IndexError:
1191 except IndexError:
1188 self.report(CommandError("No object"))
1192 self.report(CommandError("No object"))
1189 curses.beep()
1193 curses.beep()
1190 else:
1194 else:
1191 self.report("entering object...")
1195 self.report("entering object...")
1192 self.enter(item)
1196 self.enter(item)
1193
1197
1194 def cmd_leave(self):
1198 def cmd_leave(self):
1195 """
1199 """
1196 Leave the current browser level and go back to the previous one.
1200 Leave the current browser level and go back to the previous one.
1197 """
1201 """
1198 self.report("leave")
1202 self.report("leave")
1199 if len(self.levels) > 1:
1203 if len(self.levels) > 1:
1200 self._calcheaderlines(len(self.levels)-1)
1204 self._calcheaderlines(len(self.levels)-1)
1201 self.levels.pop(-1)
1205 self.levels.pop(-1)
1202 else:
1206 else:
1203 self.report(CommandError("This is the last level"))
1207 self.report(CommandError("This is the last level"))
1204 curses.beep()
1208 curses.beep()
1205
1209
1206 def cmd_enterattr(self):
1210 def cmd_enterattr(self):
1207 """
1211 """
1208 Enter the attribute under the cursor.
1212 Enter the attribute under the cursor.
1209 """
1213 """
1210 level = self.levels[-1]
1214 level = self.levels[-1]
1211 attr = level.displayattr[1]
1215 attr = level.displayattr[1]
1212 if attr is ipipe.noitem:
1216 if attr is ipipe.noitem:
1213 curses.beep()
1217 curses.beep()
1214 self.report(CommandError("no column under cursor"))
1218 self.report(CommandError("no column under cursor"))
1215 return
1219 return
1216 try:
1220 try:
1217 item = level.items[level.cury].item
1221 item = level.items[level.cury].item
1218 except IndexError:
1222 except IndexError:
1219 self.report(CommandError("No object"))
1223 self.report(CommandError("No object"))
1220 curses.beep()
1224 curses.beep()
1221 else:
1225 else:
1222 value = attr.value(item)
1226 value = attr.value(item)
1223 name = attr.name()
1227 name = attr.name()
1224 if value is ipipe.noitem:
1228 if value is ipipe.noitem:
1225 self.report(AttributeError(name))
1229 self.report(AttributeError(name))
1226 else:
1230 else:
1227 self.report("entering object attribute %s..." % name)
1231 self.report("entering object attribute %s..." % name)
1228 self.enter(value)
1232 self.enter(value)
1229
1233
1230 def cmd_detail(self):
1234 def cmd_detail(self):
1231 """
1235 """
1232 Show a detail view of the object under the cursor. This shows the
1236 Show a detail view of the object under the cursor. This shows the
1233 name, type, doc string and value of the object attributes (and it
1237 name, type, doc string and value of the object attributes (and it
1234 might show more attributes than in the list view, depending on
1238 might show more attributes than in the list view, depending on
1235 the object).
1239 the object).
1236 """
1240 """
1237 level = self.levels[-1]
1241 level = self.levels[-1]
1238 try:
1242 try:
1239 item = level.items[level.cury].item
1243 item = level.items[level.cury].item
1240 except IndexError:
1244 except IndexError:
1241 self.report(CommandError("No object"))
1245 self.report(CommandError("No object"))
1242 curses.beep()
1246 curses.beep()
1243 else:
1247 else:
1244 self.report("entering detail view for object...")
1248 self.report("entering detail view for object...")
1245 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1249 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1246 self.enter(attrs)
1250 self.enter(attrs)
1247
1251
1248 def cmd_detailattr(self):
1252 def cmd_detailattr(self):
1249 """
1253 """
1250 Show a detail view of the attribute under the cursor.
1254 Show a detail view of the attribute under the cursor.
1251 """
1255 """
1252 level = self.levels[-1]
1256 level = self.levels[-1]
1253 attr = level.displayattr[1]
1257 attr = level.displayattr[1]
1254 if attr is ipipe.noitem:
1258 if attr is ipipe.noitem:
1255 curses.beep()
1259 curses.beep()
1256 self.report(CommandError("no attribute"))
1260 self.report(CommandError("no attribute"))
1257 return
1261 return
1258 try:
1262 try:
1259 item = level.items[level.cury].item
1263 item = level.items[level.cury].item
1260 except IndexError:
1264 except IndexError:
1261 self.report(CommandError("No object"))
1265 self.report(CommandError("No object"))
1262 curses.beep()
1266 curses.beep()
1263 else:
1267 else:
1264 try:
1268 try:
1265 item = attr.value(item)
1269 item = attr.value(item)
1266 except (KeyboardInterrupt, SystemExit):
1270 except (KeyboardInterrupt, SystemExit):
1267 raise
1271 raise
1268 except Exception, exc:
1272 except Exception, exc:
1269 self.report(exc)
1273 self.report(exc)
1270 else:
1274 else:
1271 self.report("entering detail view for attribute %s..." % attr.name())
1275 self.report("entering detail view for attribute %s..." % attr.name())
1272 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1276 attrs = [ipipe.AttributeDetail(item, attr) for attr in ipipe.xattrs(item, "detail")]
1273 self.enter(attrs)
1277 self.enter(attrs)
1274
1278
1275 def cmd_tooglemark(self):
1279 def cmd_tooglemark(self):
1276 """
1280 """
1277 Mark/unmark the object under the cursor. Marked objects have a '!'
1281 Mark/unmark the object under the cursor. Marked objects have a '!'
1278 after the row number).
1282 after the row number).
1279 """
1283 """
1280 level = self.levels[-1]
1284 level = self.levels[-1]
1281 self.report("toggle mark")
1285 self.report("toggle mark")
1282 try:
1286 try:
1283 item = level.items[level.cury]
1287 item = level.items[level.cury]
1284 except IndexError: # no items?
1288 except IndexError: # no items?
1285 pass
1289 pass
1286 else:
1290 else:
1287 if item.marked:
1291 if item.marked:
1288 item.marked = False
1292 item.marked = False
1289 level.marked -= 1
1293 level.marked -= 1
1290 else:
1294 else:
1291 item.marked = True
1295 item.marked = True
1292 level.marked += 1
1296 level.marked += 1
1293
1297
1294 def cmd_sortattrasc(self):
1298 def cmd_sortattrasc(self):
1295 """
1299 """
1296 Sort the objects (in ascending order) using the attribute under
1300 Sort the objects (in ascending order) using the attribute under
1297 the cursor as the sort key.
1301 the cursor as the sort key.
1298 """
1302 """
1299 level = self.levels[-1]
1303 level = self.levels[-1]
1300 attr = level.displayattr[1]
1304 attr = level.displayattr[1]
1301 if attr is ipipe.noitem:
1305 if attr is ipipe.noitem:
1302 curses.beep()
1306 curses.beep()
1303 self.report(CommandError("no column under cursor"))
1307 self.report(CommandError("no column under cursor"))
1304 return
1308 return
1305 self.report("sort by %s (ascending)" % attr.name())
1309 self.report("sort by %s (ascending)" % attr.name())
1306 def key(item):
1310 def key(item):
1307 try:
1311 try:
1308 return attr.value(item)
1312 return attr.value(item)
1309 except (KeyboardInterrupt, SystemExit):
1313 except (KeyboardInterrupt, SystemExit):
1310 raise
1314 raise
1311 except Exception:
1315 except Exception:
1312 return None
1316 return None
1313 level.sort(key)
1317 level.sort(key)
1314
1318
1315 def cmd_sortattrdesc(self):
1319 def cmd_sortattrdesc(self):
1316 """
1320 """
1317 Sort the objects (in descending order) using the attribute under
1321 Sort the objects (in descending order) using the attribute under
1318 the cursor as the sort key.
1322 the cursor as the sort key.
1319 """
1323 """
1320 level = self.levels[-1]
1324 level = self.levels[-1]
1321 attr = level.displayattr[1]
1325 attr = level.displayattr[1]
1322 if attr is ipipe.noitem:
1326 if attr is ipipe.noitem:
1323 curses.beep()
1327 curses.beep()
1324 self.report(CommandError("no column under cursor"))
1328 self.report(CommandError("no column under cursor"))
1325 return
1329 return
1326 self.report("sort by %s (descending)" % attr.name())
1330 self.report("sort by %s (descending)" % attr.name())
1327 def key(item):
1331 def key(item):
1328 try:
1332 try:
1329 return attr.value(item)
1333 return attr.value(item)
1330 except (KeyboardInterrupt, SystemExit):
1334 except (KeyboardInterrupt, SystemExit):
1331 raise
1335 raise
1332 except Exception:
1336 except Exception:
1333 return None
1337 return None
1334 level.sort(key, reverse=True)
1338 level.sort(key, reverse=True)
1335
1339
1336 def cmd_hideattr(self):
1340 def cmd_hideattr(self):
1337 """
1341 """
1338 Hide the attribute under the cursor.
1342 Hide the attribute under the cursor.
1339 """
1343 """
1340 level = self.levels[-1]
1344 level = self.levels[-1]
1341 if level.displayattr[0] is None:
1345 if level.displayattr[0] is None:
1342 self.beep()
1346 self.beep()
1343 else:
1347 else:
1344 self.report("hideattr")
1348 self.report("hideattr")
1345 level.hiddenattrs.add(level.displayattr[1])
1349 level.hiddenattrs.add(level.displayattr[1])
1346 level.moveto(level.curx, level.cury, refresh=True)
1350 level.moveto(level.curx, level.cury, refresh=True)
1347
1351
1348 def cmd_unhideattrs(self):
1352 def cmd_unhideattrs(self):
1349 """
1353 """
1350 Make all attributes visible again.
1354 Make all attributes visible again.
1351 """
1355 """
1352 level = self.levels[-1]
1356 level = self.levels[-1]
1353 self.report("unhideattrs")
1357 self.report("unhideattrs")
1354 level.hiddenattrs.clear()
1358 level.hiddenattrs.clear()
1355 level.moveto(level.curx, level.cury, refresh=True)
1359 level.moveto(level.curx, level.cury, refresh=True)
1356
1360
1357 def cmd_goto(self):
1361 def cmd_goto(self):
1358 """
1362 """
1359 Jump to a row. The row number can be entered at the
1363 Jump to a row. The row number can be entered at the
1360 bottom of the screen.
1364 bottom of the screen.
1361 """
1365 """
1362 self.startkeyboardinput("goto")
1366 self.startkeyboardinput("goto")
1363
1367
1364 def cmd_find(self):
1368 def cmd_find(self):
1365 """
1369 """
1366 Search forward for a row. The search condition can be entered at the
1370 Search forward for a row. The search condition can be entered at the
1367 bottom of the screen.
1371 bottom of the screen.
1368 """
1372 """
1369 self.startkeyboardinput("find")
1373 self.startkeyboardinput("find")
1370
1374
1371 def cmd_findbackwards(self):
1375 def cmd_findbackwards(self):
1372 """
1376 """
1373 Search backward for a row. The search condition can be entered at the
1377 Search backward for a row. The search condition can be entered at the
1374 bottom of the screen.
1378 bottom of the screen.
1375 """
1379 """
1376 self.startkeyboardinput("findbackwards")
1380 self.startkeyboardinput("findbackwards")
1377
1381
1378 def cmd_refresh(self):
1382 def cmd_refresh(self):
1379 """
1383 """
1380 Refreshes the display by restarting the iterator.
1384 Refreshes the display by restarting the iterator.
1381 """
1385 """
1382 level = self.levels[-1]
1386 level = self.levels[-1]
1383 self.report("refresh")
1387 self.report("refresh")
1384 level.refresh()
1388 level.refresh()
1385
1389
1386 def cmd_refreshfind(self):
1390 def cmd_refreshfind(self):
1387 """
1391 """
1388 Refreshes the display by restarting the iterator and goes back to the
1392 Refreshes the display by restarting the iterator and goes back to the
1389 same object the cursor was on before restarting (if this object can't be
1393 same object the cursor was on before restarting (if this object can't be
1390 found the cursor jumps back to the first object).
1394 found the cursor jumps back to the first object).
1391 """
1395 """
1392 level = self.levels[-1]
1396 level = self.levels[-1]
1393 self.report("refreshfind")
1397 self.report("refreshfind")
1394 level.refreshfind()
1398 level.refreshfind()
1395
1399
1396 def cmd_help(self):
1400 def cmd_help(self):
1397 """
1401 """
1398 Opens the help screen as a new browser level, describing keyboard
1402 Opens the help screen as a new browser level, describing keyboard
1399 shortcuts.
1403 shortcuts.
1400 """
1404 """
1401 for level in self.levels:
1405 for level in self.levels:
1402 if isinstance(level.input, _BrowserHelp):
1406 if isinstance(level.input, _BrowserHelp):
1403 curses.beep()
1407 curses.beep()
1404 self.report(CommandError("help already active"))
1408 self.report(CommandError("help already active"))
1405 return
1409 return
1406
1410
1407 self.enter(_BrowserHelp(self))
1411 self.enter(_BrowserHelp(self))
1408
1412
1409 def cmd_quit(self):
1413 def cmd_quit(self):
1410 """
1414 """
1411 Quit the browser and return to the IPython prompt.
1415 Quit the browser and return to the IPython prompt.
1412 """
1416 """
1413 self.returnvalue = None
1417 self.returnvalue = None
1414 return True
1418 return True
1415
1419
1416 def sigwinchhandler(self, signal, frame):
1420 def sigwinchhandler(self, signal, frame):
1417 self.resized = True
1421 self.resized = True
1418
1422
1419 def _dodisplay(self, scr):
1423 def _dodisplay(self, scr):
1420 """
1424 """
1421 This method is the workhorse of the browser. It handles screen
1425 This method is the workhorse of the browser. It handles screen
1422 drawing and the keyboard.
1426 drawing and the keyboard.
1423 """
1427 """
1424 self.scr = scr
1428 self.scr = scr
1425 curses.halfdelay(1)
1429 curses.halfdelay(1)
1426 footery = 2
1430 footery = 2
1427
1431
1428 keys = []
1432 keys = []
1429 for cmd in ("quit", "help"):
1433 for cmd in ("quit", "help"):
1430 key = self.keymap.findkey(cmd, None)
1434 key = self.keymap.findkey(cmd, None)
1431 if key is not None:
1435 if key is not None:
1432 keys.append("%s=%s" % (self.keylabel(key), cmd))
1436 keys.append("%s=%s" % (self.keylabel(key), cmd))
1433 helpmsg = " | %s" % " ".join(keys)
1437 helpmsg = " | %s" % " ".join(keys)
1434
1438
1435 scr.clear()
1439 scr.clear()
1436 msg = "Fetching first batch of objects..."
1440 msg = "Fetching first batch of objects..."
1437 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1441 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1438 scr.addstr(self.scrsizey//2, (self.scrsizex-len(msg))//2, msg)
1442 scr.addstr(self.scrsizey//2, (self.scrsizex-len(msg))//2, msg)
1439 scr.refresh()
1443 scr.refresh()
1440
1444
1441 lastc = -1
1445 lastc = -1
1442
1446
1443 self.levels = []
1447 self.levels = []
1444 # enter the first level
1448 # enter the first level
1445 self.enter(self.input, *self.attrs)
1449 self.enter(self.input, *self.attrs)
1446
1450
1447 self._calcheaderlines(None)
1451 self._calcheaderlines(None)
1448
1452
1449 while True:
1453 while True:
1450 level = self.levels[-1]
1454 level = self.levels[-1]
1451 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1455 (self.scrsizey, self.scrsizex) = scr.getmaxyx()
1452 level.mainsizey = self.scrsizey-1-self._headerlines-footery
1456 level.mainsizey = self.scrsizey-1-self._headerlines-footery
1453
1457
1454 # Paint object header
1458 # Paint object header
1455 for i in xrange(self._firstheaderline, self._firstheaderline+self._headerlines):
1459 for i in xrange(self._firstheaderline, self._firstheaderline+self._headerlines):
1456 lv = self.levels[i]
1460 lv = self.levels[i]
1457 posx = 0
1461 posx = 0
1458 posy = i-self._firstheaderline
1462 posy = i-self._firstheaderline
1459 endx = self.scrsizex
1463 endx = self.scrsizex
1460 if i: # not the first level
1464 if i: # not the first level
1461 msg = " (%d/%d" % (self.levels[i-1].cury, len(self.levels[i-1].items))
1465 msg = " (%d/%d" % (self.levels[i-1].cury, len(self.levels[i-1].items))
1462 if not self.levels[i-1].exhausted:
1466 if not self.levels[i-1].exhausted:
1463 msg += "+"
1467 msg += "+"
1464 msg += ") "
1468 msg += ") "
1465 endx -= len(msg)+1
1469 endx -= len(msg)+1
1466 posx += self.addstr(posy, posx, 0, endx, " ibrowse #%d: " % i, self.style_objheadertext)
1470 posx += self.addstr(posy, posx, 0, endx, " ibrowse #%d: " % i, self.style_objheadertext)
1467 for (style, text) in lv.header:
1471 for (style, text) in lv.header:
1468 posx += self.addstr(posy, posx, 0, endx, text, self.style_objheaderobject)
1472 posx += self.addstr(posy, posx, 0, endx, text, self.style_objheaderobject)
1469 if posx >= endx:
1473 if posx >= endx:
1470 break
1474 break
1471 if i:
1475 if i:
1472 posx += self.addstr(posy, posx, 0, self.scrsizex, msg, self.style_objheadernumber)
1476 posx += self.addstr(posy, posx, 0, self.scrsizex, msg, self.style_objheadernumber)
1473 posx += self.addchr(posy, posx, 0, self.scrsizex, " ", self.scrsizex-posx, self.style_objheadernumber)
1477 posx += self.addchr(posy, posx, 0, self.scrsizex, " ", self.scrsizex-posx, self.style_objheadernumber)
1474
1478
1475 if not level.items:
1479 if not level.items:
1476 self.addchr(self._headerlines, 0, 0, self.scrsizex, " ", self.scrsizex, self.style_colheader)
1480 self.addchr(self._headerlines, 0, 0, self.scrsizex, " ", self.scrsizex, self.style_colheader)
1477 self.addstr(self._headerlines+1, 0, 0, self.scrsizex, " <empty>", astyle.style_error)
1481 self.addstr(self._headerlines+1, 0, 0, self.scrsizex, " <empty>", astyle.style_error)
1478 scr.clrtobot()
1482 scr.clrtobot()
1479 else:
1483 else:
1480 # Paint column headers
1484 # Paint column headers
1481 scr.move(self._headerlines, 0)
1485 scr.move(self._headerlines, 0)
1482 scr.addstr(" %*s " % (level.numbersizex, "#"), self.getstyle(self.style_colheader))
1486 scr.addstr(" %*s " % (level.numbersizex, "#"), self.getstyle(self.style_colheader))
1483 scr.addstr(self.headersepchar, self.getstyle(self.style_colheadersep))
1487 scr.addstr(self.headersepchar, self.getstyle(self.style_colheadersep))
1484 begx = level.numbersizex+3
1488 begx = level.numbersizex+3
1485 posx = begx-level.datastartx
1489 posx = begx-level.datastartx
1486 for attr in level.displayattrs:
1490 for attr in level.displayattrs:
1487 attrname = attr.name()
1491 attrname = attr.name()
1488 cwidth = level.colwidths[attr]
1492 cwidth = level.colwidths[attr]
1489 header = attrname.ljust(cwidth)
1493 header = attrname.ljust(cwidth)
1490 if attr is level.displayattr[1]:
1494 if attr is level.displayattr[1]:
1491 style = self.style_colheaderhere
1495 style = self.style_colheaderhere
1492 else:
1496 else:
1493 style = self.style_colheader
1497 style = self.style_colheader
1494 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, header, style)
1498 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, header, style)
1495 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, self.headersepchar, self.style_colheadersep)
1499 posx += self.addstr(self._headerlines, posx, begx, self.scrsizex, self.headersepchar, self.style_colheadersep)
1496 if posx >= self.scrsizex:
1500 if posx >= self.scrsizex:
1497 break
1501 break
1498 else:
1502 else:
1499 scr.addstr(" "*(self.scrsizex-posx), self.getstyle(self.style_colheader))
1503 scr.addstr(" "*(self.scrsizex-posx), self.getstyle(self.style_colheader))
1500
1504
1501 # Paint rows
1505 # Paint rows
1502 posy = self._headerlines+1+level.datastarty
1506 posy = self._headerlines+1+level.datastarty
1503 for i in xrange(level.datastarty, min(level.datastarty+level.mainsizey, len(level.items))):
1507 for i in xrange(level.datastarty, min(level.datastarty+level.mainsizey, len(level.items))):
1504 cache = level.items[i]
1508 cache = level.items[i]
1505 if i == level.cury:
1509 if i == level.cury:
1506 style = self.style_numberhere
1510 style = self.style_numberhere
1507 else:
1511 else:
1508 style = self.style_number
1512 style = self.style_number
1509
1513
1510 posy = self._headerlines+1+i-level.datastarty
1514 posy = self._headerlines+1+i-level.datastarty
1511 posx = begx-level.datastartx
1515 posx = begx-level.datastartx
1512
1516
1513 scr.move(posy, 0)
1517 scr.move(posy, 0)
1514 scr.addstr(" %*d%s" % (level.numbersizex, i, " !"[cache.marked]), self.getstyle(style))
1518 scr.addstr(" %*d%s" % (level.numbersizex, i, " !"[cache.marked]), self.getstyle(style))
1515 scr.addstr(self.headersepchar, self.getstyle(self.style_sep))
1519 scr.addstr(self.headersepchar, self.getstyle(self.style_sep))
1516
1520
1517 for attrname in level.displayattrs:
1521 for attrname in level.displayattrs:
1518 cwidth = level.colwidths[attrname]
1522 cwidth = level.colwidths[attrname]
1519 try:
1523 try:
1520 (align, length, parts) = level.displayrows[i-level.datastarty][attrname]
1524 (align, length, parts) = level.displayrows[i-level.datastarty][attrname]
1521 except KeyError:
1525 except KeyError:
1522 align = 2
1526 align = 2
1523 style = astyle.style_nodata
1527 style = astyle.style_nodata
1524 if i == level.cury:
1528 if i == level.cury:
1525 style = self.getstylehere(style)
1529 style = self.getstylehere(style)
1526 padstyle = self.style_datapad
1530 padstyle = self.style_datapad
1527 sepstyle = self.style_sep
1531 sepstyle = self.style_sep
1528 if i == level.cury:
1532 if i == level.cury:
1529 padstyle = self.getstylehere(padstyle)
1533 padstyle = self.getstylehere(padstyle)
1530 sepstyle = self.getstylehere(sepstyle)
1534 sepstyle = self.getstylehere(sepstyle)
1531 if align == 2:
1535 if align == 2:
1532 posx += self.addchr(posy, posx, begx, self.scrsizex, self.nodatachar, cwidth, style)
1536 posx += self.addchr(posy, posx, begx, self.scrsizex, self.nodatachar, cwidth, style)
1533 else:
1537 else:
1534 if align == 1:
1538 if align == 1:
1535 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1539 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1536 elif align == 0:
1540 elif align == 0:
1537 pad1 = (cwidth-length)//2
1541 pad1 = (cwidth-length)//2
1538 pad2 = cwidth-length-len(pad1)
1542 pad2 = cwidth-length-len(pad1)
1539 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad1, padstyle)
1543 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad1, padstyle)
1540 for (style, text) in parts:
1544 for (style, text) in parts:
1541 if i == level.cury:
1545 if i == level.cury:
1542 style = self.getstylehere(style)
1546 style = self.getstylehere(style)
1543 posx += self.addstr(posy, posx, begx, self.scrsizex, text, style)
1547 posx += self.addstr(posy, posx, begx, self.scrsizex, text, style)
1544 if posx >= self.scrsizex:
1548 if posx >= self.scrsizex:
1545 break
1549 break
1546 if align == -1:
1550 if align == -1:
1547 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1551 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, cwidth-length, padstyle)
1548 elif align == 0:
1552 elif align == 0:
1549 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad2, padstyle)
1553 posx += self.addchr(posy, posx, begx, self.scrsizex, self.datapadchar, pad2, padstyle)
1550 posx += self.addstr(posy, posx, begx, self.scrsizex, self.datasepchar, sepstyle)
1554 posx += self.addstr(posy, posx, begx, self.scrsizex, self.datasepchar, sepstyle)
1551 else:
1555 else:
1552 scr.clrtoeol()
1556 scr.clrtoeol()
1553
1557
1554 # Add blank row headers for the rest of the screen
1558 # Add blank row headers for the rest of the screen
1555 for posy in xrange(posy+1, self.scrsizey-2):
1559 for posy in xrange(posy+1, self.scrsizey-2):
1556 scr.addstr(posy, 0, " " * (level.numbersizex+2), self.getstyle(self.style_colheader))
1560 scr.addstr(posy, 0, " " * (level.numbersizex+2), self.getstyle(self.style_colheader))
1557 scr.clrtoeol()
1561 scr.clrtoeol()
1558
1562
1559 posy = self.scrsizey-footery
1563 posy = self.scrsizey-footery
1560 # Display footer
1564 # Display footer
1561 scr.addstr(posy, 0, " "*self.scrsizex, self.getstyle(self.style_footer))
1565 scr.addstr(posy, 0, " "*self.scrsizex, self.getstyle(self.style_footer))
1562
1566
1563 if level.exhausted:
1567 if level.exhausted:
1564 flag = ""
1568 flag = ""
1565 else:
1569 else:
1566 flag = "+"
1570 flag = "+"
1567
1571
1568 endx = self.scrsizex-len(helpmsg)-1
1572 endx = self.scrsizex-len(helpmsg)-1
1569 scr.addstr(posy, endx, helpmsg, self.getstyle(self.style_footer))
1573 scr.addstr(posy, endx, helpmsg, self.getstyle(self.style_footer))
1570
1574
1571 posx = 0
1575 posx = 0
1572 msg = " %d%s objects (%d marked): " % (len(level.items), flag, level.marked)
1576 msg = " %d%s objects (%d marked): " % (len(level.items), flag, level.marked)
1573 posx += self.addstr(posy, posx, 0, endx, msg, self.style_footer)
1577 posx += self.addstr(posy, posx, 0, endx, msg, self.style_footer)
1574 try:
1578 try:
1575 item = level.items[level.cury].item
1579 item = level.items[level.cury].item
1576 except IndexError: # empty
1580 except IndexError: # empty
1577 pass
1581 pass
1578 else:
1582 else:
1579 for (nostyle, text) in ipipe.xrepr(item, "footer"):
1583 for (nostyle, text) in ipipe.xrepr(item, "footer"):
1580 if not isinstance(nostyle, int):
1584 if not isinstance(nostyle, int):
1581 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1585 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1582 if posx >= endx:
1586 if posx >= endx:
1583 break
1587 break
1584
1588
1585 attrstyle = [(astyle.style_default, "no attribute")]
1589 attrstyle = [(astyle.style_default, "no attribute")]
1586 attr = level.displayattr[1]
1590 attr = level.displayattr[1]
1587 if attr is not ipipe.noitem and not isinstance(attr, ipipe.SelfDescriptor):
1591 if attr is not ipipe.noitem and not isinstance(attr, ipipe.SelfDescriptor):
1588 posx += self.addstr(posy, posx, 0, endx, " | ", self.style_footer)
1592 posx += self.addstr(posy, posx, 0, endx, " | ", self.style_footer)
1589 posx += self.addstr(posy, posx, 0, endx, attr.name(), self.style_footer)
1593 posx += self.addstr(posy, posx, 0, endx, attr.name(), self.style_footer)
1590 posx += self.addstr(posy, posx, 0, endx, ": ", self.style_footer)
1594 posx += self.addstr(posy, posx, 0, endx, ": ", self.style_footer)
1591 try:
1595 try:
1592 value = attr.value(item)
1596 value = attr.value(item)
1593 except (SystemExit, KeyboardInterrupt):
1597 except (SystemExit, KeyboardInterrupt):
1594 raise
1598 raise
1595 except Exception, exc:
1599 except Exception, exc:
1596 value = exc
1600 value = exc
1597 if value is not ipipe.noitem:
1601 if value is not ipipe.noitem:
1598 attrstyle = ipipe.xrepr(value, "footer")
1602 attrstyle = ipipe.xrepr(value, "footer")
1599 for (nostyle, text) in attrstyle:
1603 for (nostyle, text) in attrstyle:
1600 if not isinstance(nostyle, int):
1604 if not isinstance(nostyle, int):
1601 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1605 posx += self.addstr(posy, posx, 0, endx, text, self.style_footer)
1602 if posx >= endx:
1606 if posx >= endx:
1603 break
1607 break
1604
1608
1605 try:
1609 try:
1606 # Display input prompt
1610 # Display input prompt
1607 if self.mode in self.prompts:
1611 if self.mode in self.prompts:
1608 history = self.prompts[self.mode]
1612 history = self.prompts[self.mode]
1609 posx = 0
1613 posx = 0
1610 posy = self.scrsizey-1
1614 posy = self.scrsizey-1
1611 posx += self.addstr(posy, posx, 0, endx, history.prompt, astyle.style_default)
1615 posx += self.addstr(posy, posx, 0, endx, history.prompt, astyle.style_default)
1612 posx += self.addstr(posy, posx, 0, endx, " [", astyle.style_default)
1616 posx += self.addstr(posy, posx, 0, endx, " [", astyle.style_default)
1613 if history.cury==-1:
1617 if history.cury==-1:
1614 text = "new"
1618 text = "new"
1615 else:
1619 else:
1616 text = str(history.cury+1)
1620 text = str(history.cury+1)
1617 posx += self.addstr(posy, posx, 0, endx, text, astyle.style_type_number)
1621 posx += self.addstr(posy, posx, 0, endx, text, astyle.style_type_number)
1618 if history.history:
1622 if history.history:
1619 posx += self.addstr(posy, posx, 0, endx, "/", astyle.style_default)
1623 posx += self.addstr(posy, posx, 0, endx, "/", astyle.style_default)
1620 posx += self.addstr(posy, posx, 0, endx, str(len(history.history)), astyle.style_type_number)
1624 posx += self.addstr(posy, posx, 0, endx, str(len(history.history)), astyle.style_type_number)
1621 posx += self.addstr(posy, posx, 0, endx, "]: ", astyle.style_default)
1625 posx += self.addstr(posy, posx, 0, endx, "]: ", astyle.style_default)
1622 inputstartx = posx
1626 inputstartx = posx
1623 posx += self.addstr(posy, posx, 0, endx, history.input, astyle.style_default)
1627 posx += self.addstr(posy, posx, 0, endx, history.input, astyle.style_default)
1624 # Display report
1628 # Display report
1625 else:
1629 else:
1626 if self._report is not None:
1630 if self._report is not None:
1627 if isinstance(self._report, Exception):
1631 if isinstance(self._report, Exception):
1628 style = self.getstyle(astyle.style_error)
1632 style = self.getstyle(astyle.style_error)
1629 if self._report.__class__.__module__ == "exceptions":
1633 if self._report.__class__.__module__ == "exceptions":
1630 msg = "%s: %s" % \
1634 msg = "%s: %s" % \
1631 (self._report.__class__.__name__, self._report)
1635 (self._report.__class__.__name__, self._report)
1632 else:
1636 else:
1633 msg = "%s.%s: %s" % \
1637 msg = "%s.%s: %s" % \
1634 (self._report.__class__.__module__,
1638 (self._report.__class__.__module__,
1635 self._report.__class__.__name__, self._report)
1639 self._report.__class__.__name__, self._report)
1636 else:
1640 else:
1637 style = self.getstyle(self.style_report)
1641 style = self.getstyle(self.style_report)
1638 msg = self._report
1642 msg = self._report
1639 scr.addstr(self.scrsizey-1, 0, msg[:self.scrsizex], style)
1643 scr.addstr(self.scrsizey-1, 0, msg[:self.scrsizex], style)
1640 self._report = None
1644 self._report = None
1641 else:
1645 else:
1642 scr.move(self.scrsizey-1, 0)
1646 scr.move(self.scrsizey-1, 0)
1643 except curses.error:
1647 except curses.error:
1644 # Protect against errors from writing to the last line
1648 # Protect against errors from writing to the last line
1645 pass
1649 pass
1646 scr.clrtoeol()
1650 scr.clrtoeol()
1647
1651
1648 # Position cursor
1652 # Position cursor
1649 if self.mode in self.prompts:
1653 if self.mode in self.prompts:
1650 history = self.prompts[self.mode]
1654 history = self.prompts[self.mode]
1651 scr.move(self.scrsizey-1, inputstartx+history.curx)
1655 scr.move(self.scrsizey-1, inputstartx+history.curx)
1652 else:
1656 else:
1653 scr.move(
1657 scr.move(
1654 1+self._headerlines+level.cury-level.datastarty,
1658 1+self._headerlines+level.cury-level.datastarty,
1655 level.numbersizex+3+level.curx-level.datastartx
1659 level.numbersizex+3+level.curx-level.datastartx
1656 )
1660 )
1657 scr.refresh()
1661 scr.refresh()
1658
1662
1659 # Check keyboard
1663 # Check keyboard
1660 while True:
1664 while True:
1661 c = scr.getch()
1665 c = scr.getch()
1662 if self.resized:
1666 if self.resized:
1663 size = fcntl.ioctl(0, tty.TIOCGWINSZ, "12345678")
1667 size = fcntl.ioctl(0, tty.TIOCGWINSZ, "12345678")
1664 size = struct.unpack("4H", size)
1668 size = struct.unpack("4H", size)
1665 oldsize = scr.getmaxyx()
1669 oldsize = scr.getmaxyx()
1666 scr.erase()
1670 scr.erase()
1667 curses.resize_term(size[0], size[1])
1671 curses.resize_term(size[0], size[1])
1668 newsize = scr.getmaxyx()
1672 newsize = scr.getmaxyx()
1669 scr.erase()
1673 scr.erase()
1670 for l in self.levels:
1674 for l in self.levels:
1671 l.mainsizey += newsize[0]-oldsize[0]
1675 l.mainsizey += newsize[0]-oldsize[0]
1672 l.moveto(l.curx, l.cury, refresh=True)
1676 l.moveto(l.curx, l.cury, refresh=True)
1673 scr.refresh()
1677 scr.refresh()
1674 self.resized = False
1678 self.resized = False
1675 break # Redisplay
1679 break # Redisplay
1676 if self.mode in self.prompts:
1680 if self.mode in self.prompts:
1677 if self.prompts[self.mode].handlekey(self, c):
1681 if self.prompts[self.mode].handlekey(self, c):
1678 break # Redisplay
1682 break # Redisplay
1679 else:
1683 else:
1680 # if no key is pressed slow down and beep again
1684 # if no key is pressed slow down and beep again
1681 if c == -1:
1685 if c == -1:
1682 self.stepx = 1.
1686 self.stepx = 1.
1683 self.stepy = 1.
1687 self.stepy = 1.
1684 self._dobeep = True
1688 self._dobeep = True
1685 else:
1689 else:
1686 # if a different key was pressed slow down and beep too
1690 # if a different key was pressed slow down and beep too
1687 if c != lastc:
1691 if c != lastc:
1688 lastc = c
1692 lastc = c
1689 self.stepx = 1.
1693 self.stepx = 1.
1690 self.stepy = 1.
1694 self.stepy = 1.
1691 self._dobeep = True
1695 self._dobeep = True
1692 cmdname = self.keymap.get(c, None)
1696 cmdname = self.keymap.get(c, None)
1693 if cmdname is None:
1697 if cmdname is None:
1694 self.report(
1698 self.report(
1695 UnassignedKeyError("Unassigned key %s" %
1699 UnassignedKeyError("Unassigned key %s" %
1696 self.keylabel(c)))
1700 self.keylabel(c)))
1697 else:
1701 else:
1698 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
1702 cmdfunc = getattr(self, "cmd_%s" % cmdname, None)
1699 if cmdfunc is None:
1703 if cmdfunc is None:
1700 self.report(
1704 self.report(
1701 UnknownCommandError("Unknown command %r" %
1705 UnknownCommandError("Unknown command %r" %
1702 (cmdname,)))
1706 (cmdname,)))
1703 elif cmdfunc():
1707 elif cmdfunc():
1704 returnvalue = self.returnvalue
1708 returnvalue = self.returnvalue
1705 self.returnvalue = None
1709 self.returnvalue = None
1706 return returnvalue
1710 return returnvalue
1707 self.stepx = self.nextstepx(self.stepx)
1711 self.stepx = self.nextstepx(self.stepx)
1708 self.stepy = self.nextstepy(self.stepy)
1712 self.stepy = self.nextstepy(self.stepy)
1709 curses.flushinp() # get rid of type ahead
1713 curses.flushinp() # get rid of type ahead
1710 break # Redisplay
1714 break # Redisplay
1711 self.scr = None
1715 self.scr = None
1712
1716
1713 def display(self):
1717 def display(self):
1714 if hasattr(curses, "resize_term"):
1718 if hasattr(curses, "resize_term"):
1715 oldhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler)
1719 oldhandler = signal.signal(signal.SIGWINCH, self.sigwinchhandler)
1716 try:
1720 try:
1717 return curses.wrapper(self._dodisplay)
1721 return curses.wrapper(self._dodisplay)
1718 finally:
1722 finally:
1719 signal.signal(signal.SIGWINCH, oldhandler)
1723 signal.signal(signal.SIGWINCH, oldhandler)
1720 else:
1724 else:
1721 return curses.wrapper(self._dodisplay)
1725 return curses.wrapper(self._dodisplay)
@@ -1,2133 +1,2139 b''
1 # -*- coding: iso-8859-1 -*-
1 # -*- coding: iso-8859-1 -*-
2
2
3 """
3 """
4 ``ipipe`` provides classes to be used in an interactive Python session. Doing a
4 ``ipipe`` provides classes to be used in an interactive Python session. Doing a
5 ``from ipipe import *`` is the preferred way to do this. The name of all
5 ``from ipipe import *`` is the preferred way to do this. The name of all
6 objects imported this way starts with ``i`` to minimize collisions.
6 objects imported this way starts with ``i`` to minimize collisions.
7
7
8 ``ipipe`` supports "pipeline expressions", which is something resembling Unix
8 ``ipipe`` supports "pipeline expressions", which is something resembling Unix
9 pipes. An example is:
9 pipes. An example is:
10
10
11 >>> ienv | isort("key.lower()")
11 >>> ienv | isort("key.lower()")
12
12
13 This gives a listing of all environment variables sorted by name.
13 This gives a listing of all environment variables sorted by name.
14
14
15
15
16 There are three types of objects in a pipeline expression:
16 There are three types of objects in a pipeline expression:
17
17
18 * ``Table``s: These objects produce items. Examples are ``ils`` (listing the
18 * ``Table``s: These objects produce items. Examples are ``ils`` (listing the
19 current directory, ``ienv`` (listing environment variables), ``ipwd`` (listing
19 current directory, ``ienv`` (listing environment variables), ``ipwd`` (listing
20 user accounts) and ``igrp`` (listing user groups). A ``Table`` must be the
20 user accounts) and ``igrp`` (listing user groups). A ``Table`` must be the
21 first object in a pipe expression.
21 first object in a pipe expression.
22
22
23 * ``Pipe``s: These objects sit in the middle of a pipe expression. They
23 * ``Pipe``s: These objects sit in the middle of a pipe expression. They
24 transform the input in some way (e.g. filtering or sorting it). Examples are:
24 transform the input in some way (e.g. filtering or sorting it). Examples are:
25 ``ifilter`` (which filters the input pipe), ``isort`` (which sorts the input
25 ``ifilter`` (which filters the input pipe), ``isort`` (which sorts the input
26 pipe) and ``ieval`` (which evaluates a function or expression for each object
26 pipe) and ``ieval`` (which evaluates a function or expression for each object
27 in the input pipe).
27 in the input pipe).
28
28
29 * ``Display``s: These objects can be put as the last object in a pipeline
29 * ``Display``s: These objects can be put as the last object in a pipeline
30 expression. There are responsible for displaying the result of the pipeline
30 expression. There are responsible for displaying the result of the pipeline
31 expression. If a pipeline expression doesn't end in a display object a default
31 expression. If a pipeline expression doesn't end in a display object a default
32 display objects will be used. One example is ``ibrowse`` which is a ``curses``
32 display objects will be used. One example is ``ibrowse`` which is a ``curses``
33 based browser.
33 based browser.
34
34
35
35
36 Adding support for pipeline expressions to your own objects can be done through
36 Adding support for pipeline expressions to your own objects can be done through
37 three extensions points (all of them optional):
37 three extensions points (all of them optional):
38
38
39 * An object that will be displayed as a row by a ``Display`` object should
39 * An object that will be displayed as a row by a ``Display`` object should
40 implement the method ``__xattrs__(self, mode)`` method or register an
40 implement the method ``__xattrs__(self, mode)`` method or register an
41 implementation of the generic function ``xattrs``. For more info see ``xattrs``.
41 implementation of the generic function ``xattrs``. For more info see ``xattrs``.
42
42
43 * When an object ``foo`` is displayed by a ``Display`` object, the generic
43 * When an object ``foo`` is displayed by a ``Display`` object, the generic
44 function ``xrepr`` is used.
44 function ``xrepr`` is used.
45
45
46 * Objects that can be iterated by ``Pipe``s must iterable. For special cases,
46 * Objects that can be iterated by ``Pipe``s must iterable. For special cases,
47 where iteration for display is different than the normal iteration a special
47 where iteration for display is different than the normal iteration a special
48 implementation can be registered with the generic function ``xiter``. This makes
48 implementation can be registered with the generic function ``xiter``. This makes
49 it possible to use dictionaries and modules in pipeline expressions, for example:
49 it possible to use dictionaries and modules in pipeline expressions, for example:
50
50
51 >>> import sys
51 >>> import sys
52 >>> sys | ifilter("isinstance(value, int)") | idump
52 >>> sys | ifilter("isinstance(value, int)") | idump
53 key |value
53 key |value
54 api_version| 1012
54 api_version| 1012
55 dllhandle | 503316480
55 dllhandle | 503316480
56 hexversion | 33817328
56 hexversion | 33817328
57 maxint |2147483647
57 maxint |2147483647
58 maxunicode | 65535
58 maxunicode | 65535
59 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
59 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
60 ...
60 ...
61
61
62 Note: The expression strings passed to ``ifilter()`` and ``isort()`` can
62 Note: The expression strings passed to ``ifilter()`` and ``isort()`` can
63 refer to the object to be filtered or sorted via the variable ``_`` and to any
63 refer to the object to be filtered or sorted via the variable ``_`` and to any
64 of the attributes of the object, i.e.:
64 of the attributes of the object, i.e.:
65
65
66 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
66 >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()")
67
67
68 does the same as
68 does the same as
69
69
70 >>> sys.modules | ifilter("value is not None") | isort("key.lower()")
70 >>> sys.modules | ifilter("value is not None") | isort("key.lower()")
71
71
72 In addition to expression strings, it's possible to pass callables (taking
72 In addition to expression strings, it's possible to pass callables (taking
73 the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``:
73 the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``:
74
74
75 >>> sys | ifilter(lambda _:isinstance(_.value, int)) \
75 >>> sys | ifilter(lambda _:isinstance(_.value, int)) \
76 ... | ieval(lambda _: (_.key, hex(_.value))) | idump
76 ... | ieval(lambda _: (_.key, hex(_.value))) | idump
77 0 |1
77 0 |1
78 api_version|0x3f4
78 api_version|0x3f4
79 dllhandle |0x1e000000
79 dllhandle |0x1e000000
80 hexversion |0x20402f0
80 hexversion |0x20402f0
81 maxint |0x7fffffff
81 maxint |0x7fffffff
82 maxunicode |0xffff
82 maxunicode |0xffff
83 """
83 """
84
84
85 import sys, os, os.path, stat, glob, new, csv, datetime, types
85 import sys, os, os.path, stat, glob, new, csv, datetime, types
86 import itertools, mimetypes
86 import itertools, mimetypes
87
87
88 try: # Python 2.3 compatibility
88 try: # Python 2.3 compatibility
89 import collections
89 import collections
90 except ImportError:
90 except ImportError:
91 deque = list
91 deque = list
92 else:
92 else:
93 deque = collections.deque
93 deque = collections.deque
94
94
95 try: # Python 2.3 compatibility
95 try: # Python 2.3 compatibility
96 set
96 set
97 except NameError:
97 except NameError:
98 import sets
98 import sets
99 set = sets.Set
99 set = sets.Set
100
100
101 try: # Python 2.3 compatibility
101 try: # Python 2.3 compatibility
102 sorted
102 sorted
103 except NameError:
103 except NameError:
104 def sorted(iterator, key=None, reverse=False):
104 def sorted(iterator, key=None, reverse=False):
105 items = list(iterator)
105 items = list(iterator)
106 if key is not None:
106 if key is not None:
107 items.sort(lambda i1, i2: cmp(key(i1), key(i2)))
107 items.sort(lambda i1, i2: cmp(key(i1), key(i2)))
108 else:
108 else:
109 items.sort()
109 items.sort()
110 if reverse:
110 if reverse:
111 items.reverse()
111 items.reverse()
112 return items
112 return items
113
113
114 try:
114 try:
115 import pwd
115 import pwd
116 except ImportError:
116 except ImportError:
117 pwd = None
117 pwd = None
118
118
119 try:
119 try:
120 import grp
120 import grp
121 except ImportError:
121 except ImportError:
122 grp = None
122 grp = None
123
123
124 from IPython.external import simplegeneric
124 from IPython.external import simplegeneric
125
125
126 import path
126 import path
127 try:
127 try:
128 from IPython import genutils, ipapi
128 from IPython import genutils, ipapi
129 except ImportError:
129 except ImportError:
130 genutils = None
130 genutils = None
131 ipapi = None
131 ipapi = None
132
132
133 import astyle
133 import astyle
134
134
135
135
136 __all__ = [
136 __all__ = [
137 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
137 "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp",
138 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum", "ienv",
138 "icsv", "ix", "ichain", "isort", "ifilter", "ieval", "ienum", "ienv",
139 "idump", "iless"
139 "idump", "iless"
140 ]
140 ]
141
141
142
142
143 os.stat_float_times(True) # enable microseconds
143 os.stat_float_times(True) # enable microseconds
144
144
145
145
146 class AttrNamespace(object):
146 class AttrNamespace(object):
147 """
147 """
148 Helper class that is used for providing a namespace for evaluating
148 Helper class that is used for providing a namespace for evaluating
149 expressions containing attribute names of an object.
149 expressions containing attribute names of an object.
150 """
150 """
151 def __init__(self, wrapped):
151 def __init__(self, wrapped):
152 self.wrapped = wrapped
152 self.wrapped = wrapped
153
153
154 def __getitem__(self, name):
154 def __getitem__(self, name):
155 if name == "_":
155 if name == "_":
156 return self.wrapped
156 return self.wrapped
157 try:
157 try:
158 return getattr(self.wrapped, name)
158 return getattr(self.wrapped, name)
159 except AttributeError:
159 except AttributeError:
160 raise KeyError(name)
160 raise KeyError(name)
161
161
162 # Python 2.3 compatibility
162 # Python 2.3 compatibility
163 # use eval workaround to find out which names are used in the
163 # use eval workaround to find out which names are used in the
164 # eval string and put them into the locals. This works for most
164 # eval string and put them into the locals. This works for most
165 # normal uses case, bizarre ones like accessing the locals()
165 # normal uses case, bizarre ones like accessing the locals()
166 # will fail
166 # will fail
167 try:
167 try:
168 eval("_", None, AttrNamespace(None))
168 eval("_", None, AttrNamespace(None))
169 except TypeError:
169 except TypeError:
170 real_eval = eval
170 real_eval = eval
171 def eval(codestring, _globals, _locals):
171 def eval(codestring, _globals, _locals):
172 """
172 """
173 eval(source[, globals[, locals]]) -> value
173 eval(source[, globals[, locals]]) -> value
174
174
175 Evaluate the source in the context of globals and locals.
175 Evaluate the source in the context of globals and locals.
176 The source may be a string representing a Python expression
176 The source may be a string representing a Python expression
177 or a code object as returned by compile().
177 or a code object as returned by compile().
178 The globals must be a dictionary and locals can be any mappping.
178 The globals must be a dictionary and locals can be any mappping.
179
179
180 This function is a workaround for the shortcomings of
180 This function is a workaround for the shortcomings of
181 Python 2.3's eval.
181 Python 2.3's eval.
182 """
182 """
183
183
184 if isinstance(codestring, basestring):
184 if isinstance(codestring, basestring):
185 code = compile(codestring, "_eval", "eval")
185 code = compile(codestring, "_eval", "eval")
186 else:
186 else:
187 code = codestring
187 code = codestring
188 newlocals = {}
188 newlocals = {}
189 for name in code.co_names:
189 for name in code.co_names:
190 try:
190 try:
191 newlocals[name] = _locals[name]
191 newlocals[name] = _locals[name]
192 except KeyError:
192 except KeyError:
193 pass
193 pass
194 return real_eval(code, _globals, newlocals)
194 return real_eval(code, _globals, newlocals)
195
195
196
196
197 noitem = object()
197 noitem = object()
198
198
199 def item(iterator, index, default=noitem):
199 def item(iterator, index, default=noitem):
200 """
200 """
201 Return the ``index``th item from the iterator ``iterator``.
201 Return the ``index``th item from the iterator ``iterator``.
202 ``index`` must be an integer (negative integers are relative to the
202 ``index`` must be an integer (negative integers are relative to the
203 end (i.e. the last items produced by the iterator)).
203 end (i.e. the last items produced by the iterator)).
204
204
205 If ``default`` is given, this will be the default value when
205 If ``default`` is given, this will be the default value when
206 the iterator doesn't contain an item at this position. Otherwise an
206 the iterator doesn't contain an item at this position. Otherwise an
207 ``IndexError`` will be raised.
207 ``IndexError`` will be raised.
208
208
209 Note that using this function will partially or totally exhaust the
209 Note that using this function will partially or totally exhaust the
210 iterator.
210 iterator.
211 """
211 """
212 i = index
212 i = index
213 if i>=0:
213 if i>=0:
214 for item in iterator:
214 for item in iterator:
215 if not i:
215 if not i:
216 return item
216 return item
217 i -= 1
217 i -= 1
218 else:
218 else:
219 i = -index
219 i = -index
220 cache = deque()
220 cache = deque()
221 for item in iterator:
221 for item in iterator:
222 cache.append(item)
222 cache.append(item)
223 if len(cache)>i:
223 if len(cache)>i:
224 cache.popleft()
224 cache.popleft()
225 if len(cache)==i:
225 if len(cache)==i:
226 return cache.popleft()
226 return cache.popleft()
227 if default is noitem:
227 if default is noitem:
228 raise IndexError(index)
228 raise IndexError(index)
229 else:
229 else:
230 return default
230 return default
231
231
232
232
233 def getglobals(g):
233 def getglobals(g):
234 """
234 """
235 Return the global namespace that is used for expression strings in
235 Return the global namespace that is used for expression strings in
236 ``ifilter`` and others. This is ``g`` or (if ``g`` is ``None``) IPython's
236 ``ifilter`` and others. This is ``g`` or (if ``g`` is ``None``) IPython's
237 user namespace.
237 user namespace.
238 """
238 """
239 if g is None:
239 if g is None:
240 if ipapi is not None:
240 if ipapi is not None:
241 api = ipapi.get()
241 api = ipapi.get()
242 if api is not None:
242 if api is not None:
243 return api.user_ns
243 return api.user_ns
244 return globals()
244 return globals()
245 return g
245 return g
246
246
247
247
248 class Descriptor(object):
248 class Descriptor(object):
249 """
249 """
250 A ``Descriptor`` object is used for describing the attributes of objects.
250 A ``Descriptor`` object is used for describing the attributes of objects.
251 """
251 """
252 def __hash__(self):
252 def __hash__(self):
253 return hash(self.__class__) ^ hash(self.key())
253 return hash(self.__class__) ^ hash(self.key())
254
254
255 def __eq__(self, other):
255 def __eq__(self, other):
256 return self.__class__ is other.__class__ and self.key() == other.key()
256 return self.__class__ is other.__class__ and self.key() == other.key()
257
257
258 def __ne__(self, other):
258 def __ne__(self, other):
259 return self.__class__ is not other.__class__ or self.key() != other.key()
259 return self.__class__ is not other.__class__ or self.key() != other.key()
260
260
261 def key(self):
261 def key(self):
262 pass
262 pass
263
263
264 def name(self):
264 def name(self):
265 """
265 """
266 Return the name of this attribute for display by a ``Display`` object
266 Return the name of this attribute for display by a ``Display`` object
267 (e.g. as a column title).
267 (e.g. as a column title).
268 """
268 """
269 key = self.key()
269 key = self.key()
270 if key is None:
270 if key is None:
271 return "_"
271 return "_"
272 return str(key)
272 return str(key)
273
273
274 def attrtype(self, obj):
274 def attrtype(self, obj):
275 """
275 """
276 Return the type of this attribute (i.e. something like "attribute" or
276 Return the type of this attribute (i.e. something like "attribute" or
277 "method").
277 "method").
278 """
278 """
279
279
280 def valuetype(self, obj):
280 def valuetype(self, obj):
281 """
281 """
282 Return the type of this attribute value of the object ``obj``.
282 Return the type of this attribute value of the object ``obj``.
283 """
283 """
284
284
285 def value(self, obj):
285 def value(self, obj):
286 """
286 """
287 Return the value of this attribute of the object ``obj``.
287 Return the value of this attribute of the object ``obj``.
288 """
288 """
289
289
290 def doc(self, obj):
290 def doc(self, obj):
291 """
291 """
292 Return the documentation for this attribute.
292 Return the documentation for this attribute.
293 """
293 """
294
294
295 def shortdoc(self, obj):
295 def shortdoc(self, obj):
296 """
296 """
297 Return a short documentation for this attribute (defaulting to the
297 Return a short documentation for this attribute (defaulting to the
298 first line).
298 first line).
299 """
299 """
300 doc = self.doc(obj)
300 doc = self.doc(obj)
301 if doc is not None:
301 if doc is not None:
302 doc = doc.strip().splitlines()[0].strip()
302 doc = doc.strip().splitlines()[0].strip()
303 return doc
303 return doc
304
304
305 def iter(self, obj):
305 def iter(self, obj):
306 """
306 """
307 Return an iterator for this attribute of the object ``obj``.
307 Return an iterator for this attribute of the object ``obj``.
308 """
308 """
309 return xiter(self.value(obj))
309 return xiter(self.value(obj))
310
310
311
311
312 class SelfDescriptor(Descriptor):
312 class SelfDescriptor(Descriptor):
313 """
313 """
314 A ``SelfDescriptor`` describes the object itself.
314 A ``SelfDescriptor`` describes the object itself.
315 """
315 """
316 def key(self):
316 def key(self):
317 return None
317 return None
318
318
319 def attrtype(self, obj):
319 def attrtype(self, obj):
320 return "self"
320 return "self"
321
321
322 def valuetype(self, obj):
322 def valuetype(self, obj):
323 return type(obj)
323 return type(obj)
324
324
325 def value(self, obj):
325 def value(self, obj):
326 return obj
326 return obj
327
327
328 def __repr__(self):
328 def __repr__(self):
329 return "Self"
329 return "Self"
330
330
331 selfdescriptor = SelfDescriptor() # there's no need for more than one
331 selfdescriptor = SelfDescriptor() # there's no need for more than one
332
332
333
333
334 class AttributeDescriptor(Descriptor):
334 class AttributeDescriptor(Descriptor):
335 """
335 """
336 An ``AttributeDescriptor`` describes a simple attribute of an object.
336 An ``AttributeDescriptor`` describes a simple attribute of an object.
337 """
337 """
338 __slots__ = ("_name", "_doc")
338 __slots__ = ("_name", "_doc")
339
339
340 def __init__(self, name, doc=None):
340 def __init__(self, name, doc=None):
341 self._name = name
341 self._name = name
342 self._doc = doc
342 self._doc = doc
343
343
344 def key(self):
344 def key(self):
345 return self._name
345 return self._name
346
346
347 def doc(self, obj):
347 def doc(self, obj):
348 return self._doc
348 return self._doc
349
349
350 def attrtype(self, obj):
350 def attrtype(self, obj):
351 return "attr"
351 return "attr"
352
352
353 def valuetype(self, obj):
353 def valuetype(self, obj):
354 return type(getattr(obj, self._name))
354 return type(getattr(obj, self._name))
355
355
356 def value(self, obj):
356 def value(self, obj):
357 return getattr(obj, self._name)
357 return getattr(obj, self._name)
358
358
359 def __repr__(self):
359 def __repr__(self):
360 if self._doc is None:
360 if self._doc is None:
361 return "Attribute(%r)" % self._name
361 return "Attribute(%r)" % self._name
362 else:
362 else:
363 return "Attribute(%r, %r)" % (self._name, self._doc)
363 return "Attribute(%r, %r)" % (self._name, self._doc)
364
364
365
365
366 class IndexDescriptor(Descriptor):
366 class IndexDescriptor(Descriptor):
367 """
367 """
368 An ``IndexDescriptor`` describes an "attribute" of an object that is fetched
368 An ``IndexDescriptor`` describes an "attribute" of an object that is fetched
369 via ``__getitem__``.
369 via ``__getitem__``.
370 """
370 """
371 __slots__ = ("_index",)
371 __slots__ = ("_index",)
372
372
373 def __init__(self, index):
373 def __init__(self, index):
374 self._index = index
374 self._index = index
375
375
376 def key(self):
376 def key(self):
377 return self._index
377 return self._index
378
378
379 def attrtype(self, obj):
379 def attrtype(self, obj):
380 return "item"
380 return "item"
381
381
382 def valuetype(self, obj):
382 def valuetype(self, obj):
383 return type(obj[self._index])
383 return type(obj[self._index])
384
384
385 def value(self, obj):
385 def value(self, obj):
386 return obj[self._index]
386 return obj[self._index]
387
387
388 def __repr__(self):
388 def __repr__(self):
389 return "Index(%r)" % self._index
389 return "Index(%r)" % self._index
390
390
391
391
392 class MethodDescriptor(Descriptor):
392 class MethodDescriptor(Descriptor):
393 """
393 """
394 A ``MethodDescriptor`` describes a method of an object that can be called
394 A ``MethodDescriptor`` describes a method of an object that can be called
395 without argument. Note that this method shouldn't change the object.
395 without argument. Note that this method shouldn't change the object.
396 """
396 """
397 __slots__ = ("_name", "_doc")
397 __slots__ = ("_name", "_doc")
398
398
399 def __init__(self, name, doc=None):
399 def __init__(self, name, doc=None):
400 self._name = name
400 self._name = name
401 self._doc = doc
401 self._doc = doc
402
402
403 def key(self):
403 def key(self):
404 return self._name
404 return self._name
405
405
406 def doc(self, obj):
406 def doc(self, obj):
407 if self._doc is None:
407 if self._doc is None:
408 return getattr(obj, self._name).__doc__
408 return getattr(obj, self._name).__doc__
409 return self._doc
409 return self._doc
410
410
411 def attrtype(self, obj):
411 def attrtype(self, obj):
412 return "method"
412 return "method"
413
413
414 def valuetype(self, obj):
414 def valuetype(self, obj):
415 return type(self.value(obj))
415 return type(self.value(obj))
416
416
417 def value(self, obj):
417 def value(self, obj):
418 return getattr(obj, self._name)()
418 return getattr(obj, self._name)()
419
419
420 def __repr__(self):
420 def __repr__(self):
421 if self._doc is None:
421 if self._doc is None:
422 return "Method(%r)" % self._name
422 return "Method(%r)" % self._name
423 else:
423 else:
424 return "Method(%r, %r)" % (self._name, self._doc)
424 return "Method(%r, %r)" % (self._name, self._doc)
425
425
426
426
427 class IterAttributeDescriptor(Descriptor):
427 class IterAttributeDescriptor(Descriptor):
428 """
428 """
429 An ``IterAttributeDescriptor`` works like an ``AttributeDescriptor`` but
429 An ``IterAttributeDescriptor`` works like an ``AttributeDescriptor`` but
430 doesn't return an attribute values (because this value might be e.g. a large
430 doesn't return an attribute values (because this value might be e.g. a large
431 list).
431 list).
432 """
432 """
433 __slots__ = ("_name", "_doc")
433 __slots__ = ("_name", "_doc")
434
434
435 def __init__(self, name, doc=None):
435 def __init__(self, name, doc=None):
436 self._name = name
436 self._name = name
437 self._doc = doc
437 self._doc = doc
438
438
439 def key(self):
439 def key(self):
440 return self._name
440 return self._name
441
441
442 def doc(self, obj):
442 def doc(self, obj):
443 return self._doc
443 return self._doc
444
444
445 def attrtype(self, obj):
445 def attrtype(self, obj):
446 return "iter"
446 return "iter"
447
447
448 def valuetype(self, obj):
448 def valuetype(self, obj):
449 return noitem
449 return noitem
450
450
451 def value(self, obj):
451 def value(self, obj):
452 return noitem
452 return noitem
453
453
454 def iter(self, obj):
454 def iter(self, obj):
455 return xiter(getattr(obj, self._name))
455 return xiter(getattr(obj, self._name))
456
456
457 def __repr__(self):
457 def __repr__(self):
458 if self._doc is None:
458 if self._doc is None:
459 return "IterAttribute(%r)" % self._name
459 return "IterAttribute(%r)" % self._name
460 else:
460 else:
461 return "IterAttribute(%r, %r)" % (self._name, self._doc)
461 return "IterAttribute(%r, %r)" % (self._name, self._doc)
462
462
463
463
464 class IterMethodDescriptor(Descriptor):
464 class IterMethodDescriptor(Descriptor):
465 """
465 """
466 An ``IterMethodDescriptor`` works like an ``MethodDescriptor`` but doesn't
466 An ``IterMethodDescriptor`` works like an ``MethodDescriptor`` but doesn't
467 return an attribute values (because this value might be e.g. a large list).
467 return an attribute values (because this value might be e.g. a large list).
468 """
468 """
469 __slots__ = ("_name", "_doc")
469 __slots__ = ("_name", "_doc")
470
470
471 def __init__(self, name, doc=None):
471 def __init__(self, name, doc=None):
472 self._name = name
472 self._name = name
473 self._doc = doc
473 self._doc = doc
474
474
475 def key(self):
475 def key(self):
476 return self._name
476 return self._name
477
477
478 def doc(self, obj):
478 def doc(self, obj):
479 if self._doc is None:
479 if self._doc is None:
480 return getattr(obj, self._name).__doc__
480 return getattr(obj, self._name).__doc__
481 return self._doc
481 return self._doc
482
482
483 def attrtype(self, obj):
483 def attrtype(self, obj):
484 return "itermethod"
484 return "itermethod"
485
485
486 def valuetype(self, obj):
486 def valuetype(self, obj):
487 return noitem
487 return noitem
488
488
489 def value(self, obj):
489 def value(self, obj):
490 return noitem
490 return noitem
491
491
492 def iter(self, obj):
492 def iter(self, obj):
493 return xiter(getattr(obj, self._name)())
493 return xiter(getattr(obj, self._name)())
494
494
495 def __repr__(self):
495 def __repr__(self):
496 if self._doc is None:
496 if self._doc is None:
497 return "IterMethod(%r)" % self._name
497 return "IterMethod(%r)" % self._name
498 else:
498 else:
499 return "IterMethod(%r, %r)" % (self._name, self._doc)
499 return "IterMethod(%r, %r)" % (self._name, self._doc)
500
500
501
501
502 class FunctionDescriptor(Descriptor):
502 class FunctionDescriptor(Descriptor):
503 """
503 """
504 A ``FunctionDescriptor`` turns a function into a descriptor. The function
504 A ``FunctionDescriptor`` turns a function into a descriptor. The function
505 will be called with the object to get the type and value of the attribute.
505 will be called with the object to get the type and value of the attribute.
506 """
506 """
507 __slots__ = ("_function", "_name", "_doc")
507 __slots__ = ("_function", "_name", "_doc")
508
508
509 def __init__(self, function, name=None, doc=None):
509 def __init__(self, function, name=None, doc=None):
510 self._function = function
510 self._function = function
511 self._name = name
511 self._name = name
512 self._doc = doc
512 self._doc = doc
513
513
514 def key(self):
514 def key(self):
515 return self._function
515 return self._function
516
516
517 def name(self):
517 def name(self):
518 if self._name is not None:
518 if self._name is not None:
519 return self._name
519 return self._name
520 return getattr(self._function, "__xname__", self._function.__name__)
520 return getattr(self._function, "__xname__", self._function.__name__)
521
521
522 def doc(self, obj):
522 def doc(self, obj):
523 if self._doc is None:
523 if self._doc is None:
524 return self._function.__doc__
524 return self._function.__doc__
525 return self._doc
525 return self._doc
526
526
527 def attrtype(self, obj):
527 def attrtype(self, obj):
528 return "function"
528 return "function"
529
529
530 def valuetype(self, obj):
530 def valuetype(self, obj):
531 return type(self._function(obj))
531 return type(self._function(obj))
532
532
533 def value(self, obj):
533 def value(self, obj):
534 return self._function(obj)
534 return self._function(obj)
535
535
536 def __repr__(self):
536 def __repr__(self):
537 if self._doc is None:
537 if self._doc is None:
538 return "Function(%r)" % self._name
538 return "Function(%r)" % self._name
539 else:
539 else:
540 return "Function(%r, %r)" % (self._name, self._doc)
540 return "Function(%r, %r)" % (self._name, self._doc)
541
541
542
542
543 class Table(object):
543 class Table(object):
544 """
544 """
545 A ``Table`` is an object that produces items (just like a normal Python
545 A ``Table`` is an object that produces items (just like a normal Python
546 iterator/generator does) and can be used as the first object in a pipeline
546 iterator/generator does) and can be used as the first object in a pipeline
547 expression. The displayhook will open the default browser for such an object
547 expression. The displayhook will open the default browser for such an object
548 (instead of simply printing the ``repr()`` result).
548 (instead of simply printing the ``repr()`` result).
549 """
549 """
550
550
551 # We want to support ``foo`` and ``foo()`` in pipeline expression:
551 # We want to support ``foo`` and ``foo()`` in pipeline expression:
552 # So we implement the required operators (``|`` and ``+``) in the metaclass,
552 # So we implement the required operators (``|`` and ``+``) in the metaclass,
553 # instantiate the class and forward the operator to the instance
553 # instantiate the class and forward the operator to the instance
554 class __metaclass__(type):
554 class __metaclass__(type):
555 def __iter__(self):
555 def __iter__(self):
556 return iter(self())
556 return iter(self())
557
557
558 def __or__(self, other):
558 def __or__(self, other):
559 return self() | other
559 return self() | other
560
560
561 def __add__(self, other):
561 def __add__(self, other):
562 return self() + other
562 return self() + other
563
563
564 def __radd__(self, other):
564 def __radd__(self, other):
565 return other + self()
565 return other + self()
566
566
567 def __getitem__(self, index):
567 def __getitem__(self, index):
568 return self()[index]
568 return self()[index]
569
569
570 def __getitem__(self, index):
570 def __getitem__(self, index):
571 return item(self, index)
571 return item(self, index)
572
572
573 def __contains__(self, item):
573 def __contains__(self, item):
574 for haveitem in self:
574 for haveitem in self:
575 if item == haveitem:
575 if item == haveitem:
576 return True
576 return True
577 return False
577 return False
578
578
579 def __or__(self, other):
579 def __or__(self, other):
580 # autoinstantiate right hand side
580 # autoinstantiate right hand side
581 if isinstance(other, type) and issubclass(other, (Table, Display)):
581 if isinstance(other, type) and issubclass(other, (Table, Display)):
582 other = other()
582 other = other()
583 # treat simple strings and functions as ``ieval`` instances
583 # treat simple strings and functions as ``ieval`` instances
584 elif not isinstance(other, Display) and not isinstance(other, Table):
584 elif not isinstance(other, Display) and not isinstance(other, Table):
585 other = ieval(other)
585 other = ieval(other)
586 # forward operations to the right hand side
586 # forward operations to the right hand side
587 return other.__ror__(self)
587 return other.__ror__(self)
588
588
589 def __add__(self, other):
589 def __add__(self, other):
590 # autoinstantiate right hand side
590 # autoinstantiate right hand side
591 if isinstance(other, type) and issubclass(other, Table):
591 if isinstance(other, type) and issubclass(other, Table):
592 other = other()
592 other = other()
593 return ichain(self, other)
593 return ichain(self, other)
594
594
595 def __radd__(self, other):
595 def __radd__(self, other):
596 # autoinstantiate left hand side
596 # autoinstantiate left hand side
597 if isinstance(other, type) and issubclass(other, Table):
597 if isinstance(other, type) and issubclass(other, Table):
598 other = other()
598 other = other()
599 return ichain(other, self)
599 return ichain(other, self)
600
600
601
601
602 class Pipe(Table):
602 class Pipe(Table):
603 """
603 """
604 A ``Pipe`` is an object that can be used in a pipeline expression. It
604 A ``Pipe`` is an object that can be used in a pipeline expression. It
605 processes the objects it gets from its input ``Table``/``Pipe``. Note that
605 processes the objects it gets from its input ``Table``/``Pipe``. Note that
606 a ``Pipe`` object can't be used as the first object in a pipeline
606 a ``Pipe`` object can't be used as the first object in a pipeline
607 expression, as it doesn't produces items itself.
607 expression, as it doesn't produces items itself.
608 """
608 """
609 class __metaclass__(Table.__metaclass__):
609 class __metaclass__(Table.__metaclass__):
610 def __ror__(self, input):
610 def __ror__(self, input):
611 return input | self()
611 return input | self()
612
612
613 def __ror__(self, input):
613 def __ror__(self, input):
614 # autoinstantiate left hand side
614 # autoinstantiate left hand side
615 if isinstance(input, type) and issubclass(input, Table):
615 if isinstance(input, type) and issubclass(input, Table):
616 input = input()
616 input = input()
617 self.input = input
617 self.input = input
618 return self
618 return self
619
619
620
620
621 def xrepr(item, mode="default"):
621 def xrepr(item, mode="default"):
622 """
622 """
623 Generic function that adds color output and different display modes to ``repr``.
623 Generic function that adds color output and different display modes to ``repr``.
624
624
625 The result of an ``xrepr`` call is iterable and consists of ``(style, string)``
625 The result of an ``xrepr`` call is iterable and consists of ``(style, string)``
626 tuples. The ``style`` in this tuple must be a ``Style`` object from the
626 tuples. The ``style`` in this tuple must be a ``Style`` object from the
627 ``astring`` module. To reconfigure the output the first yielded tuple can be
627 ``astring`` module. To reconfigure the output the first yielded tuple can be
628 a ``(aligment, full)`` tuple instead of a ``(style, string)`` tuple.
628 a ``(aligment, full)`` tuple instead of a ``(style, string)`` tuple.
629 ``alignment`` can be -1 for left aligned, 0 for centered and 1 for right
629 ``alignment`` can be -1 for left aligned, 0 for centered and 1 for right
630 aligned (the default is left alignment). ``full`` is a boolean that specifies
630 aligned (the default is left alignment). ``full`` is a boolean that specifies
631 whether the complete output must be displayed or the ``Display`` object is
631 whether the complete output must be displayed or the ``Display`` object is
632 allowed to stop output after enough text has been produced (e.g. a syntax
632 allowed to stop output after enough text has been produced (e.g. a syntax
633 highlighted text line would use ``True``, but for a large data structure
633 highlighted text line would use ``True``, but for a large data structure
634 (i.e. a nested list, tuple or dictionary) ``False`` would be used).
634 (i.e. a nested list, tuple or dictionary) ``False`` would be used).
635 The default is full output.
635 The default is full output.
636
636
637 There are four different possible values for ``mode`` depending on where
637 There are four different possible values for ``mode`` depending on where
638 the ``Display`` object will display ``item``:
638 the ``Display`` object will display ``item``:
639
639
640 * ``"header"``: ``item`` will be displayed in a header line (this is used by
640 * ``"header"``: ``item`` will be displayed in a header line (this is used by
641 ``ibrowse``).
641 ``ibrowse``).
642 * ``"footer"``: ``item`` will be displayed in a footer line (this is used by
642 * ``"footer"``: ``item`` will be displayed in a footer line (this is used by
643 ``ibrowse``).
643 ``ibrowse``).
644 * ``"cell"``: ``item`` will be displayed in a table cell/list.
644 * ``"cell"``: ``item`` will be displayed in a table cell/list.
645 * ``"default"``: default mode. If an ``xrepr`` implementation recursively
645 * ``"default"``: default mode. If an ``xrepr`` implementation recursively
646 outputs objects, ``"default"`` must be passed in the recursive calls to
646 outputs objects, ``"default"`` must be passed in the recursive calls to
647 ``xrepr``.
647 ``xrepr``.
648
648
649 If no implementation is registered for ``item``, ``xrepr`` will try the
649 If no implementation is registered for ``item``, ``xrepr`` will try the
650 ``__xrepr__`` method on ``item``. If ``item`` doesn't have an ``__xrepr__``
650 ``__xrepr__`` method on ``item``. If ``item`` doesn't have an ``__xrepr__``
651 method it falls back to ``repr``/``__repr__`` for all modes.
651 method it falls back to ``repr``/``__repr__`` for all modes.
652 """
652 """
653 try:
653 try:
654 func = item.__xrepr__
654 func = item.__xrepr__
655 except AttributeError:
655 except AttributeError:
656 yield (astyle.style_default, repr(item))
656 yield (astyle.style_default, repr(item))
657 else:
657 else:
658 try:
658 try:
659 for x in func(mode):
659 for x in func(mode):
660 yield x
660 yield x
661 except (KeyboardInterrupt, SystemExit):
661 except (KeyboardInterrupt, SystemExit):
662 raise
662 raise
663 except Exception:
663 except Exception:
664 yield (astyle.style_default, repr(item))
664 yield (astyle.style_default, repr(item))
665 xrepr = simplegeneric.generic(xrepr)
665 xrepr = simplegeneric.generic(xrepr)
666
666
667
667
668 def xrepr_none(self, mode="default"):
668 def xrepr_none(self, mode="default"):
669 yield (astyle.style_type_none, repr(self))
669 yield (astyle.style_type_none, repr(self))
670 xrepr.when_object(None)(xrepr_none)
670 xrepr.when_object(None)(xrepr_none)
671
671
672
672
673 def xrepr_bool(self, mode="default"):
673 def xrepr_bool(self, mode="default"):
674 yield (astyle.style_type_bool, repr(self))
674 yield (astyle.style_type_bool, repr(self))
675 xrepr.when_type(bool)(xrepr_bool)
675 xrepr.when_type(bool)(xrepr_bool)
676
676
677
677
678 def xrepr_str(self, mode="default"):
678 def xrepr_str(self, mode="default"):
679 if mode == "cell":
679 if mode == "cell":
680 yield (astyle.style_default, repr(self.expandtabs(tab))[1:-1])
680 yield (astyle.style_default, repr(self.expandtabs(tab))[1:-1])
681 else:
681 else:
682 yield (astyle.style_default, repr(self))
682 yield (astyle.style_default, repr(self))
683 xrepr.when_type(str)(xrepr_str)
683 xrepr.when_type(str)(xrepr_str)
684
684
685
685
686 def xrepr_unicode(self, mode="default"):
686 def xrepr_unicode(self, mode="default"):
687 if mode == "cell":
687 if mode == "cell":
688 yield (astyle.style_default, repr(self.expandtabs(tab))[2:-1])
688 yield (astyle.style_default, repr(self.expandtabs(tab))[2:-1])
689 else:
689 else:
690 yield (astyle.style_default, repr(self))
690 yield (astyle.style_default, repr(self))
691 xrepr.when_type(unicode)(xrepr_unicode)
691 xrepr.when_type(unicode)(xrepr_unicode)
692
692
693
693
694 def xrepr_number(self, mode="default"):
694 def xrepr_number(self, mode="default"):
695 yield (1, True)
695 yield (1, True)
696 yield (astyle.style_type_number, repr(self))
696 yield (astyle.style_type_number, repr(self))
697 xrepr.when_type(int)(xrepr_number)
697 xrepr.when_type(int)(xrepr_number)
698 xrepr.when_type(long)(xrepr_number)
698 xrepr.when_type(long)(xrepr_number)
699 xrepr.when_type(float)(xrepr_number)
699 xrepr.when_type(float)(xrepr_number)
700
700
701
701
702 def xrepr_complex(self, mode="default"):
702 def xrepr_complex(self, mode="default"):
703 yield (astyle.style_type_number, repr(self))
703 yield (astyle.style_type_number, repr(self))
704 xrepr.when_type(complex)(xrepr_number)
704 xrepr.when_type(complex)(xrepr_number)
705
705
706
706
707 def xrepr_datetime(self, mode="default"):
707 def xrepr_datetime(self, mode="default"):
708 if mode == "cell":
708 if mode == "cell":
709 # Don't use strftime() here, as this requires year >= 1900
709 # Don't use strftime() here, as this requires year >= 1900
710 yield (astyle.style_type_datetime,
710 yield (astyle.style_type_datetime,
711 "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
711 "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
712 (self.year, self.month, self.day,
712 (self.year, self.month, self.day,
713 self.hour, self.minute, self.second,
713 self.hour, self.minute, self.second,
714 self.microsecond),
714 self.microsecond),
715 )
715 )
716 else:
716 else:
717 yield (astyle.style_type_datetime, repr(self))
717 yield (astyle.style_type_datetime, repr(self))
718 xrepr.when_type(datetime.datetime)(xrepr_datetime)
718 xrepr.when_type(datetime.datetime)(xrepr_datetime)
719
719
720
720
721 def xrepr_date(self, mode="default"):
721 def xrepr_date(self, mode="default"):
722 if mode == "cell":
722 if mode == "cell":
723 yield (astyle.style_type_datetime,
723 yield (astyle.style_type_datetime,
724 "%04d-%02d-%02d" % (self.year, self.month, self.day))
724 "%04d-%02d-%02d" % (self.year, self.month, self.day))
725 else:
725 else:
726 yield (astyle.style_type_datetime, repr(self))
726 yield (astyle.style_type_datetime, repr(self))
727 xrepr.when_type(datetime.date)(xrepr_date)
727 xrepr.when_type(datetime.date)(xrepr_date)
728
728
729
729
730 def xrepr_time(self, mode="default"):
730 def xrepr_time(self, mode="default"):
731 if mode == "cell":
731 if mode == "cell":
732 yield (astyle.style_type_datetime,
732 yield (astyle.style_type_datetime,
733 "%02d:%02d:%02d.%06d" % \
733 "%02d:%02d:%02d.%06d" % \
734 (self.hour, self.minute, self.second, self.microsecond))
734 (self.hour, self.minute, self.second, self.microsecond))
735 else:
735 else:
736 yield (astyle.style_type_datetime, repr(self))
736 yield (astyle.style_type_datetime, repr(self))
737 xrepr.when_type(datetime.time)(xrepr_time)
737 xrepr.when_type(datetime.time)(xrepr_time)
738
738
739
739
740 def xrepr_timedelta(self, mode="default"):
740 def xrepr_timedelta(self, mode="default"):
741 yield (astyle.style_type_datetime, repr(self))
741 yield (astyle.style_type_datetime, repr(self))
742 xrepr.when_type(datetime.timedelta)(xrepr_timedelta)
742 xrepr.when_type(datetime.timedelta)(xrepr_timedelta)
743
743
744
744
745 def xrepr_type(self, mode="default"):
745 def xrepr_type(self, mode="default"):
746 if self.__module__ == "__builtin__":
746 if self.__module__ == "__builtin__":
747 yield (astyle.style_type_type, self.__name__)
747 yield (astyle.style_type_type, self.__name__)
748 else:
748 else:
749 yield (astyle.style_type_type, "%s.%s" % (self.__module__, self.__name__))
749 yield (astyle.style_type_type, "%s.%s" % (self.__module__, self.__name__))
750 xrepr.when_type(type)(xrepr_type)
750 xrepr.when_type(type)(xrepr_type)
751
751
752
752
753 def xrepr_exception(self, mode="default"):
753 def xrepr_exception(self, mode="default"):
754 if self.__class__.__module__ == "exceptions":
754 if self.__class__.__module__ == "exceptions":
755 classname = self.__class__.__name__
755 classname = self.__class__.__name__
756 else:
756 else:
757 classname = "%s.%s" % \
757 classname = "%s.%s" % \
758 (self.__class__.__module__, self.__class__.__name__)
758 (self.__class__.__module__, self.__class__.__name__)
759 if mode == "header" or mode == "footer":
759 if mode == "header" or mode == "footer":
760 yield (astyle.style_error, "%s: %s" % (classname, self))
760 yield (astyle.style_error, "%s: %s" % (classname, self))
761 else:
761 else:
762 yield (astyle.style_error, classname)
762 yield (astyle.style_error, classname)
763 xrepr.when_type(Exception)(xrepr_exception)
763 xrepr.when_type(Exception)(xrepr_exception)
764
764
765
765
766 def xrepr_listtuple(self, mode="default"):
766 def xrepr_listtuple(self, mode="default"):
767 if mode == "header" or mode == "footer":
767 if mode == "header" or mode == "footer":
768 if self.__class__.__module__ == "__builtin__":
768 if self.__class__.__module__ == "__builtin__":
769 classname = self.__class__.__name__
769 classname = self.__class__.__name__
770 else:
770 else:
771 classname = "%s.%s" % \
771 classname = "%s.%s" % \
772 (self.__class__.__module__,self.__class__.__name__)
772 (self.__class__.__module__,self.__class__.__name__)
773 yield (astyle.style_default,
773 yield (astyle.style_default,
774 "<%s object with %d items at 0x%x>" % \
774 "<%s object with %d items at 0x%x>" % \
775 (classname, len(self), id(self)))
775 (classname, len(self), id(self)))
776 else:
776 else:
777 yield (-1, False)
777 yield (-1, False)
778 if isinstance(self, list):
778 if isinstance(self, list):
779 yield (astyle.style_default, "[")
779 yield (astyle.style_default, "[")
780 end = "]"
780 end = "]"
781 else:
781 else:
782 yield (astyle.style_default, "(")
782 yield (astyle.style_default, "(")
783 end = ")"
783 end = ")"
784 for (i, subself) in enumerate(self):
784 for (i, subself) in enumerate(self):
785 if i:
785 if i:
786 yield (astyle.style_default, ", ")
786 yield (astyle.style_default, ", ")
787 for part in xrepr(subself, "default"):
787 for part in xrepr(subself, "default"):
788 yield part
788 yield part
789 yield (astyle.style_default, end)
789 yield (astyle.style_default, end)
790 xrepr.when_type(list)(xrepr_listtuple)
790 xrepr.when_type(list)(xrepr_listtuple)
791 xrepr.when_type(tuple)(xrepr_listtuple)
791 xrepr.when_type(tuple)(xrepr_listtuple)
792
792
793
793
794 def xrepr_dict(self, mode="default"):
794 def xrepr_dict(self, mode="default"):
795 if mode == "header" or mode == "footer":
795 if mode == "header" or mode == "footer":
796 if self.__class__.__module__ == "__builtin__":
796 if self.__class__.__module__ == "__builtin__":
797 classname = self.__class__.__name__
797 classname = self.__class__.__name__
798 else:
798 else:
799 classname = "%s.%s" % \
799 classname = "%s.%s" % \
800 (self.__class__.__module__,self.__class__.__name__)
800 (self.__class__.__module__,self.__class__.__name__)
801 yield (astyle.style_default,
801 yield (astyle.style_default,
802 "<%s object with %d items at 0x%x>" % \
802 "<%s object with %d items at 0x%x>" % \
803 (classname, len(self), id(self)))
803 (classname, len(self), id(self)))
804 else:
804 else:
805 yield (-1, False)
805 yield (-1, False)
806 if isinstance(self, dict):
806 if isinstance(self, dict):
807 yield (astyle.style_default, "{")
807 yield (astyle.style_default, "{")
808 end = "}"
808 end = "}"
809 else:
809 else:
810 yield (astyle.style_default, "dictproxy((")
810 yield (astyle.style_default, "dictproxy((")
811 end = "})"
811 end = "})"
812 for (i, (key, value)) in enumerate(self.iteritems()):
812 for (i, (key, value)) in enumerate(self.iteritems()):
813 if i:
813 if i:
814 yield (astyle.style_default, ", ")
814 yield (astyle.style_default, ", ")
815 for part in xrepr(key, "default"):
815 for part in xrepr(key, "default"):
816 yield part
816 yield part
817 yield (astyle.style_default, ": ")
817 yield (astyle.style_default, ": ")
818 for part in xrepr(value, "default"):
818 for part in xrepr(value, "default"):
819 yield part
819 yield part
820 yield (astyle.style_default, end)
820 yield (astyle.style_default, end)
821 xrepr.when_type(dict)(xrepr_dict)
821 xrepr.when_type(dict)(xrepr_dict)
822 xrepr.when_type(types.DictProxyType)(xrepr_dict)
822 xrepr.when_type(types.DictProxyType)(xrepr_dict)
823
823
824
824
825 def upgradexattr(attr):
825 def upgradexattr(attr):
826 """
826 """
827 Convert an attribute descriptor string to a real descriptor object.
827 Convert an attribute descriptor string to a real descriptor object.
828
828
829 If attr already is a descriptor object return if unmodified. A
829 If attr already is a descriptor object return if unmodified. A
830 ``SelfDescriptor`` will be returned if ``attr`` is ``None``. ``"foo"``
830 ``SelfDescriptor`` will be returned if ``attr`` is ``None``. ``"foo"``
831 returns an ``AttributeDescriptor`` for the attribute named ``"foo"``.
831 returns an ``AttributeDescriptor`` for the attribute named ``"foo"``.
832 ``"foo()"`` returns a ``MethodDescriptor`` for the method named ``"foo"``.
832 ``"foo()"`` returns a ``MethodDescriptor`` for the method named ``"foo"``.
833 ``"-foo"`` will return an ``IterAttributeDescriptor`` for the attribute
833 ``"-foo"`` will return an ``IterAttributeDescriptor`` for the attribute
834 named ``"foo"`` and ``"-foo()"`` will return an ``IterMethodDescriptor``
834 named ``"foo"`` and ``"-foo()"`` will return an ``IterMethodDescriptor``
835 for the method named ``"foo"``. Furthermore integer will return the appropriate
835 for the method named ``"foo"``. Furthermore integer will return the appropriate
836 ``IndexDescriptor`` and callables will return a ``FunctionDescriptor``.
836 ``IndexDescriptor`` and callables will return a ``FunctionDescriptor``.
837 """
837 """
838 if attr is None:
838 if attr is None:
839 return selfdescriptor
839 return selfdescriptor
840 elif isinstance(attr, Descriptor):
840 elif isinstance(attr, Descriptor):
841 return attr
841 return attr
842 elif isinstance(attr, str):
842 elif isinstance(attr, str):
843 if attr.endswith("()"):
843 if attr.endswith("()"):
844 if attr.startswith("-"):
844 if attr.startswith("-"):
845 return IterMethodDescriptor(attr[1:-2])
845 return IterMethodDescriptor(attr[1:-2])
846 else:
846 else:
847 return MethodDescriptor(attr[:-2])
847 return MethodDescriptor(attr[:-2])
848 else:
848 else:
849 if attr.startswith("-"):
849 if attr.startswith("-"):
850 return IterAttributeDescriptor(attr[1:])
850 return IterAttributeDescriptor(attr[1:])
851 else:
851 else:
852 return AttributeDescriptor(attr)
852 return AttributeDescriptor(attr)
853 elif isinstance(attr, (int, long)):
853 elif isinstance(attr, (int, long)):
854 return IndexDescriptor(attr)
854 return IndexDescriptor(attr)
855 elif callable(attr):
855 elif callable(attr):
856 return FunctionDescriptor(attr)
856 return FunctionDescriptor(attr)
857 else:
857 else:
858 raise TypeError("can't handle descriptor %r" % attr)
858 raise TypeError("can't handle descriptor %r" % attr)
859
859
860
860
861 def xattrs(item, mode="default"):
861 def xattrs(item, mode="default"):
862 """
862 """
863 Generic function that returns an iterable of attribute descriptors
863 Generic function that returns an iterable of attribute descriptors
864 to be used for displaying the attributes ob the object ``item`` in display
864 to be used for displaying the attributes ob the object ``item`` in display
865 mode ``mode``.
865 mode ``mode``.
866
866
867 There are two possible modes:
867 There are two possible modes:
868
868
869 * ``"detail"``: The ``Display`` object wants to display a detailed list
869 * ``"detail"``: The ``Display`` object wants to display a detailed list
870 of the object attributes.
870 of the object attributes.
871 * ``"default"``: The ``Display`` object wants to display the object in a
871 * ``"default"``: The ``Display`` object wants to display the object in a
872 list view.
872 list view.
873
873
874 If no implementation is registered for the object ``item`` ``xattrs`` falls
874 If no implementation is registered for the object ``item`` ``xattrs`` falls
875 back to trying the ``__xattrs__`` method of the object. If this doesn't
875 back to trying the ``__xattrs__`` method of the object. If this doesn't
876 exist either, ``dir(item)`` is used for ``"detail"`` mode and ``(None,)``
876 exist either, ``dir(item)`` is used for ``"detail"`` mode and ``(None,)``
877 for ``"default"`` mode.
877 for ``"default"`` mode.
878
878
879 The implementation must yield attribute descriptor (see the class
879 The implementation must yield attribute descriptor (see the class
880 ``Descriptor`` for more info). The ``__xattrs__`` method may also return
880 ``Descriptor`` for more info). The ``__xattrs__`` method may also return
881 attribute descriptor string (and ``None``) which will be converted to real
881 attribute descriptor string (and ``None``) which will be converted to real
882 descriptors by ``upgradexattr()``.
882 descriptors by ``upgradexattr()``.
883 """
883 """
884 try:
884 try:
885 func = item.__xattrs__
885 func = item.__xattrs__
886 except AttributeError:
886 except AttributeError:
887 if mode == "detail":
887 if mode == "detail":
888 for attrname in dir(item):
888 for attrname in dir(item):
889 yield AttributeDescriptor(attrname)
889 yield AttributeDescriptor(attrname)
890 else:
890 else:
891 yield selfdescriptor
891 yield selfdescriptor
892 else:
892 else:
893 for attr in func(mode):
893 for attr in func(mode):
894 yield upgradexattr(attr)
894 yield upgradexattr(attr)
895 xattrs = simplegeneric.generic(xattrs)
895 xattrs = simplegeneric.generic(xattrs)
896
896
897
897
898 def xattrs_complex(self, mode="default"):
898 def xattrs_complex(self, mode="default"):
899 if mode == "detail":
899 if mode == "detail":
900 return (AttributeDescriptor("real"), AttributeDescriptor("imag"))
900 return (AttributeDescriptor("real"), AttributeDescriptor("imag"))
901 return (selfdescriptor,)
901 return (selfdescriptor,)
902 xattrs.when_type(complex)(xattrs_complex)
902 xattrs.when_type(complex)(xattrs_complex)
903
903
904
904
905 def _isdict(item):
905 def _isdict(item):
906 try:
906 try:
907 itermeth = item.__class__.__iter__
907 itermeth = item.__class__.__iter__
908 except (AttributeError, TypeError):
908 except (AttributeError, TypeError):
909 return False
909 return False
910 return itermeth is dict.__iter__ or itermeth is types.DictProxyType.__iter__
910 return itermeth is dict.__iter__ or itermeth is types.DictProxyType.__iter__
911
911
912
912
913 def _isstr(item):
913 def _isstr(item):
914 if not isinstance(item, basestring):
914 if not isinstance(item, basestring):
915 return False
915 return False
916 try:
916 try:
917 itermeth = item.__class__.__iter__
917 itermeth = item.__class__.__iter__
918 except AttributeError:
918 except AttributeError:
919 return True
919 return True
920 return False # ``__iter__`` has been redefined
920 return False # ``__iter__`` has been redefined
921
921
922
922
923 def xiter(item):
923 def xiter(item):
924 """
924 """
925 Generic function that implements iteration for pipeline expression. If no
925 Generic function that implements iteration for pipeline expression. If no
926 implementation is registered for ``item`` ``xiter`` falls back to ``iter``.
926 implementation is registered for ``item`` ``xiter`` falls back to ``iter``.
927 """
927 """
928 try:
928 try:
929 func = item.__xiter__
929 func = item.__xiter__
930 except AttributeError:
930 except AttributeError:
931 if _isdict(item):
931 if _isdict(item):
932 def items(item):
932 def items(item):
933 fields = ("key", "value")
933 fields = ("key", "value")
934 for (key, value) in item.iteritems():
934 for (key, value) in item.iteritems():
935 yield Fields(fields, key=key, value=value)
935 yield Fields(fields, key=key, value=value)
936 return items(item)
936 return items(item)
937 elif isinstance(item, new.module):
937 elif isinstance(item, new.module):
938 def items(item):
938 def items(item):
939 fields = ("key", "value")
939 fields = ("key", "value")
940 for key in sorted(item.__dict__):
940 for key in sorted(item.__dict__):
941 yield Fields(fields, key=key, value=getattr(item, key))
941 yield Fields(fields, key=key, value=getattr(item, key))
942 return items(item)
942 return items(item)
943 elif _isstr(item):
943 elif _isstr(item):
944 if not item:
944 if not item:
945 raise ValueError("can't enter empty string")
945 raise ValueError("can't enter empty string")
946 return iter(item.splitlines())
946 lines = item.splitlines()
947 if len(lines) == 1:
948 def iterone(item):
949 yield item
950 return iterone(item)
951 else:
952 return iter(lines)
947 return iter(item)
953 return iter(item)
948 else:
954 else:
949 return iter(func()) # iter() just to be safe
955 return iter(func()) # iter() just to be safe
950 xiter = simplegeneric.generic(xiter)
956 xiter = simplegeneric.generic(xiter)
951
957
952
958
953 class ichain(Pipe):
959 class ichain(Pipe):
954 """
960 """
955 Chains multiple ``Table``s into one.
961 Chains multiple ``Table``s into one.
956 """
962 """
957
963
958 def __init__(self, *iters):
964 def __init__(self, *iters):
959 self.iters = iters
965 self.iters = iters
960
966
961 def __iter__(self):
967 def __iter__(self):
962 return itertools.chain(*self.iters)
968 return itertools.chain(*self.iters)
963
969
964 def __xrepr__(self, mode="default"):
970 def __xrepr__(self, mode="default"):
965 if mode == "header" or mode == "footer":
971 if mode == "header" or mode == "footer":
966 for (i, item) in enumerate(self.iters):
972 for (i, item) in enumerate(self.iters):
967 if i:
973 if i:
968 yield (astyle.style_default, "+")
974 yield (astyle.style_default, "+")
969 if isinstance(item, Pipe):
975 if isinstance(item, Pipe):
970 yield (astyle.style_default, "(")
976 yield (astyle.style_default, "(")
971 for part in xrepr(item, mode):
977 for part in xrepr(item, mode):
972 yield part
978 yield part
973 if isinstance(item, Pipe):
979 if isinstance(item, Pipe):
974 yield (astyle.style_default, ")")
980 yield (astyle.style_default, ")")
975 else:
981 else:
976 yield (astyle.style_default, repr(self))
982 yield (astyle.style_default, repr(self))
977
983
978 def __repr__(self):
984 def __repr__(self):
979 args = ", ".join([repr(it) for it in self.iters])
985 args = ", ".join([repr(it) for it in self.iters])
980 return "%s.%s(%s)" % \
986 return "%s.%s(%s)" % \
981 (self.__class__.__module__, self.__class__.__name__, args)
987 (self.__class__.__module__, self.__class__.__name__, args)
982
988
983
989
984 class ifile(path.path):
990 class ifile(path.path):
985 """
991 """
986 file (or directory) object.
992 file (or directory) object.
987 """
993 """
988
994
989 def getmode(self):
995 def getmode(self):
990 return self.stat().st_mode
996 return self.stat().st_mode
991 mode = property(getmode, None, None, "Access mode")
997 mode = property(getmode, None, None, "Access mode")
992
998
993 def gettype(self):
999 def gettype(self):
994 data = [
1000 data = [
995 (stat.S_ISREG, "file"),
1001 (stat.S_ISREG, "file"),
996 (stat.S_ISDIR, "dir"),
1002 (stat.S_ISDIR, "dir"),
997 (stat.S_ISCHR, "chardev"),
1003 (stat.S_ISCHR, "chardev"),
998 (stat.S_ISBLK, "blockdev"),
1004 (stat.S_ISBLK, "blockdev"),
999 (stat.S_ISFIFO, "fifo"),
1005 (stat.S_ISFIFO, "fifo"),
1000 (stat.S_ISLNK, "symlink"),
1006 (stat.S_ISLNK, "symlink"),
1001 (stat.S_ISSOCK,"socket"),
1007 (stat.S_ISSOCK,"socket"),
1002 ]
1008 ]
1003 lstat = self.lstat()
1009 lstat = self.lstat()
1004 if lstat is not None:
1010 if lstat is not None:
1005 types = set([text for (func, text) in data if func(lstat.st_mode)])
1011 types = set([text for (func, text) in data if func(lstat.st_mode)])
1006 else:
1012 else:
1007 types = set()
1013 types = set()
1008 m = self.mode
1014 m = self.mode
1009 types.update([text for (func, text) in data if func(m)])
1015 types.update([text for (func, text) in data if func(m)])
1010 return ", ".join(types)
1016 return ", ".join(types)
1011 type = property(gettype, None, None, "file type (file, directory, link, etc.)")
1017 type = property(gettype, None, None, "file type (file, directory, link, etc.)")
1012
1018
1013 def getmodestr(self):
1019 def getmodestr(self):
1014 m = self.mode
1020 m = self.mode
1015 data = [
1021 data = [
1016 (stat.S_IRUSR, "-r"),
1022 (stat.S_IRUSR, "-r"),
1017 (stat.S_IWUSR, "-w"),
1023 (stat.S_IWUSR, "-w"),
1018 (stat.S_IXUSR, "-x"),
1024 (stat.S_IXUSR, "-x"),
1019 (stat.S_IRGRP, "-r"),
1025 (stat.S_IRGRP, "-r"),
1020 (stat.S_IWGRP, "-w"),
1026 (stat.S_IWGRP, "-w"),
1021 (stat.S_IXGRP, "-x"),
1027 (stat.S_IXGRP, "-x"),
1022 (stat.S_IROTH, "-r"),
1028 (stat.S_IROTH, "-r"),
1023 (stat.S_IWOTH, "-w"),
1029 (stat.S_IWOTH, "-w"),
1024 (stat.S_IXOTH, "-x"),
1030 (stat.S_IXOTH, "-x"),
1025 ]
1031 ]
1026 return "".join([text[bool(m&bit)] for (bit, text) in data])
1032 return "".join([text[bool(m&bit)] for (bit, text) in data])
1027
1033
1028 modestr = property(getmodestr, None, None, "Access mode as string")
1034 modestr = property(getmodestr, None, None, "Access mode as string")
1029
1035
1030 def getblocks(self):
1036 def getblocks(self):
1031 return self.stat().st_blocks
1037 return self.stat().st_blocks
1032 blocks = property(getblocks, None, None, "File size in blocks")
1038 blocks = property(getblocks, None, None, "File size in blocks")
1033
1039
1034 def getblksize(self):
1040 def getblksize(self):
1035 return self.stat().st_blksize
1041 return self.stat().st_blksize
1036 blksize = property(getblksize, None, None, "Filesystem block size")
1042 blksize = property(getblksize, None, None, "Filesystem block size")
1037
1043
1038 def getdev(self):
1044 def getdev(self):
1039 return self.stat().st_dev
1045 return self.stat().st_dev
1040 dev = property(getdev)
1046 dev = property(getdev)
1041
1047
1042 def getnlink(self):
1048 def getnlink(self):
1043 return self.stat().st_nlink
1049 return self.stat().st_nlink
1044 nlink = property(getnlink, None, None, "Number of links")
1050 nlink = property(getnlink, None, None, "Number of links")
1045
1051
1046 def getuid(self):
1052 def getuid(self):
1047 return self.stat().st_uid
1053 return self.stat().st_uid
1048 uid = property(getuid, None, None, "User id of file owner")
1054 uid = property(getuid, None, None, "User id of file owner")
1049
1055
1050 def getgid(self):
1056 def getgid(self):
1051 return self.stat().st_gid
1057 return self.stat().st_gid
1052 gid = property(getgid, None, None, "Group id of file owner")
1058 gid = property(getgid, None, None, "Group id of file owner")
1053
1059
1054 def getowner(self):
1060 def getowner(self):
1055 stat = self.stat()
1061 stat = self.stat()
1056 try:
1062 try:
1057 return pwd.getpwuid(stat.st_uid).pw_name
1063 return pwd.getpwuid(stat.st_uid).pw_name
1058 except KeyError:
1064 except KeyError:
1059 return stat.st_uid
1065 return stat.st_uid
1060 owner = property(getowner, None, None, "Owner name (or id)")
1066 owner = property(getowner, None, None, "Owner name (or id)")
1061
1067
1062 def getgroup(self):
1068 def getgroup(self):
1063 stat = self.stat()
1069 stat = self.stat()
1064 try:
1070 try:
1065 return grp.getgrgid(stat.st_gid).gr_name
1071 return grp.getgrgid(stat.st_gid).gr_name
1066 except KeyError:
1072 except KeyError:
1067 return stat.st_gid
1073 return stat.st_gid
1068 group = property(getgroup, None, None, "Group name (or id)")
1074 group = property(getgroup, None, None, "Group name (or id)")
1069
1075
1070 def getadate(self):
1076 def getadate(self):
1071 return datetime.datetime.utcfromtimestamp(self.atime)
1077 return datetime.datetime.utcfromtimestamp(self.atime)
1072 adate = property(getadate, None, None, "Access date")
1078 adate = property(getadate, None, None, "Access date")
1073
1079
1074 def getcdate(self):
1080 def getcdate(self):
1075 return datetime.datetime.utcfromtimestamp(self.ctime)
1081 return datetime.datetime.utcfromtimestamp(self.ctime)
1076 cdate = property(getcdate, None, None, "Creation date")
1082 cdate = property(getcdate, None, None, "Creation date")
1077
1083
1078 def getmdate(self):
1084 def getmdate(self):
1079 return datetime.datetime.utcfromtimestamp(self.mtime)
1085 return datetime.datetime.utcfromtimestamp(self.mtime)
1080 mdate = property(getmdate, None, None, "Modification date")
1086 mdate = property(getmdate, None, None, "Modification date")
1081
1087
1082 def mimetype(self):
1088 def mimetype(self):
1083 """
1089 """
1084 Return MIME type guessed from the extension.
1090 Return MIME type guessed from the extension.
1085 """
1091 """
1086 return mimetypes.guess_type(self.basename())[0]
1092 return mimetypes.guess_type(self.basename())[0]
1087
1093
1088 def encoding(self):
1094 def encoding(self):
1089 """
1095 """
1090 Return guessed compression (like "compress" or "gzip").
1096 Return guessed compression (like "compress" or "gzip").
1091 """
1097 """
1092 return mimetypes.guess_type(self.basename())[1]
1098 return mimetypes.guess_type(self.basename())[1]
1093
1099
1094 def __repr__(self):
1100 def __repr__(self):
1095 return "ifile(%s)" % path._base.__repr__(self)
1101 return "ifile(%s)" % path._base.__repr__(self)
1096
1102
1097 if sys.platform == "win32":
1103 if sys.platform == "win32":
1098 defaultattrs = (None, "type", "size", "modestr", "mdate")
1104 defaultattrs = (None, "type", "size", "modestr", "mdate")
1099 else:
1105 else:
1100 defaultattrs = (None, "type", "size", "modestr", "owner", "group", "mdate")
1106 defaultattrs = (None, "type", "size", "modestr", "owner", "group", "mdate")
1101
1107
1102 def __xattrs__(self, mode="default"):
1108 def __xattrs__(self, mode="default"):
1103 if mode == "detail":
1109 if mode == "detail":
1104 return (
1110 return (
1105 "name",
1111 "name",
1106 "basename()",
1112 "basename()",
1107 "abspath()",
1113 "abspath()",
1108 "realpath()",
1114 "realpath()",
1109 "type",
1115 "type",
1110 "mode",
1116 "mode",
1111 "modestr",
1117 "modestr",
1112 "stat()",
1118 "stat()",
1113 "lstat()",
1119 "lstat()",
1114 "uid",
1120 "uid",
1115 "gid",
1121 "gid",
1116 "owner",
1122 "owner",
1117 "group",
1123 "group",
1118 "dev",
1124 "dev",
1119 "nlink",
1125 "nlink",
1120 "ctime",
1126 "ctime",
1121 "mtime",
1127 "mtime",
1122 "atime",
1128 "atime",
1123 "cdate",
1129 "cdate",
1124 "mdate",
1130 "mdate",
1125 "adate",
1131 "adate",
1126 "size",
1132 "size",
1127 "blocks",
1133 "blocks",
1128 "blksize",
1134 "blksize",
1129 "isdir()",
1135 "isdir()",
1130 "islink()",
1136 "islink()",
1131 "mimetype()",
1137 "mimetype()",
1132 "encoding()",
1138 "encoding()",
1133 "-listdir()",
1139 "-listdir()",
1134 "-dirs()",
1140 "-dirs()",
1135 "-files()",
1141 "-files()",
1136 "-walk()",
1142 "-walk()",
1137 "-walkdirs()",
1143 "-walkdirs()",
1138 "-walkfiles()",
1144 "-walkfiles()",
1139 )
1145 )
1140 else:
1146 else:
1141 return self.defaultattrs
1147 return self.defaultattrs
1142
1148
1143
1149
1144 def xiter_ifile(self):
1150 def xiter_ifile(self):
1145 if self.isdir():
1151 if self.isdir():
1146 yield (self / os.pardir).abspath()
1152 yield (self / os.pardir).abspath()
1147 for child in sorted(self.listdir()):
1153 for child in sorted(self.listdir()):
1148 yield child
1154 yield child
1149 else:
1155 else:
1150 f = self.open("rb")
1156 f = self.open("rb")
1151 for line in f:
1157 for line in f:
1152 yield line
1158 yield line
1153 f.close()
1159 f.close()
1154 xiter.when_type(ifile)(xiter_ifile)
1160 xiter.when_type(ifile)(xiter_ifile)
1155
1161
1156
1162
1157 # We need to implement ``xrepr`` for ``ifile`` as a generic function, because
1163 # We need to implement ``xrepr`` for ``ifile`` as a generic function, because
1158 # otherwise ``xrepr_str`` would kick in.
1164 # otherwise ``xrepr_str`` would kick in.
1159 def xrepr_ifile(self, mode="default"):
1165 def xrepr_ifile(self, mode="default"):
1160 try:
1166 try:
1161 if self.isdir():
1167 if self.isdir():
1162 name = "idir"
1168 name = "idir"
1163 style = astyle.style_dir
1169 style = astyle.style_dir
1164 else:
1170 else:
1165 name = "ifile"
1171 name = "ifile"
1166 style = astyle.style_file
1172 style = astyle.style_file
1167 except IOError:
1173 except IOError:
1168 name = "ifile"
1174 name = "ifile"
1169 style = astyle.style_default
1175 style = astyle.style_default
1170 if mode == "cell" or mode in "header" or mode == "footer":
1176 if mode == "cell" or mode in "header" or mode == "footer":
1171 abspath = repr(path._base(self.normpath()))
1177 abspath = repr(path._base(self.normpath()))
1172 if abspath.startswith("u"):
1178 if abspath.startswith("u"):
1173 abspath = abspath[2:-1]
1179 abspath = abspath[2:-1]
1174 else:
1180 else:
1175 abspath = abspath[1:-1]
1181 abspath = abspath[1:-1]
1176 if mode == "cell":
1182 if mode == "cell":
1177 yield (style, abspath)
1183 yield (style, abspath)
1178 else:
1184 else:
1179 yield (style, "%s(%s)" % (name, abspath))
1185 yield (style, "%s(%s)" % (name, abspath))
1180 else:
1186 else:
1181 yield (style, repr(self))
1187 yield (style, repr(self))
1182 xrepr.when_type(ifile)(xrepr_ifile)
1188 xrepr.when_type(ifile)(xrepr_ifile)
1183
1189
1184
1190
1185 class ils(Table):
1191 class ils(Table):
1186 """
1192 """
1187 List the current (or a specified) directory.
1193 List the current (or a specified) directory.
1188
1194
1189 Examples:
1195 Examples:
1190
1196
1191 >>> ils
1197 >>> ils
1192 >>> ils("/usr/local/lib/python2.4")
1198 >>> ils("/usr/local/lib/python2.4")
1193 >>> ils("~")
1199 >>> ils("~")
1194 """
1200 """
1195 def __init__(self, base=os.curdir, dirs=True, files=True):
1201 def __init__(self, base=os.curdir, dirs=True, files=True):
1196 self.base = os.path.expanduser(base)
1202 self.base = os.path.expanduser(base)
1197 self.dirs = dirs
1203 self.dirs = dirs
1198 self.files = files
1204 self.files = files
1199
1205
1200 def __iter__(self):
1206 def __iter__(self):
1201 base = ifile(self.base)
1207 base = ifile(self.base)
1202 yield (base / os.pardir).abspath()
1208 yield (base / os.pardir).abspath()
1203 for child in base.listdir():
1209 for child in base.listdir():
1204 if self.dirs:
1210 if self.dirs:
1205 if self.files:
1211 if self.files:
1206 yield child
1212 yield child
1207 else:
1213 else:
1208 if child.isdir():
1214 if child.isdir():
1209 yield child
1215 yield child
1210 elif self.files:
1216 elif self.files:
1211 if not child.isdir():
1217 if not child.isdir():
1212 yield child
1218 yield child
1213
1219
1214 def __xrepr__(self, mode="default"):
1220 def __xrepr__(self, mode="default"):
1215 return xrepr(ifile(self.base), mode)
1221 return xrepr(ifile(self.base), mode)
1216
1222
1217 def __repr__(self):
1223 def __repr__(self):
1218 return "%s.%s(%r)" % \
1224 return "%s.%s(%r)" % \
1219 (self.__class__.__module__, self.__class__.__name__, self.base)
1225 (self.__class__.__module__, self.__class__.__name__, self.base)
1220
1226
1221
1227
1222 class iglob(Table):
1228 class iglob(Table):
1223 """
1229 """
1224 List all files and directories matching a specified pattern.
1230 List all files and directories matching a specified pattern.
1225 (See ``glob.glob()`` for more info.).
1231 (See ``glob.glob()`` for more info.).
1226
1232
1227 Examples:
1233 Examples:
1228
1234
1229 >>> iglob("*.py")
1235 >>> iglob("*.py")
1230 """
1236 """
1231 def __init__(self, glob):
1237 def __init__(self, glob):
1232 self.glob = glob
1238 self.glob = glob
1233
1239
1234 def __iter__(self):
1240 def __iter__(self):
1235 for name in glob.glob(self.glob):
1241 for name in glob.glob(self.glob):
1236 yield ifile(name)
1242 yield ifile(name)
1237
1243
1238 def __xrepr__(self, mode="default"):
1244 def __xrepr__(self, mode="default"):
1239 if mode == "header" or mode == "footer" or mode == "cell":
1245 if mode == "header" or mode == "footer" or mode == "cell":
1240 yield (astyle.style_default,
1246 yield (astyle.style_default,
1241 "%s(%r)" % (self.__class__.__name__, self.glob))
1247 "%s(%r)" % (self.__class__.__name__, self.glob))
1242 else:
1248 else:
1243 yield (astyle.style_default, repr(self))
1249 yield (astyle.style_default, repr(self))
1244
1250
1245 def __repr__(self):
1251 def __repr__(self):
1246 return "%s.%s(%r)" % \
1252 return "%s.%s(%r)" % \
1247 (self.__class__.__module__, self.__class__.__name__, self.glob)
1253 (self.__class__.__module__, self.__class__.__name__, self.glob)
1248
1254
1249
1255
1250 class iwalk(Table):
1256 class iwalk(Table):
1251 """
1257 """
1252 List all files and directories in a directory and it's subdirectory.
1258 List all files and directories in a directory and it's subdirectory.
1253
1259
1254 >>> iwalk
1260 >>> iwalk
1255 >>> iwalk("/usr/local/lib/python2.4")
1261 >>> iwalk("/usr/local/lib/python2.4")
1256 >>> iwalk("~")
1262 >>> iwalk("~")
1257 """
1263 """
1258 def __init__(self, base=os.curdir, dirs=True, files=True):
1264 def __init__(self, base=os.curdir, dirs=True, files=True):
1259 self.base = os.path.expanduser(base)
1265 self.base = os.path.expanduser(base)
1260 self.dirs = dirs
1266 self.dirs = dirs
1261 self.files = files
1267 self.files = files
1262
1268
1263 def __iter__(self):
1269 def __iter__(self):
1264 for (dirpath, dirnames, filenames) in os.walk(self.base):
1270 for (dirpath, dirnames, filenames) in os.walk(self.base):
1265 if self.dirs:
1271 if self.dirs:
1266 for name in sorted(dirnames):
1272 for name in sorted(dirnames):
1267 yield ifile(os.path.join(dirpath, name))
1273 yield ifile(os.path.join(dirpath, name))
1268 if self.files:
1274 if self.files:
1269 for name in sorted(filenames):
1275 for name in sorted(filenames):
1270 yield ifile(os.path.join(dirpath, name))
1276 yield ifile(os.path.join(dirpath, name))
1271
1277
1272 def __xrepr__(self, mode="default"):
1278 def __xrepr__(self, mode="default"):
1273 if mode == "header" or mode == "footer" or mode == "cell":
1279 if mode == "header" or mode == "footer" or mode == "cell":
1274 yield (astyle.style_default,
1280 yield (astyle.style_default,
1275 "%s(%r)" % (self.__class__.__name__, self.base))
1281 "%s(%r)" % (self.__class__.__name__, self.base))
1276 else:
1282 else:
1277 yield (astyle.style_default, repr(self))
1283 yield (astyle.style_default, repr(self))
1278
1284
1279 def __repr__(self):
1285 def __repr__(self):
1280 return "%s.%s(%r)" % \
1286 return "%s.%s(%r)" % \
1281 (self.__class__.__module__, self.__class__.__name__, self.base)
1287 (self.__class__.__module__, self.__class__.__name__, self.base)
1282
1288
1283
1289
1284 class ipwdentry(object):
1290 class ipwdentry(object):
1285 """
1291 """
1286 ``ipwdentry`` objects encapsulate entries in the Unix user account and
1292 ``ipwdentry`` objects encapsulate entries in the Unix user account and
1287 password database.
1293 password database.
1288 """
1294 """
1289 def __init__(self, id):
1295 def __init__(self, id):
1290 self._id = id
1296 self._id = id
1291 self._entry = None
1297 self._entry = None
1292
1298
1293 def __eq__(self, other):
1299 def __eq__(self, other):
1294 return self.__class__ is other.__class__ and self._id == other._id
1300 return self.__class__ is other.__class__ and self._id == other._id
1295
1301
1296 def __ne__(self, other):
1302 def __ne__(self, other):
1297 return self.__class__ is not other.__class__ or self._id != other._id
1303 return self.__class__ is not other.__class__ or self._id != other._id
1298
1304
1299 def _getentry(self):
1305 def _getentry(self):
1300 if self._entry is None:
1306 if self._entry is None:
1301 if isinstance(self._id, basestring):
1307 if isinstance(self._id, basestring):
1302 self._entry = pwd.getpwnam(self._id)
1308 self._entry = pwd.getpwnam(self._id)
1303 else:
1309 else:
1304 self._entry = pwd.getpwuid(self._id)
1310 self._entry = pwd.getpwuid(self._id)
1305 return self._entry
1311 return self._entry
1306
1312
1307 def getname(self):
1313 def getname(self):
1308 if isinstance(self._id, basestring):
1314 if isinstance(self._id, basestring):
1309 return self._id
1315 return self._id
1310 else:
1316 else:
1311 return self._getentry().pw_name
1317 return self._getentry().pw_name
1312 name = property(getname, None, None, "User name")
1318 name = property(getname, None, None, "User name")
1313
1319
1314 def getpasswd(self):
1320 def getpasswd(self):
1315 return self._getentry().pw_passwd
1321 return self._getentry().pw_passwd
1316 passwd = property(getpasswd, None, None, "Password")
1322 passwd = property(getpasswd, None, None, "Password")
1317
1323
1318 def getuid(self):
1324 def getuid(self):
1319 if isinstance(self._id, basestring):
1325 if isinstance(self._id, basestring):
1320 return self._getentry().pw_uid
1326 return self._getentry().pw_uid
1321 else:
1327 else:
1322 return self._id
1328 return self._id
1323 uid = property(getuid, None, None, "User id")
1329 uid = property(getuid, None, None, "User id")
1324
1330
1325 def getgid(self):
1331 def getgid(self):
1326 return self._getentry().pw_gid
1332 return self._getentry().pw_gid
1327 gid = property(getgid, None, None, "Primary group id")
1333 gid = property(getgid, None, None, "Primary group id")
1328
1334
1329 def getgroup(self):
1335 def getgroup(self):
1330 return igrpentry(self.gid)
1336 return igrpentry(self.gid)
1331 group = property(getgroup, None, None, "Group")
1337 group = property(getgroup, None, None, "Group")
1332
1338
1333 def getgecos(self):
1339 def getgecos(self):
1334 return self._getentry().pw_gecos
1340 return self._getentry().pw_gecos
1335 gecos = property(getgecos, None, None, "Information (e.g. full user name)")
1341 gecos = property(getgecos, None, None, "Information (e.g. full user name)")
1336
1342
1337 def getdir(self):
1343 def getdir(self):
1338 return self._getentry().pw_dir
1344 return self._getentry().pw_dir
1339 dir = property(getdir, None, None, "$HOME directory")
1345 dir = property(getdir, None, None, "$HOME directory")
1340
1346
1341 def getshell(self):
1347 def getshell(self):
1342 return self._getentry().pw_shell
1348 return self._getentry().pw_shell
1343 shell = property(getshell, None, None, "Login shell")
1349 shell = property(getshell, None, None, "Login shell")
1344
1350
1345 def __xattrs__(self, mode="default"):
1351 def __xattrs__(self, mode="default"):
1346 return ("name", "passwd", "uid", "gid", "gecos", "dir", "shell")
1352 return ("name", "passwd", "uid", "gid", "gecos", "dir", "shell")
1347
1353
1348 def __repr__(self):
1354 def __repr__(self):
1349 return "%s.%s(%r)" % \
1355 return "%s.%s(%r)" % \
1350 (self.__class__.__module__, self.__class__.__name__, self._id)
1356 (self.__class__.__module__, self.__class__.__name__, self._id)
1351
1357
1352
1358
1353 class ipwd(Table):
1359 class ipwd(Table):
1354 """
1360 """
1355 List all entries in the Unix user account and password database.
1361 List all entries in the Unix user account and password database.
1356
1362
1357 Example:
1363 Example:
1358
1364
1359 >>> ipwd | isort("uid")
1365 >>> ipwd | isort("uid")
1360 """
1366 """
1361 def __iter__(self):
1367 def __iter__(self):
1362 for entry in pwd.getpwall():
1368 for entry in pwd.getpwall():
1363 yield ipwdentry(entry.pw_name)
1369 yield ipwdentry(entry.pw_name)
1364
1370
1365 def __xrepr__(self, mode="default"):
1371 def __xrepr__(self, mode="default"):
1366 if mode == "header" or mode == "footer" or mode == "cell":
1372 if mode == "header" or mode == "footer" or mode == "cell":
1367 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1373 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1368 else:
1374 else:
1369 yield (astyle.style_default, repr(self))
1375 yield (astyle.style_default, repr(self))
1370
1376
1371
1377
1372 class igrpentry(object):
1378 class igrpentry(object):
1373 """
1379 """
1374 ``igrpentry`` objects encapsulate entries in the Unix group database.
1380 ``igrpentry`` objects encapsulate entries in the Unix group database.
1375 """
1381 """
1376 def __init__(self, id):
1382 def __init__(self, id):
1377 self._id = id
1383 self._id = id
1378 self._entry = None
1384 self._entry = None
1379
1385
1380 def __eq__(self, other):
1386 def __eq__(self, other):
1381 return self.__class__ is other.__class__ and self._id == other._id
1387 return self.__class__ is other.__class__ and self._id == other._id
1382
1388
1383 def __ne__(self, other):
1389 def __ne__(self, other):
1384 return self.__class__ is not other.__class__ or self._id != other._id
1390 return self.__class__ is not other.__class__ or self._id != other._id
1385
1391
1386 def _getentry(self):
1392 def _getentry(self):
1387 if self._entry is None:
1393 if self._entry is None:
1388 if isinstance(self._id, basestring):
1394 if isinstance(self._id, basestring):
1389 self._entry = grp.getgrnam(self._id)
1395 self._entry = grp.getgrnam(self._id)
1390 else:
1396 else:
1391 self._entry = grp.getgrgid(self._id)
1397 self._entry = grp.getgrgid(self._id)
1392 return self._entry
1398 return self._entry
1393
1399
1394 def getname(self):
1400 def getname(self):
1395 if isinstance(self._id, basestring):
1401 if isinstance(self._id, basestring):
1396 return self._id
1402 return self._id
1397 else:
1403 else:
1398 return self._getentry().gr_name
1404 return self._getentry().gr_name
1399 name = property(getname, None, None, "Group name")
1405 name = property(getname, None, None, "Group name")
1400
1406
1401 def getpasswd(self):
1407 def getpasswd(self):
1402 return self._getentry().gr_passwd
1408 return self._getentry().gr_passwd
1403 passwd = property(getpasswd, None, None, "Password")
1409 passwd = property(getpasswd, None, None, "Password")
1404
1410
1405 def getgid(self):
1411 def getgid(self):
1406 if isinstance(self._id, basestring):
1412 if isinstance(self._id, basestring):
1407 return self._getentry().gr_gid
1413 return self._getentry().gr_gid
1408 else:
1414 else:
1409 return self._id
1415 return self._id
1410 gid = property(getgid, None, None, "Group id")
1416 gid = property(getgid, None, None, "Group id")
1411
1417
1412 def getmem(self):
1418 def getmem(self):
1413 return self._getentry().gr_mem
1419 return self._getentry().gr_mem
1414 mem = property(getmem, None, None, "Members")
1420 mem = property(getmem, None, None, "Members")
1415
1421
1416 def __xattrs__(self, mode="default"):
1422 def __xattrs__(self, mode="default"):
1417 return ("name", "passwd", "gid", "mem")
1423 return ("name", "passwd", "gid", "mem")
1418
1424
1419 def __xrepr__(self, mode="default"):
1425 def __xrepr__(self, mode="default"):
1420 if mode == "header" or mode == "footer" or mode == "cell":
1426 if mode == "header" or mode == "footer" or mode == "cell":
1421 yield (astyle.style_default, "group ")
1427 yield (astyle.style_default, "group ")
1422 try:
1428 try:
1423 yield (astyle.style_default, self.name)
1429 yield (astyle.style_default, self.name)
1424 except KeyError:
1430 except KeyError:
1425 if isinstance(self._id, basestring):
1431 if isinstance(self._id, basestring):
1426 yield (astyle.style_default, self.name_id)
1432 yield (astyle.style_default, self.name_id)
1427 else:
1433 else:
1428 yield (astyle.style_type_number, str(self._id))
1434 yield (astyle.style_type_number, str(self._id))
1429 else:
1435 else:
1430 yield (astyle.style_default, repr(self))
1436 yield (astyle.style_default, repr(self))
1431
1437
1432 def __iter__(self):
1438 def __iter__(self):
1433 for member in self.mem:
1439 for member in self.mem:
1434 yield ipwdentry(member)
1440 yield ipwdentry(member)
1435
1441
1436 def __repr__(self):
1442 def __repr__(self):
1437 return "%s.%s(%r)" % \
1443 return "%s.%s(%r)" % \
1438 (self.__class__.__module__, self.__class__.__name__, self._id)
1444 (self.__class__.__module__, self.__class__.__name__, self._id)
1439
1445
1440
1446
1441 class igrp(Table):
1447 class igrp(Table):
1442 """
1448 """
1443 This ``Table`` lists all entries in the Unix group database.
1449 This ``Table`` lists all entries in the Unix group database.
1444 """
1450 """
1445 def __iter__(self):
1451 def __iter__(self):
1446 for entry in grp.getgrall():
1452 for entry in grp.getgrall():
1447 yield igrpentry(entry.gr_name)
1453 yield igrpentry(entry.gr_name)
1448
1454
1449 def __xrepr__(self, mode="default"):
1455 def __xrepr__(self, mode="default"):
1450 if mode == "header" or mode == "footer":
1456 if mode == "header" or mode == "footer":
1451 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1457 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1452 else:
1458 else:
1453 yield (astyle.style_default, repr(self))
1459 yield (astyle.style_default, repr(self))
1454
1460
1455
1461
1456 class Fields(object):
1462 class Fields(object):
1457 def __init__(self, fieldnames, **fields):
1463 def __init__(self, fieldnames, **fields):
1458 self.__fieldnames = [upgradexattr(fieldname) for fieldname in fieldnames]
1464 self.__fieldnames = [upgradexattr(fieldname) for fieldname in fieldnames]
1459 for (key, value) in fields.iteritems():
1465 for (key, value) in fields.iteritems():
1460 setattr(self, key, value)
1466 setattr(self, key, value)
1461
1467
1462 def __xattrs__(self, mode="default"):
1468 def __xattrs__(self, mode="default"):
1463 return self.__fieldnames
1469 return self.__fieldnames
1464
1470
1465 def __xrepr__(self, mode="default"):
1471 def __xrepr__(self, mode="default"):
1466 yield (-1, False)
1472 yield (-1, False)
1467 if mode == "header" or mode == "cell":
1473 if mode == "header" or mode == "cell":
1468 yield (astyle.style_default, self.__class__.__name__)
1474 yield (astyle.style_default, self.__class__.__name__)
1469 yield (astyle.style_default, "(")
1475 yield (astyle.style_default, "(")
1470 for (i, f) in enumerate(self.__fieldnames):
1476 for (i, f) in enumerate(self.__fieldnames):
1471 if i:
1477 if i:
1472 yield (astyle.style_default, ", ")
1478 yield (astyle.style_default, ", ")
1473 yield (astyle.style_default, f.name())
1479 yield (astyle.style_default, f.name())
1474 yield (astyle.style_default, "=")
1480 yield (astyle.style_default, "=")
1475 for part in xrepr(getattr(self, f), "default"):
1481 for part in xrepr(getattr(self, f), "default"):
1476 yield part
1482 yield part
1477 yield (astyle.style_default, ")")
1483 yield (astyle.style_default, ")")
1478 elif mode == "footer":
1484 elif mode == "footer":
1479 yield (astyle.style_default, self.__class__.__name__)
1485 yield (astyle.style_default, self.__class__.__name__)
1480 yield (astyle.style_default, "(")
1486 yield (astyle.style_default, "(")
1481 for (i, f) in enumerate(self.__fieldnames):
1487 for (i, f) in enumerate(self.__fieldnames):
1482 if i:
1488 if i:
1483 yield (astyle.style_default, ", ")
1489 yield (astyle.style_default, ", ")
1484 yield (astyle.style_default, f.name())
1490 yield (astyle.style_default, f.name())
1485 yield (astyle.style_default, ")")
1491 yield (astyle.style_default, ")")
1486 else:
1492 else:
1487 yield (astyle.style_default, repr(self))
1493 yield (astyle.style_default, repr(self))
1488
1494
1489
1495
1490 class FieldTable(Table, list):
1496 class FieldTable(Table, list):
1491 def __init__(self, *fields):
1497 def __init__(self, *fields):
1492 Table.__init__(self)
1498 Table.__init__(self)
1493 list.__init__(self)
1499 list.__init__(self)
1494 self.fields = fields
1500 self.fields = fields
1495
1501
1496 def add(self, **fields):
1502 def add(self, **fields):
1497 self.append(Fields(self.fields, **fields))
1503 self.append(Fields(self.fields, **fields))
1498
1504
1499 def __xrepr__(self, mode="default"):
1505 def __xrepr__(self, mode="default"):
1500 yield (-1, False)
1506 yield (-1, False)
1501 if mode == "header" or mode == "footer":
1507 if mode == "header" or mode == "footer":
1502 yield (astyle.style_default, self.__class__.__name__)
1508 yield (astyle.style_default, self.__class__.__name__)
1503 yield (astyle.style_default, "(")
1509 yield (astyle.style_default, "(")
1504 for (i, f) in enumerate(self.__fieldnames):
1510 for (i, f) in enumerate(self.__fieldnames):
1505 if i:
1511 if i:
1506 yield (astyle.style_default, ", ")
1512 yield (astyle.style_default, ", ")
1507 yield (astyle.style_default, f)
1513 yield (astyle.style_default, f)
1508 yield (astyle.style_default, ")")
1514 yield (astyle.style_default, ")")
1509 else:
1515 else:
1510 yield (astyle.style_default, repr(self))
1516 yield (astyle.style_default, repr(self))
1511
1517
1512 def __repr__(self):
1518 def __repr__(self):
1513 return "<%s.%s object with fields=%r at 0x%x>" % \
1519 return "<%s.%s object with fields=%r at 0x%x>" % \
1514 (self.__class__.__module__, self.__class__.__name__,
1520 (self.__class__.__module__, self.__class__.__name__,
1515 ", ".join(map(repr, self.fields)), id(self))
1521 ", ".join(map(repr, self.fields)), id(self))
1516
1522
1517
1523
1518 class List(list):
1524 class List(list):
1519 def __xattrs__(self, mode="default"):
1525 def __xattrs__(self, mode="default"):
1520 return xrange(len(self))
1526 return xrange(len(self))
1521
1527
1522 def __xrepr__(self, mode="default"):
1528 def __xrepr__(self, mode="default"):
1523 yield (-1, False)
1529 yield (-1, False)
1524 if mode == "header" or mode == "cell" or mode == "footer" or mode == "default":
1530 if mode == "header" or mode == "cell" or mode == "footer" or mode == "default":
1525 yield (astyle.style_default, self.__class__.__name__)
1531 yield (astyle.style_default, self.__class__.__name__)
1526 yield (astyle.style_default, "(")
1532 yield (astyle.style_default, "(")
1527 for (i, item) in enumerate(self):
1533 for (i, item) in enumerate(self):
1528 if i:
1534 if i:
1529 yield (astyle.style_default, ", ")
1535 yield (astyle.style_default, ", ")
1530 for part in xrepr(item, "default"):
1536 for part in xrepr(item, "default"):
1531 yield part
1537 yield part
1532 yield (astyle.style_default, ")")
1538 yield (astyle.style_default, ")")
1533 else:
1539 else:
1534 yield (astyle.style_default, repr(self))
1540 yield (astyle.style_default, repr(self))
1535
1541
1536
1542
1537 class ienv(Table):
1543 class ienv(Table):
1538 """
1544 """
1539 List environment variables.
1545 List environment variables.
1540
1546
1541 Example:
1547 Example:
1542
1548
1543 >>> ienv
1549 >>> ienv
1544 """
1550 """
1545
1551
1546 def __iter__(self):
1552 def __iter__(self):
1547 fields = ("key", "value")
1553 fields = ("key", "value")
1548 for (key, value) in os.environ.iteritems():
1554 for (key, value) in os.environ.iteritems():
1549 yield Fields(fields, key=key, value=value)
1555 yield Fields(fields, key=key, value=value)
1550
1556
1551 def __xrepr__(self, mode="default"):
1557 def __xrepr__(self, mode="default"):
1552 if mode == "header" or mode == "cell":
1558 if mode == "header" or mode == "cell":
1553 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1559 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1554 else:
1560 else:
1555 yield (astyle.style_default, repr(self))
1561 yield (astyle.style_default, repr(self))
1556
1562
1557
1563
1558 class icsv(Pipe):
1564 class icsv(Pipe):
1559 """
1565 """
1560 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
1566 This ``Pipe`` lists turn the input (with must be a pipe outputting lines
1561 or an ``ifile``) into lines of CVS columns.
1567 or an ``ifile``) into lines of CVS columns.
1562 """
1568 """
1563 def __init__(self, **csvargs):
1569 def __init__(self, **csvargs):
1564 """
1570 """
1565 Create an ``icsv`` object. ``cvsargs`` will be passed through as
1571 Create an ``icsv`` object. ``cvsargs`` will be passed through as
1566 keyword arguments to ``cvs.reader()``.
1572 keyword arguments to ``cvs.reader()``.
1567 """
1573 """
1568 self.csvargs = csvargs
1574 self.csvargs = csvargs
1569
1575
1570 def __iter__(self):
1576 def __iter__(self):
1571 input = self.input
1577 input = self.input
1572 if isinstance(input, ifile):
1578 if isinstance(input, ifile):
1573 input = input.open("rb")
1579 input = input.open("rb")
1574 reader = csv.reader(input, **self.csvargs)
1580 reader = csv.reader(input, **self.csvargs)
1575 for line in reader:
1581 for line in reader:
1576 yield List(line)
1582 yield List(line)
1577
1583
1578 def __xrepr__(self, mode="default"):
1584 def __xrepr__(self, mode="default"):
1579 yield (-1, False)
1585 yield (-1, False)
1580 if mode == "header" or mode == "footer":
1586 if mode == "header" or mode == "footer":
1581 input = getattr(self, "input", None)
1587 input = getattr(self, "input", None)
1582 if input is not None:
1588 if input is not None:
1583 for part in xrepr(input, mode):
1589 for part in xrepr(input, mode):
1584 yield part
1590 yield part
1585 yield (astyle.style_default, " | ")
1591 yield (astyle.style_default, " | ")
1586 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1592 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1587 for (i, (name, value)) in enumerate(self.csvargs.iteritems()):
1593 for (i, (name, value)) in enumerate(self.csvargs.iteritems()):
1588 if i:
1594 if i:
1589 yield (astyle.style_default, ", ")
1595 yield (astyle.style_default, ", ")
1590 yield (astyle.style_default, name)
1596 yield (astyle.style_default, name)
1591 yield (astyle.style_default, "=")
1597 yield (astyle.style_default, "=")
1592 for part in xrepr(value, "default"):
1598 for part in xrepr(value, "default"):
1593 yield part
1599 yield part
1594 yield (astyle.style_default, ")")
1600 yield (astyle.style_default, ")")
1595 else:
1601 else:
1596 yield (astyle.style_default, repr(self))
1602 yield (astyle.style_default, repr(self))
1597
1603
1598 def __repr__(self):
1604 def __repr__(self):
1599 args = ", ".join(["%s=%r" % item for item in self.csvargs.iteritems()])
1605 args = ", ".join(["%s=%r" % item for item in self.csvargs.iteritems()])
1600 return "<%s.%s %s at 0x%x>" % \
1606 return "<%s.%s %s at 0x%x>" % \
1601 (self.__class__.__module__, self.__class__.__name__, args, id(self))
1607 (self.__class__.__module__, self.__class__.__name__, args, id(self))
1602
1608
1603
1609
1604 class ix(Table):
1610 class ix(Table):
1605 """
1611 """
1606 Execute a system command and list its output as lines
1612 Execute a system command and list its output as lines
1607 (similar to ``os.popen()``).
1613 (similar to ``os.popen()``).
1608
1614
1609 Examples:
1615 Examples:
1610
1616
1611 >>> ix("ps x")
1617 >>> ix("ps x")
1612 >>> ix("find .") | ifile
1618 >>> ix("find .") | ifile
1613 """
1619 """
1614 def __init__(self, cmd):
1620 def __init__(self, cmd):
1615 self.cmd = cmd
1621 self.cmd = cmd
1616 self._pipeout = None
1622 self._pipeout = None
1617
1623
1618 def __iter__(self):
1624 def __iter__(self):
1619 (_pipein, self._pipeout) = os.popen4(self.cmd)
1625 (_pipein, self._pipeout) = os.popen4(self.cmd)
1620 _pipein.close()
1626 _pipein.close()
1621 for l in self._pipeout:
1627 for l in self._pipeout:
1622 yield l.rstrip("\r\n")
1628 yield l.rstrip("\r\n")
1623 self._pipeout.close()
1629 self._pipeout.close()
1624 self._pipeout = None
1630 self._pipeout = None
1625
1631
1626 def __del__(self):
1632 def __del__(self):
1627 if self._pipeout is not None and not self._pipeout.closed:
1633 if self._pipeout is not None and not self._pipeout.closed:
1628 self._pipeout.close()
1634 self._pipeout.close()
1629 self._pipeout = None
1635 self._pipeout = None
1630
1636
1631 def __xrepr__(self, mode="default"):
1637 def __xrepr__(self, mode="default"):
1632 if mode == "header" or mode == "footer":
1638 if mode == "header" or mode == "footer":
1633 yield (astyle.style_default,
1639 yield (astyle.style_default,
1634 "%s(%r)" % (self.__class__.__name__, self.cmd))
1640 "%s(%r)" % (self.__class__.__name__, self.cmd))
1635 else:
1641 else:
1636 yield (astyle.style_default, repr(self))
1642 yield (astyle.style_default, repr(self))
1637
1643
1638 def __repr__(self):
1644 def __repr__(self):
1639 return "%s.%s(%r)" % \
1645 return "%s.%s(%r)" % \
1640 (self.__class__.__module__, self.__class__.__name__, self.cmd)
1646 (self.__class__.__module__, self.__class__.__name__, self.cmd)
1641
1647
1642
1648
1643 class ifilter(Pipe):
1649 class ifilter(Pipe):
1644 """
1650 """
1645 Filter an input pipe. Only objects where an expression evaluates to true
1651 Filter an input pipe. Only objects where an expression evaluates to true
1646 (and doesn't raise an exception) are listed.
1652 (and doesn't raise an exception) are listed.
1647
1653
1648 Examples:
1654 Examples:
1649
1655
1650 >>> ils | ifilter("_.isfile() and size>1000")
1656 >>> ils | ifilter("_.isfile() and size>1000")
1651 >>> igrp | ifilter("len(mem)")
1657 >>> igrp | ifilter("len(mem)")
1652 >>> sys.modules | ifilter(lambda _:_.value is not None)
1658 >>> sys.modules | ifilter(lambda _:_.value is not None)
1653 """
1659 """
1654
1660
1655 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1661 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1656 """
1662 """
1657 Create an ``ifilter`` object. ``expr`` can be a callable or a string
1663 Create an ``ifilter`` object. ``expr`` can be a callable or a string
1658 containing an expression. ``globals`` will be used as the global
1664 containing an expression. ``globals`` will be used as the global
1659 namespace for calling string expressions (defaulting to IPython's
1665 namespace for calling string expressions (defaulting to IPython's
1660 user namespace). ``errors`` specifies how exception during evaluation
1666 user namespace). ``errors`` specifies how exception during evaluation
1661 of ``expr`` are handled:
1667 of ``expr`` are handled:
1662
1668
1663 * ``drop``: drop all items that have errors;
1669 * ``drop``: drop all items that have errors;
1664
1670
1665 * ``keep``: keep all items that have errors;
1671 * ``keep``: keep all items that have errors;
1666
1672
1667 * ``keeperror``: keep the exception of all items that have errors;
1673 * ``keeperror``: keep the exception of all items that have errors;
1668
1674
1669 * ``raise``: raise the exception;
1675 * ``raise``: raise the exception;
1670
1676
1671 * ``raiseifallfail``: raise the first exception if all items have errors;
1677 * ``raiseifallfail``: raise the first exception if all items have errors;
1672 otherwise drop those with errors (this is the default).
1678 otherwise drop those with errors (this is the default).
1673 """
1679 """
1674 self.expr = expr
1680 self.expr = expr
1675 self.globals = globals
1681 self.globals = globals
1676 self.errors = errors
1682 self.errors = errors
1677
1683
1678 def __iter__(self):
1684 def __iter__(self):
1679 if callable(self.expr):
1685 if callable(self.expr):
1680 test = self.expr
1686 test = self.expr
1681 else:
1687 else:
1682 g = getglobals(self.globals)
1688 g = getglobals(self.globals)
1683 expr = compile(self.expr, "ipipe-expression", "eval")
1689 expr = compile(self.expr, "ipipe-expression", "eval")
1684 def test(item):
1690 def test(item):
1685 return eval(expr, g, AttrNamespace(item))
1691 return eval(expr, g, AttrNamespace(item))
1686
1692
1687 ok = 0
1693 ok = 0
1688 exc_info = None
1694 exc_info = None
1689 for item in xiter(self.input):
1695 for item in xiter(self.input):
1690 try:
1696 try:
1691 if test(item):
1697 if test(item):
1692 yield item
1698 yield item
1693 ok += 1
1699 ok += 1
1694 except (KeyboardInterrupt, SystemExit):
1700 except (KeyboardInterrupt, SystemExit):
1695 raise
1701 raise
1696 except Exception, exc:
1702 except Exception, exc:
1697 if self.errors == "drop":
1703 if self.errors == "drop":
1698 pass # Ignore errors
1704 pass # Ignore errors
1699 elif self.errors == "keep":
1705 elif self.errors == "keep":
1700 yield item
1706 yield item
1701 elif self.errors == "keeperror":
1707 elif self.errors == "keeperror":
1702 yield exc
1708 yield exc
1703 elif self.errors == "raise":
1709 elif self.errors == "raise":
1704 raise
1710 raise
1705 elif self.errors == "raiseifallfail":
1711 elif self.errors == "raiseifallfail":
1706 if exc_info is None:
1712 if exc_info is None:
1707 exc_info = sys.exc_info()
1713 exc_info = sys.exc_info()
1708 if not ok and exc_info is not None:
1714 if not ok and exc_info is not None:
1709 raise exc_info[0], exc_info[1], exc_info[2]
1715 raise exc_info[0], exc_info[1], exc_info[2]
1710
1716
1711 def __xrepr__(self, mode="default"):
1717 def __xrepr__(self, mode="default"):
1712 if mode == "header" or mode == "footer":
1718 if mode == "header" or mode == "footer":
1713 input = getattr(self, "input", None)
1719 input = getattr(self, "input", None)
1714 if input is not None:
1720 if input is not None:
1715 for part in xrepr(input, mode):
1721 for part in xrepr(input, mode):
1716 yield part
1722 yield part
1717 yield (astyle.style_default, " | ")
1723 yield (astyle.style_default, " | ")
1718 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1724 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1719 for part in xrepr(self.expr, "default"):
1725 for part in xrepr(self.expr, "default"):
1720 yield part
1726 yield part
1721 yield (astyle.style_default, ")")
1727 yield (astyle.style_default, ")")
1722 else:
1728 else:
1723 yield (astyle.style_default, repr(self))
1729 yield (astyle.style_default, repr(self))
1724
1730
1725 def __repr__(self):
1731 def __repr__(self):
1726 return "<%s.%s expr=%r at 0x%x>" % \
1732 return "<%s.%s expr=%r at 0x%x>" % \
1727 (self.__class__.__module__, self.__class__.__name__,
1733 (self.__class__.__module__, self.__class__.__name__,
1728 self.expr, id(self))
1734 self.expr, id(self))
1729
1735
1730
1736
1731 class ieval(Pipe):
1737 class ieval(Pipe):
1732 """
1738 """
1733 Evaluate an expression for each object in the input pipe.
1739 Evaluate an expression for each object in the input pipe.
1734
1740
1735 Examples:
1741 Examples:
1736
1742
1737 >>> ils | ieval("_.abspath()")
1743 >>> ils | ieval("_.abspath()")
1738 >>> sys.path | ieval(ifile)
1744 >>> sys.path | ieval(ifile)
1739 """
1745 """
1740
1746
1741 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1747 def __init__(self, expr, globals=None, errors="raiseifallfail"):
1742 """
1748 """
1743 Create an ``ieval`` object. ``expr`` can be a callable or a string
1749 Create an ``ieval`` object. ``expr`` can be a callable or a string
1744 containing an expression. For the meaning of ``globals`` and
1750 containing an expression. For the meaning of ``globals`` and
1745 ``errors`` see ``ifilter``.
1751 ``errors`` see ``ifilter``.
1746 """
1752 """
1747 self.expr = expr
1753 self.expr = expr
1748 self.globals = globals
1754 self.globals = globals
1749 self.errors = errors
1755 self.errors = errors
1750
1756
1751 def __iter__(self):
1757 def __iter__(self):
1752 if callable(self.expr):
1758 if callable(self.expr):
1753 do = self.expr
1759 do = self.expr
1754 else:
1760 else:
1755 g = getglobals(self.globals)
1761 g = getglobals(self.globals)
1756 expr = compile(self.expr, "ipipe-expression", "eval")
1762 expr = compile(self.expr, "ipipe-expression", "eval")
1757 def do(item):
1763 def do(item):
1758 return eval(expr, g, AttrNamespace(item))
1764 return eval(expr, g, AttrNamespace(item))
1759
1765
1760 ok = 0
1766 ok = 0
1761 exc_info = None
1767 exc_info = None
1762 for item in xiter(self.input):
1768 for item in xiter(self.input):
1763 try:
1769 try:
1764 yield do(item)
1770 yield do(item)
1765 except (KeyboardInterrupt, SystemExit):
1771 except (KeyboardInterrupt, SystemExit):
1766 raise
1772 raise
1767 except Exception, exc:
1773 except Exception, exc:
1768 if self.errors == "drop":
1774 if self.errors == "drop":
1769 pass # Ignore errors
1775 pass # Ignore errors
1770 elif self.errors == "keep":
1776 elif self.errors == "keep":
1771 yield item
1777 yield item
1772 elif self.errors == "keeperror":
1778 elif self.errors == "keeperror":
1773 yield exc
1779 yield exc
1774 elif self.errors == "raise":
1780 elif self.errors == "raise":
1775 raise
1781 raise
1776 elif self.errors == "raiseifallfail":
1782 elif self.errors == "raiseifallfail":
1777 if exc_info is None:
1783 if exc_info is None:
1778 exc_info = sys.exc_info()
1784 exc_info = sys.exc_info()
1779 if not ok and exc_info is not None:
1785 if not ok and exc_info is not None:
1780 raise exc_info[0], exc_info[1], exc_info[2]
1786 raise exc_info[0], exc_info[1], exc_info[2]
1781
1787
1782 def __xrepr__(self, mode="default"):
1788 def __xrepr__(self, mode="default"):
1783 if mode == "header" or mode == "footer":
1789 if mode == "header" or mode == "footer":
1784 input = getattr(self, "input", None)
1790 input = getattr(self, "input", None)
1785 if input is not None:
1791 if input is not None:
1786 for part in xrepr(input, mode):
1792 for part in xrepr(input, mode):
1787 yield part
1793 yield part
1788 yield (astyle.style_default, " | ")
1794 yield (astyle.style_default, " | ")
1789 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1795 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1790 for part in xrepr(self.expr, "default"):
1796 for part in xrepr(self.expr, "default"):
1791 yield part
1797 yield part
1792 yield (astyle.style_default, ")")
1798 yield (astyle.style_default, ")")
1793 else:
1799 else:
1794 yield (astyle.style_default, repr(self))
1800 yield (astyle.style_default, repr(self))
1795
1801
1796 def __repr__(self):
1802 def __repr__(self):
1797 return "<%s.%s expr=%r at 0x%x>" % \
1803 return "<%s.%s expr=%r at 0x%x>" % \
1798 (self.__class__.__module__, self.__class__.__name__,
1804 (self.__class__.__module__, self.__class__.__name__,
1799 self.expr, id(self))
1805 self.expr, id(self))
1800
1806
1801
1807
1802 class ienum(Pipe):
1808 class ienum(Pipe):
1803 """
1809 """
1804 Enumerate the input pipe (i.e. wrap each input object in an object
1810 Enumerate the input pipe (i.e. wrap each input object in an object
1805 with ``index`` and ``object`` attributes).
1811 with ``index`` and ``object`` attributes).
1806
1812
1807 Examples:
1813 Examples:
1808
1814
1809 >>> xrange(20) | ieval("_,_*_") | ienum | ifilter("index % 2 == 0") | ieval("object")
1815 >>> xrange(20) | ieval("_,_*_") | ienum | ifilter("index % 2 == 0") | ieval("object")
1810 """
1816 """
1811 def __iter__(self):
1817 def __iter__(self):
1812 fields = ("index", "object")
1818 fields = ("index", "object")
1813 for (index, object) in enumerate(xiter(self.input)):
1819 for (index, object) in enumerate(xiter(self.input)):
1814 yield Fields(fields, index=index, object=object)
1820 yield Fields(fields, index=index, object=object)
1815
1821
1816
1822
1817 class isort(Pipe):
1823 class isort(Pipe):
1818 """
1824 """
1819 Sorts the input pipe.
1825 Sorts the input pipe.
1820
1826
1821 Examples:
1827 Examples:
1822
1828
1823 >>> ils | isort("size")
1829 >>> ils | isort("size")
1824 >>> ils | isort("_.isdir(), _.lower()", reverse=True)
1830 >>> ils | isort("_.isdir(), _.lower()", reverse=True)
1825 """
1831 """
1826
1832
1827 def __init__(self, key=None, globals=None, reverse=False):
1833 def __init__(self, key=None, globals=None, reverse=False):
1828 """
1834 """
1829 Create an ``isort`` object. ``key`` can be a callable or a string
1835 Create an ``isort`` object. ``key`` can be a callable or a string
1830 containing an expression (or ``None`` in which case the items
1836 containing an expression (or ``None`` in which case the items
1831 themselves will be sorted). If ``reverse`` is true the sort order
1837 themselves will be sorted). If ``reverse`` is true the sort order
1832 will be reversed. For the meaning of ``globals`` see ``ifilter``.
1838 will be reversed. For the meaning of ``globals`` see ``ifilter``.
1833 """
1839 """
1834 self.key = key
1840 self.key = key
1835 self.globals = globals
1841 self.globals = globals
1836 self.reverse = reverse
1842 self.reverse = reverse
1837
1843
1838 def __iter__(self):
1844 def __iter__(self):
1839 if self.key is None:
1845 if self.key is None:
1840 items = sorted(xiter(self.input), reverse=self.reverse)
1846 items = sorted(xiter(self.input), reverse=self.reverse)
1841 elif callable(self.key):
1847 elif callable(self.key):
1842 items = sorted(xiter(self.input), key=self.key, reverse=self.reverse)
1848 items = sorted(xiter(self.input), key=self.key, reverse=self.reverse)
1843 else:
1849 else:
1844 g = getglobals(self.globals)
1850 g = getglobals(self.globals)
1845 key = compile(self.key, "ipipe-expression", "eval")
1851 key = compile(self.key, "ipipe-expression", "eval")
1846 def realkey(item):
1852 def realkey(item):
1847 return eval(key, g, AttrNamespace(item))
1853 return eval(key, g, AttrNamespace(item))
1848 items = sorted(xiter(self.input), key=realkey, reverse=self.reverse)
1854 items = sorted(xiter(self.input), key=realkey, reverse=self.reverse)
1849 for item in items:
1855 for item in items:
1850 yield item
1856 yield item
1851
1857
1852 def __xrepr__(self, mode="default"):
1858 def __xrepr__(self, mode="default"):
1853 if mode == "header" or mode == "footer":
1859 if mode == "header" or mode == "footer":
1854 input = getattr(self, "input", None)
1860 input = getattr(self, "input", None)
1855 if input is not None:
1861 if input is not None:
1856 for part in xrepr(input, mode):
1862 for part in xrepr(input, mode):
1857 yield part
1863 yield part
1858 yield (astyle.style_default, " | ")
1864 yield (astyle.style_default, " | ")
1859 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1865 yield (astyle.style_default, "%s(" % self.__class__.__name__)
1860 for part in xrepr(self.key, "default"):
1866 for part in xrepr(self.key, "default"):
1861 yield part
1867 yield part
1862 if self.reverse:
1868 if self.reverse:
1863 yield (astyle.style_default, ", ")
1869 yield (astyle.style_default, ", ")
1864 for part in xrepr(True, "default"):
1870 for part in xrepr(True, "default"):
1865 yield part
1871 yield part
1866 yield (astyle.style_default, ")")
1872 yield (astyle.style_default, ")")
1867 else:
1873 else:
1868 yield (astyle.style_default, repr(self))
1874 yield (astyle.style_default, repr(self))
1869
1875
1870 def __repr__(self):
1876 def __repr__(self):
1871 return "<%s.%s key=%r reverse=%r at 0x%x>" % \
1877 return "<%s.%s key=%r reverse=%r at 0x%x>" % \
1872 (self.__class__.__module__, self.__class__.__name__,
1878 (self.__class__.__module__, self.__class__.__name__,
1873 self.key, self.reverse, id(self))
1879 self.key, self.reverse, id(self))
1874
1880
1875
1881
1876 tab = 3 # for expandtabs()
1882 tab = 3 # for expandtabs()
1877
1883
1878 def _format(field):
1884 def _format(field):
1879 if isinstance(field, str):
1885 if isinstance(field, str):
1880 text = repr(field.expandtabs(tab))[1:-1]
1886 text = repr(field.expandtabs(tab))[1:-1]
1881 elif isinstance(field, unicode):
1887 elif isinstance(field, unicode):
1882 text = repr(field.expandtabs(tab))[2:-1]
1888 text = repr(field.expandtabs(tab))[2:-1]
1883 elif isinstance(field, datetime.datetime):
1889 elif isinstance(field, datetime.datetime):
1884 # Don't use strftime() here, as this requires year >= 1900
1890 # Don't use strftime() here, as this requires year >= 1900
1885 text = "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
1891 text = "%04d-%02d-%02d %02d:%02d:%02d.%06d" % \
1886 (field.year, field.month, field.day,
1892 (field.year, field.month, field.day,
1887 field.hour, field.minute, field.second, field.microsecond)
1893 field.hour, field.minute, field.second, field.microsecond)
1888 elif isinstance(field, datetime.date):
1894 elif isinstance(field, datetime.date):
1889 text = "%04d-%02d-%02d" % (field.year, field.month, field.day)
1895 text = "%04d-%02d-%02d" % (field.year, field.month, field.day)
1890 else:
1896 else:
1891 text = repr(field)
1897 text = repr(field)
1892 return text
1898 return text
1893
1899
1894
1900
1895 class Display(object):
1901 class Display(object):
1896 class __metaclass__(type):
1902 class __metaclass__(type):
1897 def __ror__(self, input):
1903 def __ror__(self, input):
1898 return input | self()
1904 return input | self()
1899
1905
1900 def __ror__(self, input):
1906 def __ror__(self, input):
1901 self.input = input
1907 self.input = input
1902 return self
1908 return self
1903
1909
1904 def display(self):
1910 def display(self):
1905 pass
1911 pass
1906
1912
1907
1913
1908 class iless(Display):
1914 class iless(Display):
1909 cmd = "less --quit-if-one-screen --LONG-PROMPT --LINE-NUMBERS --chop-long-lines --shift=8 --RAW-CONTROL-CHARS"
1915 cmd = "less --quit-if-one-screen --LONG-PROMPT --LINE-NUMBERS --chop-long-lines --shift=8 --RAW-CONTROL-CHARS"
1910
1916
1911 def display(self):
1917 def display(self):
1912 try:
1918 try:
1913 pager = os.popen(self.cmd, "w")
1919 pager = os.popen(self.cmd, "w")
1914 try:
1920 try:
1915 for item in xiter(self.input):
1921 for item in xiter(self.input):
1916 first = False
1922 first = False
1917 for attr in xattrs(item, "default"):
1923 for attr in xattrs(item, "default"):
1918 if first:
1924 if first:
1919 first = False
1925 first = False
1920 else:
1926 else:
1921 pager.write(" ")
1927 pager.write(" ")
1922 attr = upgradexattr(attr)
1928 attr = upgradexattr(attr)
1923 if not isinstance(attr, SelfDescriptor):
1929 if not isinstance(attr, SelfDescriptor):
1924 pager.write(attr.name())
1930 pager.write(attr.name())
1925 pager.write("=")
1931 pager.write("=")
1926 pager.write(str(attr.value(item)))
1932 pager.write(str(attr.value(item)))
1927 pager.write("\n")
1933 pager.write("\n")
1928 finally:
1934 finally:
1929 pager.close()
1935 pager.close()
1930 except Exception, exc:
1936 except Exception, exc:
1931 print "%s: %s" % (exc.__class__.__name__, str(exc))
1937 print "%s: %s" % (exc.__class__.__name__, str(exc))
1932
1938
1933
1939
1934 def xformat(value, mode, maxlength):
1940 def xformat(value, mode, maxlength):
1935 align = None
1941 align = None
1936 full = True
1942 full = True
1937 width = 0
1943 width = 0
1938 text = astyle.Text()
1944 text = astyle.Text()
1939 for (style, part) in xrepr(value, mode):
1945 for (style, part) in xrepr(value, mode):
1940 # only consider the first result
1946 # only consider the first result
1941 if align is None:
1947 if align is None:
1942 if isinstance(style, int):
1948 if isinstance(style, int):
1943 # (style, text) really is (alignment, stop)
1949 # (style, text) really is (alignment, stop)
1944 align = style
1950 align = style
1945 full = part
1951 full = part
1946 continue
1952 continue
1947 else:
1953 else:
1948 align = -1
1954 align = -1
1949 full = True
1955 full = True
1950 if not isinstance(style, int):
1956 if not isinstance(style, int):
1951 text.append((style, part))
1957 text.append((style, part))
1952 width += len(part)
1958 width += len(part)
1953 if width >= maxlength and not full:
1959 if width >= maxlength and not full:
1954 text.append((astyle.style_ellisis, "..."))
1960 text.append((astyle.style_ellisis, "..."))
1955 width += 3
1961 width += 3
1956 break
1962 break
1957 if align is None: # default to left alignment
1963 if align is None: # default to left alignment
1958 align = -1
1964 align = -1
1959 return (align, width, text)
1965 return (align, width, text)
1960
1966
1961
1967
1962 class idump(Display):
1968 class idump(Display):
1963 # The approximate maximum length of a column entry
1969 # The approximate maximum length of a column entry
1964 maxattrlength = 200
1970 maxattrlength = 200
1965
1971
1966 # Style for column names
1972 # Style for column names
1967 style_header = astyle.Style.fromstr("white:black:bold")
1973 style_header = astyle.Style.fromstr("white:black:bold")
1968
1974
1969 def __init__(self, *attrs):
1975 def __init__(self, *attrs):
1970 self.attrs = [upgradexattr(attr) for attr in attrs]
1976 self.attrs = [upgradexattr(attr) for attr in attrs]
1971 self.headerpadchar = " "
1977 self.headerpadchar = " "
1972 self.headersepchar = "|"
1978 self.headersepchar = "|"
1973 self.datapadchar = " "
1979 self.datapadchar = " "
1974 self.datasepchar = "|"
1980 self.datasepchar = "|"
1975
1981
1976 def display(self):
1982 def display(self):
1977 stream = genutils.Term.cout
1983 stream = genutils.Term.cout
1978 allattrs = []
1984 allattrs = []
1979 attrset = set()
1985 attrset = set()
1980 colwidths = {}
1986 colwidths = {}
1981 rows = []
1987 rows = []
1982 for item in xiter(self.input):
1988 for item in xiter(self.input):
1983 row = {}
1989 row = {}
1984 attrs = self.attrs
1990 attrs = self.attrs
1985 if not attrs:
1991 if not attrs:
1986 attrs = xattrs(item, "default")
1992 attrs = xattrs(item, "default")
1987 for attr in attrs:
1993 for attr in attrs:
1988 if attr not in attrset:
1994 if attr not in attrset:
1989 allattrs.append(attr)
1995 allattrs.append(attr)
1990 attrset.add(attr)
1996 attrset.add(attr)
1991 colwidths[attr] = len(attr.name())
1997 colwidths[attr] = len(attr.name())
1992 try:
1998 try:
1993 value = attr.value(item)
1999 value = attr.value(item)
1994 except (KeyboardInterrupt, SystemExit):
2000 except (KeyboardInterrupt, SystemExit):
1995 raise
2001 raise
1996 except Exception, exc:
2002 except Exception, exc:
1997 value = exc
2003 value = exc
1998 (align, width, text) = xformat(value, "cell", self.maxattrlength)
2004 (align, width, text) = xformat(value, "cell", self.maxattrlength)
1999 colwidths[attr] = max(colwidths[attr], width)
2005 colwidths[attr] = max(colwidths[attr], width)
2000 # remember alignment, length and colored parts
2006 # remember alignment, length and colored parts
2001 row[attr] = (align, width, text)
2007 row[attr] = (align, width, text)
2002 rows.append(row)
2008 rows.append(row)
2003
2009
2004 stream.write("\n")
2010 stream.write("\n")
2005 for (i, attr) in enumerate(allattrs):
2011 for (i, attr) in enumerate(allattrs):
2006 attrname = attr.name()
2012 attrname = attr.name()
2007 self.style_header(attrname).write(stream)
2013 self.style_header(attrname).write(stream)
2008 spc = colwidths[attr] - len(attrname)
2014 spc = colwidths[attr] - len(attrname)
2009 if i < len(colwidths)-1:
2015 if i < len(colwidths)-1:
2010 stream.write(self.headerpadchar*spc)
2016 stream.write(self.headerpadchar*spc)
2011 stream.write(self.headersepchar)
2017 stream.write(self.headersepchar)
2012 stream.write("\n")
2018 stream.write("\n")
2013
2019
2014 for row in rows:
2020 for row in rows:
2015 for (i, attr) in enumerate(allattrs):
2021 for (i, attr) in enumerate(allattrs):
2016 (align, width, text) = row[attr]
2022 (align, width, text) = row[attr]
2017 spc = colwidths[attr] - width
2023 spc = colwidths[attr] - width
2018 if align == -1:
2024 if align == -1:
2019 text.write(stream)
2025 text.write(stream)
2020 if i < len(colwidths)-1:
2026 if i < len(colwidths)-1:
2021 stream.write(self.datapadchar*spc)
2027 stream.write(self.datapadchar*spc)
2022 elif align == 0:
2028 elif align == 0:
2023 spc = colwidths[attr] - width
2029 spc = colwidths[attr] - width
2024 spc1 = spc//2
2030 spc1 = spc//2
2025 spc2 = spc-spc1
2031 spc2 = spc-spc1
2026 stream.write(self.datapadchar*spc1)
2032 stream.write(self.datapadchar*spc1)
2027 text.write(stream)
2033 text.write(stream)
2028 if i < len(colwidths)-1:
2034 if i < len(colwidths)-1:
2029 stream.write(self.datapadchar*spc2)
2035 stream.write(self.datapadchar*spc2)
2030 else:
2036 else:
2031 stream.write(self.datapadchar*spc)
2037 stream.write(self.datapadchar*spc)
2032 text.write(stream)
2038 text.write(stream)
2033 if i < len(colwidths)-1:
2039 if i < len(colwidths)-1:
2034 stream.write(self.datasepchar)
2040 stream.write(self.datasepchar)
2035 stream.write("\n")
2041 stream.write("\n")
2036
2042
2037
2043
2038 class AttributeDetail(Table):
2044 class AttributeDetail(Table):
2039 """
2045 """
2040 ``AttributeDetail`` objects are use for displaying a detailed list of object
2046 ``AttributeDetail`` objects are use for displaying a detailed list of object
2041 attributes.
2047 attributes.
2042 """
2048 """
2043 def __init__(self, object, descriptor):
2049 def __init__(self, object, descriptor):
2044 self.object = object
2050 self.object = object
2045 self.descriptor = descriptor
2051 self.descriptor = descriptor
2046
2052
2047 def __iter__(self):
2053 def __iter__(self):
2048 return self.descriptor.iter(self.object)
2054 return self.descriptor.iter(self.object)
2049
2055
2050 def name(self):
2056 def name(self):
2051 return self.descriptor.name()
2057 return self.descriptor.name()
2052
2058
2053 def attrtype(self):
2059 def attrtype(self):
2054 return self.descriptor.attrtype(self.object)
2060 return self.descriptor.attrtype(self.object)
2055
2061
2056 def valuetype(self):
2062 def valuetype(self):
2057 return self.descriptor.valuetype(self.object)
2063 return self.descriptor.valuetype(self.object)
2058
2064
2059 def doc(self):
2065 def doc(self):
2060 return self.descriptor.doc(self.object)
2066 return self.descriptor.doc(self.object)
2061
2067
2062 def shortdoc(self):
2068 def shortdoc(self):
2063 return self.descriptor.shortdoc(self.object)
2069 return self.descriptor.shortdoc(self.object)
2064
2070
2065 def value(self):
2071 def value(self):
2066 return self.descriptor.value(self.object)
2072 return self.descriptor.value(self.object)
2067
2073
2068 def __xattrs__(self, mode="default"):
2074 def __xattrs__(self, mode="default"):
2069 attrs = ("name()", "attrtype()", "valuetype()", "value()", "shortdoc()")
2075 attrs = ("name()", "attrtype()", "valuetype()", "value()", "shortdoc()")
2070 if mode == "detail":
2076 if mode == "detail":
2071 attrs += ("doc()",)
2077 attrs += ("doc()",)
2072 return attrs
2078 return attrs
2073
2079
2074 def __xrepr__(self, mode="default"):
2080 def __xrepr__(self, mode="default"):
2075 yield (-1, True)
2081 yield (-1, True)
2076 valuetype = self.valuetype()
2082 valuetype = self.valuetype()
2077 if valuetype is not noitem:
2083 if valuetype is not noitem:
2078 for part in xrepr(valuetype):
2084 for part in xrepr(valuetype):
2079 yield part
2085 yield part
2080 yield (astyle.style_default, " ")
2086 yield (astyle.style_default, " ")
2081 yield (astyle.style_default, self.attrtype())
2087 yield (astyle.style_default, self.attrtype())
2082 yield (astyle.style_default, " ")
2088 yield (astyle.style_default, " ")
2083 yield (astyle.style_default, self.name())
2089 yield (astyle.style_default, self.name())
2084 yield (astyle.style_default, " of ")
2090 yield (astyle.style_default, " of ")
2085 for part in xrepr(self.object):
2091 for part in xrepr(self.object):
2086 yield part
2092 yield part
2087
2093
2088
2094
2089 try:
2095 try:
2090 from ibrowse import ibrowse
2096 from ibrowse import ibrowse
2091 except ImportError:
2097 except ImportError:
2092 # No curses (probably Windows) => use ``idump`` as the default display.
2098 # No curses (probably Windows) => use ``idump`` as the default display.
2093 defaultdisplay = idump
2099 defaultdisplay = idump
2094 else:
2100 else:
2095 defaultdisplay = ibrowse
2101 defaultdisplay = ibrowse
2096 __all__.append("ibrowse")
2102 __all__.append("ibrowse")
2097
2103
2098
2104
2099 # If we're running under IPython, install an IPython displayhook that
2105 # If we're running under IPython, install an IPython displayhook that
2100 # returns the object from Display.display(), else install a displayhook
2106 # returns the object from Display.display(), else install a displayhook
2101 # directly as sys.displayhook
2107 # directly as sys.displayhook
2102 api = None
2108 api = None
2103 if ipapi is not None:
2109 if ipapi is not None:
2104 try:
2110 try:
2105 api = ipapi.get()
2111 api = ipapi.get()
2106 except AttributeError:
2112 except AttributeError:
2107 pass
2113 pass
2108
2114
2109 if api is not None:
2115 if api is not None:
2110 def displayhook(self, obj):
2116 def displayhook(self, obj):
2111 if isinstance(obj, type) and issubclass(obj, Table):
2117 if isinstance(obj, type) and issubclass(obj, Table):
2112 obj = obj()
2118 obj = obj()
2113 if isinstance(obj, Table):
2119 if isinstance(obj, Table):
2114 obj = obj | defaultdisplay
2120 obj = obj | defaultdisplay
2115 if isinstance(obj, Display):
2121 if isinstance(obj, Display):
2116 return obj.display()
2122 return obj.display()
2117 else:
2123 else:
2118 raise ipapi.TryNext
2124 raise ipapi.TryNext
2119 api.set_hook("result_display", displayhook)
2125 api.set_hook("result_display", displayhook)
2120 else:
2126 else:
2121 def installdisplayhook():
2127 def installdisplayhook():
2122 _originalhook = sys.displayhook
2128 _originalhook = sys.displayhook
2123 def displayhook(obj):
2129 def displayhook(obj):
2124 if isinstance(obj, type) and issubclass(obj, Table):
2130 if isinstance(obj, type) and issubclass(obj, Table):
2125 obj = obj()
2131 obj = obj()
2126 if isinstance(obj, Table):
2132 if isinstance(obj, Table):
2127 obj = obj | defaultdisplay
2133 obj = obj | defaultdisplay
2128 if isinstance(obj, Display):
2134 if isinstance(obj, Display):
2129 return obj.display()
2135 return obj.display()
2130 else:
2136 else:
2131 _originalhook(obj)
2137 _originalhook(obj)
2132 sys.displayhook = displayhook
2138 sys.displayhook = displayhook
2133 installdisplayhook()
2139 installdisplayhook()
@@ -1,6162 +1,6172 b''
1 2007-01-23 Walter Doerwald <walter@livinglogic.de>
2
3 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
4 a string containing a single line yields the string itself as the
5 only item.
6
7 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
8 object if it's the same as the one on the last level (This avoids
9 infinite recursion for one line strings).
10
1 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
11 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2
12
3 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
13 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
4 all output streams before printing tracebacks. This ensures that
14 all output streams before printing tracebacks. This ensures that
5 user output doesn't end up interleaved with traceback output.
15 user output doesn't end up interleaved with traceback output.
6
16
7 2007-01-10 Ville Vainio <vivainio@gmail.com>
17 2007-01-10 Ville Vainio <vivainio@gmail.com>
8
18
9 * Extensions/envpersist.py: Turbocharged %env that remembers
19 * Extensions/envpersist.py: Turbocharged %env that remembers
10 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
20 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
11 "%env VISUAL=jed".
21 "%env VISUAL=jed".
12
22
13 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
23 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
14
24
15 * IPython/iplib.py (showtraceback): ensure that we correctly call
25 * IPython/iplib.py (showtraceback): ensure that we correctly call
16 custom handlers in all cases (some with pdb were slipping through,
26 custom handlers in all cases (some with pdb were slipping through,
17 but I'm not exactly sure why).
27 but I'm not exactly sure why).
18
28
19 * IPython/Debugger.py (Tracer.__init__): added new class to
29 * IPython/Debugger.py (Tracer.__init__): added new class to
20 support set_trace-like usage of IPython's enhanced debugger.
30 support set_trace-like usage of IPython's enhanced debugger.
21
31
22 2006-12-24 Ville Vainio <vivainio@gmail.com>
32 2006-12-24 Ville Vainio <vivainio@gmail.com>
23
33
24 * ipmaker.py: more informative message when ipy_user_conf
34 * ipmaker.py: more informative message when ipy_user_conf
25 import fails (suggest running %upgrade).
35 import fails (suggest running %upgrade).
26
36
27 * tools/run_ipy_in_profiler.py: Utility to see where
37 * tools/run_ipy_in_profiler.py: Utility to see where
28 the time during IPython startup is spent.
38 the time during IPython startup is spent.
29
39
30 2006-12-20 Ville Vainio <vivainio@gmail.com>
40 2006-12-20 Ville Vainio <vivainio@gmail.com>
31
41
32 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
42 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
33
43
34 * ipapi.py: Add new ipapi method, expand_alias.
44 * ipapi.py: Add new ipapi method, expand_alias.
35
45
36 * Release.py: Bump up version to 0.7.4.svn
46 * Release.py: Bump up version to 0.7.4.svn
37
47
38 2006-12-17 Ville Vainio <vivainio@gmail.com>
48 2006-12-17 Ville Vainio <vivainio@gmail.com>
39
49
40 * Extensions/jobctrl.py: Fixed &cmd arg arg...
50 * Extensions/jobctrl.py: Fixed &cmd arg arg...
41 to work properly on posix too
51 to work properly on posix too
42
52
43 * Release.py: Update revnum (version is still just 0.7.3).
53 * Release.py: Update revnum (version is still just 0.7.3).
44
54
45 2006-12-15 Ville Vainio <vivainio@gmail.com>
55 2006-12-15 Ville Vainio <vivainio@gmail.com>
46
56
47 * scripts/ipython_win_post_install: create ipython.py in
57 * scripts/ipython_win_post_install: create ipython.py in
48 prefix + "/scripts".
58 prefix + "/scripts".
49
59
50 * Release.py: Update version to 0.7.3.
60 * Release.py: Update version to 0.7.3.
51
61
52 2006-12-14 Ville Vainio <vivainio@gmail.com>
62 2006-12-14 Ville Vainio <vivainio@gmail.com>
53
63
54 * scripts/ipython_win_post_install: Overwrite old shortcuts
64 * scripts/ipython_win_post_install: Overwrite old shortcuts
55 if they already exist
65 if they already exist
56
66
57 * Release.py: release 0.7.3rc2
67 * Release.py: release 0.7.3rc2
58
68
59 2006-12-13 Ville Vainio <vivainio@gmail.com>
69 2006-12-13 Ville Vainio <vivainio@gmail.com>
60
70
61 * Branch and update Release.py for 0.7.3rc1
71 * Branch and update Release.py for 0.7.3rc1
62
72
63 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
73 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
64
74
65 * IPython/Shell.py (IPShellWX): update for current WX naming
75 * IPython/Shell.py (IPShellWX): update for current WX naming
66 conventions, to avoid a deprecation warning with current WX
76 conventions, to avoid a deprecation warning with current WX
67 versions. Thanks to a report by Danny Shevitz.
77 versions. Thanks to a report by Danny Shevitz.
68
78
69 2006-12-12 Ville Vainio <vivainio@gmail.com>
79 2006-12-12 Ville Vainio <vivainio@gmail.com>
70
80
71 * ipmaker.py: apply david cournapeau's patch to make
81 * ipmaker.py: apply david cournapeau's patch to make
72 import_some work properly even when ipythonrc does
82 import_some work properly even when ipythonrc does
73 import_some on empty list (it was an old bug!).
83 import_some on empty list (it was an old bug!).
74
84
75 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
85 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
76 Add deprecation note to ipythonrc and a url to wiki
86 Add deprecation note to ipythonrc and a url to wiki
77 in ipy_user_conf.py
87 in ipy_user_conf.py
78
88
79
89
80 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
90 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
81 as if it was typed on IPython command prompt, i.e.
91 as if it was typed on IPython command prompt, i.e.
82 as IPython script.
92 as IPython script.
83
93
84 * example-magic.py, magic_grepl.py: remove outdated examples
94 * example-magic.py, magic_grepl.py: remove outdated examples
85
95
86 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
96 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
87
97
88 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
98 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
89 is called before any exception has occurred.
99 is called before any exception has occurred.
90
100
91 2006-12-08 Ville Vainio <vivainio@gmail.com>
101 2006-12-08 Ville Vainio <vivainio@gmail.com>
92
102
93 * Extensions/ipy_stock_completers.py.py: fix cd completer
103 * Extensions/ipy_stock_completers.py.py: fix cd completer
94 to translate /'s to \'s again.
104 to translate /'s to \'s again.
95
105
96 * completer.py: prevent traceback on file completions w/
106 * completer.py: prevent traceback on file completions w/
97 backslash.
107 backslash.
98
108
99 * Release.py: Update release number to 0.7.3b3 for release
109 * Release.py: Update release number to 0.7.3b3 for release
100
110
101 2006-12-07 Ville Vainio <vivainio@gmail.com>
111 2006-12-07 Ville Vainio <vivainio@gmail.com>
102
112
103 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
113 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
104 while executing external code. Provides more shell-like behaviour
114 while executing external code. Provides more shell-like behaviour
105 and overall better response to ctrl + C / ctrl + break.
115 and overall better response to ctrl + C / ctrl + break.
106
116
107 * tools/make_tarball.py: new script to create tarball straight from svn
117 * tools/make_tarball.py: new script to create tarball straight from svn
108 (setup.py sdist doesn't work on win32).
118 (setup.py sdist doesn't work on win32).
109
119
110 * Extensions/ipy_stock_completers.py: fix cd completer to give up
120 * Extensions/ipy_stock_completers.py: fix cd completer to give up
111 on dirnames with spaces and use the default completer instead.
121 on dirnames with spaces and use the default completer instead.
112
122
113 * Revision.py: Change version to 0.7.3b2 for release.
123 * Revision.py: Change version to 0.7.3b2 for release.
114
124
115 2006-12-05 Ville Vainio <vivainio@gmail.com>
125 2006-12-05 Ville Vainio <vivainio@gmail.com>
116
126
117 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
127 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
118 pydb patch 4 (rm debug printing, py 2.5 checking)
128 pydb patch 4 (rm debug printing, py 2.5 checking)
119
129
120 2006-11-30 Walter Doerwald <walter@livinglogic.de>
130 2006-11-30 Walter Doerwald <walter@livinglogic.de>
121 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
131 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
122 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
132 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
123 "refreshfind" (mapped to "R") does the same but tries to go back to the same
133 "refreshfind" (mapped to "R") does the same but tries to go back to the same
124 object the cursor was on before the refresh. The command "markrange" is
134 object the cursor was on before the refresh. The command "markrange" is
125 mapped to "%" now.
135 mapped to "%" now.
126 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
136 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
127
137
128 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
138 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
129
139
130 * IPython/Magic.py (magic_debug): new %debug magic to activate the
140 * IPython/Magic.py (magic_debug): new %debug magic to activate the
131 interactive debugger on the last traceback, without having to call
141 interactive debugger on the last traceback, without having to call
132 %pdb and rerun your code. Made minor changes in various modules,
142 %pdb and rerun your code. Made minor changes in various modules,
133 should automatically recognize pydb if available.
143 should automatically recognize pydb if available.
134
144
135 2006-11-28 Ville Vainio <vivainio@gmail.com>
145 2006-11-28 Ville Vainio <vivainio@gmail.com>
136
146
137 * completer.py: If the text start with !, show file completions
147 * completer.py: If the text start with !, show file completions
138 properly. This helps when trying to complete command name
148 properly. This helps when trying to complete command name
139 for shell escapes.
149 for shell escapes.
140
150
141 2006-11-27 Ville Vainio <vivainio@gmail.com>
151 2006-11-27 Ville Vainio <vivainio@gmail.com>
142
152
143 * ipy_stock_completers.py: bzr completer submitted by Stefan van
153 * ipy_stock_completers.py: bzr completer submitted by Stefan van
144 der Walt. Clean up svn and hg completers by using a common
154 der Walt. Clean up svn and hg completers by using a common
145 vcs_completer.
155 vcs_completer.
146
156
147 2006-11-26 Ville Vainio <vivainio@gmail.com>
157 2006-11-26 Ville Vainio <vivainio@gmail.com>
148
158
149 * Remove ipconfig and %config; you should use _ip.options structure
159 * Remove ipconfig and %config; you should use _ip.options structure
150 directly instead!
160 directly instead!
151
161
152 * genutils.py: add wrap_deprecated function for deprecating callables
162 * genutils.py: add wrap_deprecated function for deprecating callables
153
163
154 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
164 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
155 _ip.system instead. ipalias is redundant.
165 _ip.system instead. ipalias is redundant.
156
166
157 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
167 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
158 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
168 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
159 explicit.
169 explicit.
160
170
161 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
171 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
162 completer. Try it by entering 'hg ' and pressing tab.
172 completer. Try it by entering 'hg ' and pressing tab.
163
173
164 * macro.py: Give Macro a useful __repr__ method
174 * macro.py: Give Macro a useful __repr__ method
165
175
166 * Magic.py: %whos abbreviates the typename of Macro for brevity.
176 * Magic.py: %whos abbreviates the typename of Macro for brevity.
167
177
168 2006-11-24 Walter Doerwald <walter@livinglogic.de>
178 2006-11-24 Walter Doerwald <walter@livinglogic.de>
169 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
179 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
170 we don't get a duplicate ipipe module, where registration of the xrepr
180 we don't get a duplicate ipipe module, where registration of the xrepr
171 implementation for Text is useless.
181 implementation for Text is useless.
172
182
173 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
183 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
174
184
175 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
185 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
176
186
177 2006-11-24 Ville Vainio <vivainio@gmail.com>
187 2006-11-24 Ville Vainio <vivainio@gmail.com>
178
188
179 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
189 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
180 try to use "cProfile" instead of the slower pure python
190 try to use "cProfile" instead of the slower pure python
181 "profile"
191 "profile"
182
192
183 2006-11-23 Ville Vainio <vivainio@gmail.com>
193 2006-11-23 Ville Vainio <vivainio@gmail.com>
184
194
185 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
195 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
186 Qt+IPython+Designer link in documentation.
196 Qt+IPython+Designer link in documentation.
187
197
188 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
198 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
189 correct Pdb object to %pydb.
199 correct Pdb object to %pydb.
190
200
191
201
192 2006-11-22 Walter Doerwald <walter@livinglogic.de>
202 2006-11-22 Walter Doerwald <walter@livinglogic.de>
193 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
203 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
194 generic xrepr(), otherwise the list implementation would kick in.
204 generic xrepr(), otherwise the list implementation would kick in.
195
205
196 2006-11-21 Ville Vainio <vivainio@gmail.com>
206 2006-11-21 Ville Vainio <vivainio@gmail.com>
197
207
198 * upgrade_dir.py: Now actually overwrites a nonmodified user file
208 * upgrade_dir.py: Now actually overwrites a nonmodified user file
199 with one from UserConfig.
209 with one from UserConfig.
200
210
201 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
211 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
202 it was missing which broke the sh profile.
212 it was missing which broke the sh profile.
203
213
204 * completer.py: file completer now uses explicit '/' instead
214 * completer.py: file completer now uses explicit '/' instead
205 of os.path.join, expansion of 'foo' was broken on win32
215 of os.path.join, expansion of 'foo' was broken on win32
206 if there was one directory with name 'foobar'.
216 if there was one directory with name 'foobar'.
207
217
208 * A bunch of patches from Kirill Smelkov:
218 * A bunch of patches from Kirill Smelkov:
209
219
210 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
220 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
211
221
212 * [patch 7/9] Implement %page -r (page in raw mode) -
222 * [patch 7/9] Implement %page -r (page in raw mode) -
213
223
214 * [patch 5/9] ScientificPython webpage has moved
224 * [patch 5/9] ScientificPython webpage has moved
215
225
216 * [patch 4/9] The manual mentions %ds, should be %dhist
226 * [patch 4/9] The manual mentions %ds, should be %dhist
217
227
218 * [patch 3/9] Kill old bits from %prun doc.
228 * [patch 3/9] Kill old bits from %prun doc.
219
229
220 * [patch 1/9] Fix typos here and there.
230 * [patch 1/9] Fix typos here and there.
221
231
222 2006-11-08 Ville Vainio <vivainio@gmail.com>
232 2006-11-08 Ville Vainio <vivainio@gmail.com>
223
233
224 * completer.py (attr_matches): catch all exceptions raised
234 * completer.py (attr_matches): catch all exceptions raised
225 by eval of expr with dots.
235 by eval of expr with dots.
226
236
227 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
237 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
228
238
229 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
239 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
230 input if it starts with whitespace. This allows you to paste
240 input if it starts with whitespace. This allows you to paste
231 indented input from any editor without manually having to type in
241 indented input from any editor without manually having to type in
232 the 'if 1:', which is convenient when working interactively.
242 the 'if 1:', which is convenient when working interactively.
233 Slightly modifed version of a patch by Bo Peng
243 Slightly modifed version of a patch by Bo Peng
234 <bpeng-AT-rice.edu>.
244 <bpeng-AT-rice.edu>.
235
245
236 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
246 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
237
247
238 * IPython/irunner.py (main): modified irunner so it automatically
248 * IPython/irunner.py (main): modified irunner so it automatically
239 recognizes the right runner to use based on the extension (.py for
249 recognizes the right runner to use based on the extension (.py for
240 python, .ipy for ipython and .sage for sage).
250 python, .ipy for ipython and .sage for sage).
241
251
242 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
252 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
243 visible in ipapi as ip.config(), to programatically control the
253 visible in ipapi as ip.config(), to programatically control the
244 internal rc object. There's an accompanying %config magic for
254 internal rc object. There's an accompanying %config magic for
245 interactive use, which has been enhanced to match the
255 interactive use, which has been enhanced to match the
246 funtionality in ipconfig.
256 funtionality in ipconfig.
247
257
248 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
258 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
249 so it's not just a toggle, it now takes an argument. Add support
259 so it's not just a toggle, it now takes an argument. Add support
250 for a customizable header when making system calls, as the new
260 for a customizable header when making system calls, as the new
251 system_header variable in the ipythonrc file.
261 system_header variable in the ipythonrc file.
252
262
253 2006-11-03 Walter Doerwald <walter@livinglogic.de>
263 2006-11-03 Walter Doerwald <walter@livinglogic.de>
254
264
255 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
265 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
256 generic functions (using Philip J. Eby's simplegeneric package).
266 generic functions (using Philip J. Eby's simplegeneric package).
257 This makes it possible to customize the display of third-party classes
267 This makes it possible to customize the display of third-party classes
258 without having to monkeypatch them. xiter() no longer supports a mode
268 without having to monkeypatch them. xiter() no longer supports a mode
259 argument and the XMode class has been removed. The same functionality can
269 argument and the XMode class has been removed. The same functionality can
260 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
270 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
261 One consequence of the switch to generic functions is that xrepr() and
271 One consequence of the switch to generic functions is that xrepr() and
262 xattrs() implementation must define the default value for the mode
272 xattrs() implementation must define the default value for the mode
263 argument themselves and xattrs() implementations must return real
273 argument themselves and xattrs() implementations must return real
264 descriptors.
274 descriptors.
265
275
266 * IPython/external: This new subpackage will contain all third-party
276 * IPython/external: This new subpackage will contain all third-party
267 packages that are bundled with IPython. (The first one is simplegeneric).
277 packages that are bundled with IPython. (The first one is simplegeneric).
268
278
269 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
279 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
270 directory which as been dropped in r1703.
280 directory which as been dropped in r1703.
271
281
272 * IPython/Extensions/ipipe.py (iless): Fixed.
282 * IPython/Extensions/ipipe.py (iless): Fixed.
273
283
274 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
284 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
275
285
276 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
286 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
277
287
278 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
288 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
279 handling in variable expansion so that shells and magics recognize
289 handling in variable expansion so that shells and magics recognize
280 function local scopes correctly. Bug reported by Brian.
290 function local scopes correctly. Bug reported by Brian.
281
291
282 * scripts/ipython: remove the very first entry in sys.path which
292 * scripts/ipython: remove the very first entry in sys.path which
283 Python auto-inserts for scripts, so that sys.path under IPython is
293 Python auto-inserts for scripts, so that sys.path under IPython is
284 as similar as possible to that under plain Python.
294 as similar as possible to that under plain Python.
285
295
286 * IPython/completer.py (IPCompleter.file_matches): Fix
296 * IPython/completer.py (IPCompleter.file_matches): Fix
287 tab-completion so that quotes are not closed unless the completion
297 tab-completion so that quotes are not closed unless the completion
288 is unambiguous. After a request by Stefan. Minor cleanups in
298 is unambiguous. After a request by Stefan. Minor cleanups in
289 ipy_stock_completers.
299 ipy_stock_completers.
290
300
291 2006-11-02 Ville Vainio <vivainio@gmail.com>
301 2006-11-02 Ville Vainio <vivainio@gmail.com>
292
302
293 * ipy_stock_completers.py: Add %run and %cd completers.
303 * ipy_stock_completers.py: Add %run and %cd completers.
294
304
295 * completer.py: Try running custom completer for both
305 * completer.py: Try running custom completer for both
296 "foo" and "%foo" if the command is just "foo". Ignore case
306 "foo" and "%foo" if the command is just "foo". Ignore case
297 when filtering possible completions.
307 when filtering possible completions.
298
308
299 * UserConfig/ipy_user_conf.py: install stock completers as default
309 * UserConfig/ipy_user_conf.py: install stock completers as default
300
310
301 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
311 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
302 simplified readline history save / restore through a wrapper
312 simplified readline history save / restore through a wrapper
303 function
313 function
304
314
305
315
306 2006-10-31 Ville Vainio <vivainio@gmail.com>
316 2006-10-31 Ville Vainio <vivainio@gmail.com>
307
317
308 * strdispatch.py, completer.py, ipy_stock_completers.py:
318 * strdispatch.py, completer.py, ipy_stock_completers.py:
309 Allow str_key ("command") in completer hooks. Implement
319 Allow str_key ("command") in completer hooks. Implement
310 trivial completer for 'import' (stdlib modules only). Rename
320 trivial completer for 'import' (stdlib modules only). Rename
311 ipy_linux_package_managers.py to ipy_stock_completers.py.
321 ipy_linux_package_managers.py to ipy_stock_completers.py.
312 SVN completer.
322 SVN completer.
313
323
314 * Extensions/ledit.py: %magic line editor for easily and
324 * Extensions/ledit.py: %magic line editor for easily and
315 incrementally manipulating lists of strings. The magic command
325 incrementally manipulating lists of strings. The magic command
316 name is %led.
326 name is %led.
317
327
318 2006-10-30 Ville Vainio <vivainio@gmail.com>
328 2006-10-30 Ville Vainio <vivainio@gmail.com>
319
329
320 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
330 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
321 Bernsteins's patches for pydb integration.
331 Bernsteins's patches for pydb integration.
322 http://bashdb.sourceforge.net/pydb/
332 http://bashdb.sourceforge.net/pydb/
323
333
324 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
334 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
325 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
335 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
326 custom completer hook to allow the users to implement their own
336 custom completer hook to allow the users to implement their own
327 completers. See ipy_linux_package_managers.py for example. The
337 completers. See ipy_linux_package_managers.py for example. The
328 hook name is 'complete_command'.
338 hook name is 'complete_command'.
329
339
330 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
340 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
331
341
332 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
342 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
333 Numeric leftovers.
343 Numeric leftovers.
334
344
335 * ipython.el (py-execute-region): apply Stefan's patch to fix
345 * ipython.el (py-execute-region): apply Stefan's patch to fix
336 garbled results if the python shell hasn't been previously started.
346 garbled results if the python shell hasn't been previously started.
337
347
338 * IPython/genutils.py (arg_split): moved to genutils, since it's a
348 * IPython/genutils.py (arg_split): moved to genutils, since it's a
339 pretty generic function and useful for other things.
349 pretty generic function and useful for other things.
340
350
341 * IPython/OInspect.py (getsource): Add customizable source
351 * IPython/OInspect.py (getsource): Add customizable source
342 extractor. After a request/patch form W. Stein (SAGE).
352 extractor. After a request/patch form W. Stein (SAGE).
343
353
344 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
354 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
345 window size to a more reasonable value from what pexpect does,
355 window size to a more reasonable value from what pexpect does,
346 since their choice causes wrapping bugs with long input lines.
356 since their choice causes wrapping bugs with long input lines.
347
357
348 2006-10-28 Ville Vainio <vivainio@gmail.com>
358 2006-10-28 Ville Vainio <vivainio@gmail.com>
349
359
350 * Magic.py (%run): Save and restore the readline history from
360 * Magic.py (%run): Save and restore the readline history from
351 file around %run commands to prevent side effects from
361 file around %run commands to prevent side effects from
352 %runned programs that might use readline (e.g. pydb).
362 %runned programs that might use readline (e.g. pydb).
353
363
354 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
364 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
355 invoking the pydb enhanced debugger.
365 invoking the pydb enhanced debugger.
356
366
357 2006-10-23 Walter Doerwald <walter@livinglogic.de>
367 2006-10-23 Walter Doerwald <walter@livinglogic.de>
358
368
359 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
369 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
360 call the base class method and propagate the return value to
370 call the base class method and propagate the return value to
361 ifile. This is now done by path itself.
371 ifile. This is now done by path itself.
362
372
363 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
373 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
364
374
365 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
375 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
366 api: set_crash_handler(), to expose the ability to change the
376 api: set_crash_handler(), to expose the ability to change the
367 internal crash handler.
377 internal crash handler.
368
378
369 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
379 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
370 the various parameters of the crash handler so that apps using
380 the various parameters of the crash handler so that apps using
371 IPython as their engine can customize crash handling. Ipmlemented
381 IPython as their engine can customize crash handling. Ipmlemented
372 at the request of SAGE.
382 at the request of SAGE.
373
383
374 2006-10-14 Ville Vainio <vivainio@gmail.com>
384 2006-10-14 Ville Vainio <vivainio@gmail.com>
375
385
376 * Magic.py, ipython.el: applied first "safe" part of Rocky
386 * Magic.py, ipython.el: applied first "safe" part of Rocky
377 Bernstein's patch set for pydb integration.
387 Bernstein's patch set for pydb integration.
378
388
379 * Magic.py (%unalias, %alias): %store'd aliases can now be
389 * Magic.py (%unalias, %alias): %store'd aliases can now be
380 removed with '%unalias'. %alias w/o args now shows most
390 removed with '%unalias'. %alias w/o args now shows most
381 interesting (stored / manually defined) aliases last
391 interesting (stored / manually defined) aliases last
382 where they catch the eye w/o scrolling.
392 where they catch the eye w/o scrolling.
383
393
384 * Magic.py (%rehashx), ext_rehashdir.py: files with
394 * Magic.py (%rehashx), ext_rehashdir.py: files with
385 'py' extension are always considered executable, even
395 'py' extension are always considered executable, even
386 when not in PATHEXT environment variable.
396 when not in PATHEXT environment variable.
387
397
388 2006-10-12 Ville Vainio <vivainio@gmail.com>
398 2006-10-12 Ville Vainio <vivainio@gmail.com>
389
399
390 * jobctrl.py: Add new "jobctrl" extension for spawning background
400 * jobctrl.py: Add new "jobctrl" extension for spawning background
391 processes with "&find /". 'import jobctrl' to try it out. Requires
401 processes with "&find /". 'import jobctrl' to try it out. Requires
392 'subprocess' module, standard in python 2.4+.
402 'subprocess' module, standard in python 2.4+.
393
403
394 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
404 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
395 so if foo -> bar and bar -> baz, then foo -> baz.
405 so if foo -> bar and bar -> baz, then foo -> baz.
396
406
397 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
407 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
398
408
399 * IPython/Magic.py (Magic.parse_options): add a new posix option
409 * IPython/Magic.py (Magic.parse_options): add a new posix option
400 to allow parsing of input args in magics that doesn't strip quotes
410 to allow parsing of input args in magics that doesn't strip quotes
401 (if posix=False). This also closes %timeit bug reported by
411 (if posix=False). This also closes %timeit bug reported by
402 Stefan.
412 Stefan.
403
413
404 2006-10-03 Ville Vainio <vivainio@gmail.com>
414 2006-10-03 Ville Vainio <vivainio@gmail.com>
405
415
406 * iplib.py (raw_input, interact): Return ValueError catching for
416 * iplib.py (raw_input, interact): Return ValueError catching for
407 raw_input. Fixes infinite loop for sys.stdin.close() or
417 raw_input. Fixes infinite loop for sys.stdin.close() or
408 sys.stdout.close().
418 sys.stdout.close().
409
419
410 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
420 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
411
421
412 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
422 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
413 to help in handling doctests. irunner is now pretty useful for
423 to help in handling doctests. irunner is now pretty useful for
414 running standalone scripts and simulate a full interactive session
424 running standalone scripts and simulate a full interactive session
415 in a format that can be then pasted as a doctest.
425 in a format that can be then pasted as a doctest.
416
426
417 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
427 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
418 on top of the default (useless) ones. This also fixes the nasty
428 on top of the default (useless) ones. This also fixes the nasty
419 way in which 2.5's Quitter() exits (reverted [1785]).
429 way in which 2.5's Quitter() exits (reverted [1785]).
420
430
421 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
431 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
422 2.5.
432 2.5.
423
433
424 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
434 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
425 color scheme is updated as well when color scheme is changed
435 color scheme is updated as well when color scheme is changed
426 interactively.
436 interactively.
427
437
428 2006-09-27 Ville Vainio <vivainio@gmail.com>
438 2006-09-27 Ville Vainio <vivainio@gmail.com>
429
439
430 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
440 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
431 infinite loop and just exit. It's a hack, but will do for a while.
441 infinite loop and just exit. It's a hack, but will do for a while.
432
442
433 2006-08-25 Walter Doerwald <walter@livinglogic.de>
443 2006-08-25 Walter Doerwald <walter@livinglogic.de>
434
444
435 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
445 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
436 the constructor, this makes it possible to get a list of only directories
446 the constructor, this makes it possible to get a list of only directories
437 or only files.
447 or only files.
438
448
439 2006-08-12 Ville Vainio <vivainio@gmail.com>
449 2006-08-12 Ville Vainio <vivainio@gmail.com>
440
450
441 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
451 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
442 they broke unittest
452 they broke unittest
443
453
444 2006-08-11 Ville Vainio <vivainio@gmail.com>
454 2006-08-11 Ville Vainio <vivainio@gmail.com>
445
455
446 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
456 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
447 by resolving issue properly, i.e. by inheriting FakeModule
457 by resolving issue properly, i.e. by inheriting FakeModule
448 from types.ModuleType. Pickling ipython interactive data
458 from types.ModuleType. Pickling ipython interactive data
449 should still work as usual (testing appreciated).
459 should still work as usual (testing appreciated).
450
460
451 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
461 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
452
462
453 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
463 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
454 running under python 2.3 with code from 2.4 to fix a bug with
464 running under python 2.3 with code from 2.4 to fix a bug with
455 help(). Reported by the Debian maintainers, Norbert Tretkowski
465 help(). Reported by the Debian maintainers, Norbert Tretkowski
456 <norbert-AT-tretkowski.de> and Alexandre Fayolle
466 <norbert-AT-tretkowski.de> and Alexandre Fayolle
457 <afayolle-AT-debian.org>.
467 <afayolle-AT-debian.org>.
458
468
459 2006-08-04 Walter Doerwald <walter@livinglogic.de>
469 2006-08-04 Walter Doerwald <walter@livinglogic.de>
460
470
461 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
471 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
462 (which was displaying "quit" twice).
472 (which was displaying "quit" twice).
463
473
464 2006-07-28 Walter Doerwald <walter@livinglogic.de>
474 2006-07-28 Walter Doerwald <walter@livinglogic.de>
465
475
466 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
476 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
467 the mode argument).
477 the mode argument).
468
478
469 2006-07-27 Walter Doerwald <walter@livinglogic.de>
479 2006-07-27 Walter Doerwald <walter@livinglogic.de>
470
480
471 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
481 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
472 not running under IPython.
482 not running under IPython.
473
483
474 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
484 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
475 and make it iterable (iterating over the attribute itself). Add two new
485 and make it iterable (iterating over the attribute itself). Add two new
476 magic strings for __xattrs__(): If the string starts with "-", the attribute
486 magic strings for __xattrs__(): If the string starts with "-", the attribute
477 will not be displayed in ibrowse's detail view (but it can still be
487 will not be displayed in ibrowse's detail view (but it can still be
478 iterated over). This makes it possible to add attributes that are large
488 iterated over). This makes it possible to add attributes that are large
479 lists or generator methods to the detail view. Replace magic attribute names
489 lists or generator methods to the detail view. Replace magic attribute names
480 and _attrname() and _getattr() with "descriptors": For each type of magic
490 and _attrname() and _getattr() with "descriptors": For each type of magic
481 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
491 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
482 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
492 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
483 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
493 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
484 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
494 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
485 are still supported.
495 are still supported.
486
496
487 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
497 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
488 fails in ibrowse.fetch(), the exception object is added as the last item
498 fails in ibrowse.fetch(), the exception object is added as the last item
489 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
499 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
490 a generator throws an exception midway through execution.
500 a generator throws an exception midway through execution.
491
501
492 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
502 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
493 encoding into methods.
503 encoding into methods.
494
504
495 2006-07-26 Ville Vainio <vivainio@gmail.com>
505 2006-07-26 Ville Vainio <vivainio@gmail.com>
496
506
497 * iplib.py: history now stores multiline input as single
507 * iplib.py: history now stores multiline input as single
498 history entries. Patch by Jorgen Cederlof.
508 history entries. Patch by Jorgen Cederlof.
499
509
500 2006-07-18 Walter Doerwald <walter@livinglogic.de>
510 2006-07-18 Walter Doerwald <walter@livinglogic.de>
501
511
502 * IPython/Extensions/ibrowse.py: Make cursor visible over
512 * IPython/Extensions/ibrowse.py: Make cursor visible over
503 non existing attributes.
513 non existing attributes.
504
514
505 2006-07-14 Walter Doerwald <walter@livinglogic.de>
515 2006-07-14 Walter Doerwald <walter@livinglogic.de>
506
516
507 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
517 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
508 error output of the running command doesn't mess up the screen.
518 error output of the running command doesn't mess up the screen.
509
519
510 2006-07-13 Walter Doerwald <walter@livinglogic.de>
520 2006-07-13 Walter Doerwald <walter@livinglogic.de>
511
521
512 * IPython/Extensions/ipipe.py (isort): Make isort usable without
522 * IPython/Extensions/ipipe.py (isort): Make isort usable without
513 argument. This sorts the items themselves.
523 argument. This sorts the items themselves.
514
524
515 2006-07-12 Walter Doerwald <walter@livinglogic.de>
525 2006-07-12 Walter Doerwald <walter@livinglogic.de>
516
526
517 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
527 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
518 Compile expression strings into code objects. This should speed
528 Compile expression strings into code objects. This should speed
519 up ifilter and friends somewhat.
529 up ifilter and friends somewhat.
520
530
521 2006-07-08 Ville Vainio <vivainio@gmail.com>
531 2006-07-08 Ville Vainio <vivainio@gmail.com>
522
532
523 * Magic.py: %cpaste now strips > from the beginning of lines
533 * Magic.py: %cpaste now strips > from the beginning of lines
524 to ease pasting quoted code from emails. Contributed by
534 to ease pasting quoted code from emails. Contributed by
525 Stefan van der Walt.
535 Stefan van der Walt.
526
536
527 2006-06-29 Ville Vainio <vivainio@gmail.com>
537 2006-06-29 Ville Vainio <vivainio@gmail.com>
528
538
529 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
539 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
530 mode, patch contributed by Darren Dale. NEEDS TESTING!
540 mode, patch contributed by Darren Dale. NEEDS TESTING!
531
541
532 2006-06-28 Walter Doerwald <walter@livinglogic.de>
542 2006-06-28 Walter Doerwald <walter@livinglogic.de>
533
543
534 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
544 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
535 a blue background. Fix fetching new display rows when the browser
545 a blue background. Fix fetching new display rows when the browser
536 scrolls more than a screenful (e.g. by using the goto command).
546 scrolls more than a screenful (e.g. by using the goto command).
537
547
538 2006-06-27 Ville Vainio <vivainio@gmail.com>
548 2006-06-27 Ville Vainio <vivainio@gmail.com>
539
549
540 * Magic.py (_inspect, _ofind) Apply David Huard's
550 * Magic.py (_inspect, _ofind) Apply David Huard's
541 patch for displaying the correct docstring for 'property'
551 patch for displaying the correct docstring for 'property'
542 attributes.
552 attributes.
543
553
544 2006-06-23 Walter Doerwald <walter@livinglogic.de>
554 2006-06-23 Walter Doerwald <walter@livinglogic.de>
545
555
546 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
556 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
547 commands into the methods implementing them.
557 commands into the methods implementing them.
548
558
549 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
559 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
550
560
551 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
561 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
552 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
562 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
553 autoindent support was authored by Jin Liu.
563 autoindent support was authored by Jin Liu.
554
564
555 2006-06-22 Walter Doerwald <walter@livinglogic.de>
565 2006-06-22 Walter Doerwald <walter@livinglogic.de>
556
566
557 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
567 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
558 for keymaps with a custom class that simplifies handling.
568 for keymaps with a custom class that simplifies handling.
559
569
560 2006-06-19 Walter Doerwald <walter@livinglogic.de>
570 2006-06-19 Walter Doerwald <walter@livinglogic.de>
561
571
562 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
572 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
563 resizing. This requires Python 2.5 to work.
573 resizing. This requires Python 2.5 to work.
564
574
565 2006-06-16 Walter Doerwald <walter@livinglogic.de>
575 2006-06-16 Walter Doerwald <walter@livinglogic.de>
566
576
567 * IPython/Extensions/ibrowse.py: Add two new commands to
577 * IPython/Extensions/ibrowse.py: Add two new commands to
568 ibrowse: "hideattr" (mapped to "h") hides the attribute under
578 ibrowse: "hideattr" (mapped to "h") hides the attribute under
569 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
579 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
570 attributes again. Remapped the help command to "?". Display
580 attributes again. Remapped the help command to "?". Display
571 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
581 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
572 as keys for the "home" and "end" commands. Add three new commands
582 as keys for the "home" and "end" commands. Add three new commands
573 to the input mode for "find" and friends: "delend" (CTRL-K)
583 to the input mode for "find" and friends: "delend" (CTRL-K)
574 deletes to the end of line. "incsearchup" searches upwards in the
584 deletes to the end of line. "incsearchup" searches upwards in the
575 command history for an input that starts with the text before the cursor.
585 command history for an input that starts with the text before the cursor.
576 "incsearchdown" does the same downwards. Removed a bogus mapping of
586 "incsearchdown" does the same downwards. Removed a bogus mapping of
577 the x key to "delete".
587 the x key to "delete".
578
588
579 2006-06-15 Ville Vainio <vivainio@gmail.com>
589 2006-06-15 Ville Vainio <vivainio@gmail.com>
580
590
581 * iplib.py, hooks.py: Added new generate_prompt hook that can be
591 * iplib.py, hooks.py: Added new generate_prompt hook that can be
582 used to create prompts dynamically, instead of the "old" way of
592 used to create prompts dynamically, instead of the "old" way of
583 assigning "magic" strings to prompt_in1 and prompt_in2. The old
593 assigning "magic" strings to prompt_in1 and prompt_in2. The old
584 way still works (it's invoked by the default hook), of course.
594 way still works (it's invoked by the default hook), of course.
585
595
586 * Prompts.py: added generate_output_prompt hook for altering output
596 * Prompts.py: added generate_output_prompt hook for altering output
587 prompt
597 prompt
588
598
589 * Release.py: Changed version string to 0.7.3.svn.
599 * Release.py: Changed version string to 0.7.3.svn.
590
600
591 2006-06-15 Walter Doerwald <walter@livinglogic.de>
601 2006-06-15 Walter Doerwald <walter@livinglogic.de>
592
602
593 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
603 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
594 the call to fetch() always tries to fetch enough data for at least one
604 the call to fetch() always tries to fetch enough data for at least one
595 full screen. This makes it possible to simply call moveto(0,0,True) in
605 full screen. This makes it possible to simply call moveto(0,0,True) in
596 the constructor. Fix typos and removed the obsolete goto attribute.
606 the constructor. Fix typos and removed the obsolete goto attribute.
597
607
598 2006-06-12 Ville Vainio <vivainio@gmail.com>
608 2006-06-12 Ville Vainio <vivainio@gmail.com>
599
609
600 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
610 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
601 allowing $variable interpolation within multiline statements,
611 allowing $variable interpolation within multiline statements,
602 though so far only with "sh" profile for a testing period.
612 though so far only with "sh" profile for a testing period.
603 The patch also enables splitting long commands with \ but it
613 The patch also enables splitting long commands with \ but it
604 doesn't work properly yet.
614 doesn't work properly yet.
605
615
606 2006-06-12 Walter Doerwald <walter@livinglogic.de>
616 2006-06-12 Walter Doerwald <walter@livinglogic.de>
607
617
608 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
618 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
609 input history and the position of the cursor in the input history for
619 input history and the position of the cursor in the input history for
610 the find, findbackwards and goto command.
620 the find, findbackwards and goto command.
611
621
612 2006-06-10 Walter Doerwald <walter@livinglogic.de>
622 2006-06-10 Walter Doerwald <walter@livinglogic.de>
613
623
614 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
624 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
615 implements the basic functionality of browser commands that require
625 implements the basic functionality of browser commands that require
616 input. Reimplement the goto, find and findbackwards commands as
626 input. Reimplement the goto, find and findbackwards commands as
617 subclasses of _CommandInput. Add an input history and keymaps to those
627 subclasses of _CommandInput. Add an input history and keymaps to those
618 commands. Add "\r" as a keyboard shortcut for the enterdefault and
628 commands. Add "\r" as a keyboard shortcut for the enterdefault and
619 execute commands.
629 execute commands.
620
630
621 2006-06-07 Ville Vainio <vivainio@gmail.com>
631 2006-06-07 Ville Vainio <vivainio@gmail.com>
622
632
623 * iplib.py: ipython mybatch.ipy exits ipython immediately after
633 * iplib.py: ipython mybatch.ipy exits ipython immediately after
624 running the batch files instead of leaving the session open.
634 running the batch files instead of leaving the session open.
625
635
626 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
636 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
627
637
628 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
638 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
629 the original fix was incomplete. Patch submitted by W. Maier.
639 the original fix was incomplete. Patch submitted by W. Maier.
630
640
631 2006-06-07 Ville Vainio <vivainio@gmail.com>
641 2006-06-07 Ville Vainio <vivainio@gmail.com>
632
642
633 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
643 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
634 Confirmation prompts can be supressed by 'quiet' option.
644 Confirmation prompts can be supressed by 'quiet' option.
635 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
645 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
636
646
637 2006-06-06 *** Released version 0.7.2
647 2006-06-06 *** Released version 0.7.2
638
648
639 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
649 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
640
650
641 * IPython/Release.py (version): Made 0.7.2 final for release.
651 * IPython/Release.py (version): Made 0.7.2 final for release.
642 Repo tagged and release cut.
652 Repo tagged and release cut.
643
653
644 2006-06-05 Ville Vainio <vivainio@gmail.com>
654 2006-06-05 Ville Vainio <vivainio@gmail.com>
645
655
646 * Magic.py (magic_rehashx): Honor no_alias list earlier in
656 * Magic.py (magic_rehashx): Honor no_alias list earlier in
647 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
657 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
648
658
649 * upgrade_dir.py: try import 'path' module a bit harder
659 * upgrade_dir.py: try import 'path' module a bit harder
650 (for %upgrade)
660 (for %upgrade)
651
661
652 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
662 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
653
663
654 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
664 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
655 instead of looping 20 times.
665 instead of looping 20 times.
656
666
657 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
667 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
658 correctly at initialization time. Bug reported by Krishna Mohan
668 correctly at initialization time. Bug reported by Krishna Mohan
659 Gundu <gkmohan-AT-gmail.com> on the user list.
669 Gundu <gkmohan-AT-gmail.com> on the user list.
660
670
661 * IPython/Release.py (version): Mark 0.7.2 version to start
671 * IPython/Release.py (version): Mark 0.7.2 version to start
662 testing for release on 06/06.
672 testing for release on 06/06.
663
673
664 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
674 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
665
675
666 * scripts/irunner: thin script interface so users don't have to
676 * scripts/irunner: thin script interface so users don't have to
667 find the module and call it as an executable, since modules rarely
677 find the module and call it as an executable, since modules rarely
668 live in people's PATH.
678 live in people's PATH.
669
679
670 * IPython/irunner.py (InteractiveRunner.__init__): added
680 * IPython/irunner.py (InteractiveRunner.__init__): added
671 delaybeforesend attribute to control delays with newer versions of
681 delaybeforesend attribute to control delays with newer versions of
672 pexpect. Thanks to detailed help from pexpect's author, Noah
682 pexpect. Thanks to detailed help from pexpect's author, Noah
673 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
683 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
674 correctly (it works in NoColor mode).
684 correctly (it works in NoColor mode).
675
685
676 * IPython/iplib.py (handle_normal): fix nasty crash reported on
686 * IPython/iplib.py (handle_normal): fix nasty crash reported on
677 SAGE list, from improper log() calls.
687 SAGE list, from improper log() calls.
678
688
679 2006-05-31 Ville Vainio <vivainio@gmail.com>
689 2006-05-31 Ville Vainio <vivainio@gmail.com>
680
690
681 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
691 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
682 with args in parens to work correctly with dirs that have spaces.
692 with args in parens to work correctly with dirs that have spaces.
683
693
684 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
694 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
685
695
686 * IPython/Logger.py (Logger.logstart): add option to log raw input
696 * IPython/Logger.py (Logger.logstart): add option to log raw input
687 instead of the processed one. A -r flag was added to the
697 instead of the processed one. A -r flag was added to the
688 %logstart magic used for controlling logging.
698 %logstart magic used for controlling logging.
689
699
690 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
700 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
691
701
692 * IPython/iplib.py (InteractiveShell.__init__): add check for the
702 * IPython/iplib.py (InteractiveShell.__init__): add check for the
693 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
703 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
694 recognize the option. After a bug report by Will Maier. This
704 recognize the option. After a bug report by Will Maier. This
695 closes #64 (will do it after confirmation from W. Maier).
705 closes #64 (will do it after confirmation from W. Maier).
696
706
697 * IPython/irunner.py: New module to run scripts as if manually
707 * IPython/irunner.py: New module to run scripts as if manually
698 typed into an interactive environment, based on pexpect. After a
708 typed into an interactive environment, based on pexpect. After a
699 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
709 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
700 ipython-user list. Simple unittests in the tests/ directory.
710 ipython-user list. Simple unittests in the tests/ directory.
701
711
702 * tools/release: add Will Maier, OpenBSD port maintainer, to
712 * tools/release: add Will Maier, OpenBSD port maintainer, to
703 recepients list. We are now officially part of the OpenBSD ports:
713 recepients list. We are now officially part of the OpenBSD ports:
704 http://www.openbsd.org/ports.html ! Many thanks to Will for the
714 http://www.openbsd.org/ports.html ! Many thanks to Will for the
705 work.
715 work.
706
716
707 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
717 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
708
718
709 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
719 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
710 so that it doesn't break tkinter apps.
720 so that it doesn't break tkinter apps.
711
721
712 * IPython/iplib.py (_prefilter): fix bug where aliases would
722 * IPython/iplib.py (_prefilter): fix bug where aliases would
713 shadow variables when autocall was fully off. Reported by SAGE
723 shadow variables when autocall was fully off. Reported by SAGE
714 author William Stein.
724 author William Stein.
715
725
716 * IPython/OInspect.py (Inspector.__init__): add a flag to control
726 * IPython/OInspect.py (Inspector.__init__): add a flag to control
717 at what detail level strings are computed when foo? is requested.
727 at what detail level strings are computed when foo? is requested.
718 This allows users to ask for example that the string form of an
728 This allows users to ask for example that the string form of an
719 object is only computed when foo?? is called, or even never, by
729 object is only computed when foo?? is called, or even never, by
720 setting the object_info_string_level >= 2 in the configuration
730 setting the object_info_string_level >= 2 in the configuration
721 file. This new option has been added and documented. After a
731 file. This new option has been added and documented. After a
722 request by SAGE to be able to control the printing of very large
732 request by SAGE to be able to control the printing of very large
723 objects more easily.
733 objects more easily.
724
734
725 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
735 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
726
736
727 * IPython/ipmaker.py (make_IPython): remove the ipython call path
737 * IPython/ipmaker.py (make_IPython): remove the ipython call path
728 from sys.argv, to be 100% consistent with how Python itself works
738 from sys.argv, to be 100% consistent with how Python itself works
729 (as seen for example with python -i file.py). After a bug report
739 (as seen for example with python -i file.py). After a bug report
730 by Jeffrey Collins.
740 by Jeffrey Collins.
731
741
732 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
742 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
733 nasty bug which was preventing custom namespaces with -pylab,
743 nasty bug which was preventing custom namespaces with -pylab,
734 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
744 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
735 compatibility (long gone from mpl).
745 compatibility (long gone from mpl).
736
746
737 * IPython/ipapi.py (make_session): name change: create->make. We
747 * IPython/ipapi.py (make_session): name change: create->make. We
738 use make in other places (ipmaker,...), it's shorter and easier to
748 use make in other places (ipmaker,...), it's shorter and easier to
739 type and say, etc. I'm trying to clean things before 0.7.2 so
749 type and say, etc. I'm trying to clean things before 0.7.2 so
740 that I can keep things stable wrt to ipapi in the chainsaw branch.
750 that I can keep things stable wrt to ipapi in the chainsaw branch.
741
751
742 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
752 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
743 python-mode recognizes our debugger mode. Add support for
753 python-mode recognizes our debugger mode. Add support for
744 autoindent inside (X)emacs. After a patch sent in by Jin Liu
754 autoindent inside (X)emacs. After a patch sent in by Jin Liu
745 <m.liu.jin-AT-gmail.com> originally written by
755 <m.liu.jin-AT-gmail.com> originally written by
746 doxgen-AT-newsmth.net (with minor modifications for xemacs
756 doxgen-AT-newsmth.net (with minor modifications for xemacs
747 compatibility)
757 compatibility)
748
758
749 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
759 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
750 tracebacks when walking the stack so that the stack tracking system
760 tracebacks when walking the stack so that the stack tracking system
751 in emacs' python-mode can identify the frames correctly.
761 in emacs' python-mode can identify the frames correctly.
752
762
753 * IPython/ipmaker.py (make_IPython): make the internal (and
763 * IPython/ipmaker.py (make_IPython): make the internal (and
754 default config) autoedit_syntax value false by default. Too many
764 default config) autoedit_syntax value false by default. Too many
755 users have complained to me (both on and off-list) about problems
765 users have complained to me (both on and off-list) about problems
756 with this option being on by default, so I'm making it default to
766 with this option being on by default, so I'm making it default to
757 off. It can still be enabled by anyone via the usual mechanisms.
767 off. It can still be enabled by anyone via the usual mechanisms.
758
768
759 * IPython/completer.py (Completer.attr_matches): add support for
769 * IPython/completer.py (Completer.attr_matches): add support for
760 PyCrust-style _getAttributeNames magic method. Patch contributed
770 PyCrust-style _getAttributeNames magic method. Patch contributed
761 by <mscott-AT-goldenspud.com>. Closes #50.
771 by <mscott-AT-goldenspud.com>. Closes #50.
762
772
763 * IPython/iplib.py (InteractiveShell.__init__): remove the
773 * IPython/iplib.py (InteractiveShell.__init__): remove the
764 deletion of exit/quit from __builtin__, which can break
774 deletion of exit/quit from __builtin__, which can break
765 third-party tools like the Zope debugging console. The
775 third-party tools like the Zope debugging console. The
766 %exit/%quit magics remain. In general, it's probably a good idea
776 %exit/%quit magics remain. In general, it's probably a good idea
767 not to delete anything from __builtin__, since we never know what
777 not to delete anything from __builtin__, since we never know what
768 that will break. In any case, python now (for 2.5) will support
778 that will break. In any case, python now (for 2.5) will support
769 'real' exit/quit, so this issue is moot. Closes #55.
779 'real' exit/quit, so this issue is moot. Closes #55.
770
780
771 * IPython/genutils.py (with_obj): rename the 'with' function to
781 * IPython/genutils.py (with_obj): rename the 'with' function to
772 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
782 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
773 becomes a language keyword. Closes #53.
783 becomes a language keyword. Closes #53.
774
784
775 * IPython/FakeModule.py (FakeModule.__init__): add a proper
785 * IPython/FakeModule.py (FakeModule.__init__): add a proper
776 __file__ attribute to this so it fools more things into thinking
786 __file__ attribute to this so it fools more things into thinking
777 it is a real module. Closes #59.
787 it is a real module. Closes #59.
778
788
779 * IPython/Magic.py (magic_edit): add -n option to open the editor
789 * IPython/Magic.py (magic_edit): add -n option to open the editor
780 at a specific line number. After a patch by Stefan van der Walt.
790 at a specific line number. After a patch by Stefan van der Walt.
781
791
782 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
792 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
783
793
784 * IPython/iplib.py (edit_syntax_error): fix crash when for some
794 * IPython/iplib.py (edit_syntax_error): fix crash when for some
785 reason the file could not be opened. After automatic crash
795 reason the file could not be opened. After automatic crash
786 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
796 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
787 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
797 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
788 (_should_recompile): Don't fire editor if using %bg, since there
798 (_should_recompile): Don't fire editor if using %bg, since there
789 is no file in the first place. From the same report as above.
799 is no file in the first place. From the same report as above.
790 (raw_input): protect against faulty third-party prefilters. After
800 (raw_input): protect against faulty third-party prefilters. After
791 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
801 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
792 while running under SAGE.
802 while running under SAGE.
793
803
794 2006-05-23 Ville Vainio <vivainio@gmail.com>
804 2006-05-23 Ville Vainio <vivainio@gmail.com>
795
805
796 * ipapi.py: Stripped down ip.to_user_ns() to work only as
806 * ipapi.py: Stripped down ip.to_user_ns() to work only as
797 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
807 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
798 now returns None (again), unless dummy is specifically allowed by
808 now returns None (again), unless dummy is specifically allowed by
799 ipapi.get(allow_dummy=True).
809 ipapi.get(allow_dummy=True).
800
810
801 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
811 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
802
812
803 * IPython: remove all 2.2-compatibility objects and hacks from
813 * IPython: remove all 2.2-compatibility objects and hacks from
804 everywhere, since we only support 2.3 at this point. Docs
814 everywhere, since we only support 2.3 at this point. Docs
805 updated.
815 updated.
806
816
807 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
817 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
808 Anything requiring extra validation can be turned into a Python
818 Anything requiring extra validation can be turned into a Python
809 property in the future. I used a property for the db one b/c
819 property in the future. I used a property for the db one b/c
810 there was a nasty circularity problem with the initialization
820 there was a nasty circularity problem with the initialization
811 order, which right now I don't have time to clean up.
821 order, which right now I don't have time to clean up.
812
822
813 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
823 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
814 another locking bug reported by Jorgen. I'm not 100% sure though,
824 another locking bug reported by Jorgen. I'm not 100% sure though,
815 so more testing is needed...
825 so more testing is needed...
816
826
817 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
827 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
818
828
819 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
829 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
820 local variables from any routine in user code (typically executed
830 local variables from any routine in user code (typically executed
821 with %run) directly into the interactive namespace. Very useful
831 with %run) directly into the interactive namespace. Very useful
822 when doing complex debugging.
832 when doing complex debugging.
823 (IPythonNotRunning): Changed the default None object to a dummy
833 (IPythonNotRunning): Changed the default None object to a dummy
824 whose attributes can be queried as well as called without
834 whose attributes can be queried as well as called without
825 exploding, to ease writing code which works transparently both in
835 exploding, to ease writing code which works transparently both in
826 and out of ipython and uses some of this API.
836 and out of ipython and uses some of this API.
827
837
828 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
838 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
829
839
830 * IPython/hooks.py (result_display): Fix the fact that our display
840 * IPython/hooks.py (result_display): Fix the fact that our display
831 hook was using str() instead of repr(), as the default python
841 hook was using str() instead of repr(), as the default python
832 console does. This had gone unnoticed b/c it only happened if
842 console does. This had gone unnoticed b/c it only happened if
833 %Pprint was off, but the inconsistency was there.
843 %Pprint was off, but the inconsistency was there.
834
844
835 2006-05-15 Ville Vainio <vivainio@gmail.com>
845 2006-05-15 Ville Vainio <vivainio@gmail.com>
836
846
837 * Oinspect.py: Only show docstring for nonexisting/binary files
847 * Oinspect.py: Only show docstring for nonexisting/binary files
838 when doing object??, closing ticket #62
848 when doing object??, closing ticket #62
839
849
840 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
850 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
841
851
842 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
852 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
843 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
853 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
844 was being released in a routine which hadn't checked if it had
854 was being released in a routine which hadn't checked if it had
845 been the one to acquire it.
855 been the one to acquire it.
846
856
847 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
857 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
848
858
849 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
859 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
850
860
851 2006-04-11 Ville Vainio <vivainio@gmail.com>
861 2006-04-11 Ville Vainio <vivainio@gmail.com>
852
862
853 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
863 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
854 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
864 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
855 prefilters, allowing stuff like magics and aliases in the file.
865 prefilters, allowing stuff like magics and aliases in the file.
856
866
857 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
867 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
858 added. Supported now are "%clear in" and "%clear out" (clear input and
868 added. Supported now are "%clear in" and "%clear out" (clear input and
859 output history, respectively). Also fixed CachedOutput.flush to
869 output history, respectively). Also fixed CachedOutput.flush to
860 properly flush the output cache.
870 properly flush the output cache.
861
871
862 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
872 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
863 half-success (and fail explicitly).
873 half-success (and fail explicitly).
864
874
865 2006-03-28 Ville Vainio <vivainio@gmail.com>
875 2006-03-28 Ville Vainio <vivainio@gmail.com>
866
876
867 * iplib.py: Fix quoting of aliases so that only argless ones
877 * iplib.py: Fix quoting of aliases so that only argless ones
868 are quoted
878 are quoted
869
879
870 2006-03-28 Ville Vainio <vivainio@gmail.com>
880 2006-03-28 Ville Vainio <vivainio@gmail.com>
871
881
872 * iplib.py: Quote aliases with spaces in the name.
882 * iplib.py: Quote aliases with spaces in the name.
873 "c:\program files\blah\bin" is now legal alias target.
883 "c:\program files\blah\bin" is now legal alias target.
874
884
875 * ext_rehashdir.py: Space no longer allowed as arg
885 * ext_rehashdir.py: Space no longer allowed as arg
876 separator, since space is legal in path names.
886 separator, since space is legal in path names.
877
887
878 2006-03-16 Ville Vainio <vivainio@gmail.com>
888 2006-03-16 Ville Vainio <vivainio@gmail.com>
879
889
880 * upgrade_dir.py: Take path.py from Extensions, correcting
890 * upgrade_dir.py: Take path.py from Extensions, correcting
881 %upgrade magic
891 %upgrade magic
882
892
883 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
893 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
884
894
885 * hooks.py: Only enclose editor binary in quotes if legal and
895 * hooks.py: Only enclose editor binary in quotes if legal and
886 necessary (space in the name, and is an existing file). Fixes a bug
896 necessary (space in the name, and is an existing file). Fixes a bug
887 reported by Zachary Pincus.
897 reported by Zachary Pincus.
888
898
889 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
899 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
890
900
891 * Manual: thanks to a tip on proper color handling for Emacs, by
901 * Manual: thanks to a tip on proper color handling for Emacs, by
892 Eric J Haywiser <ejh1-AT-MIT.EDU>.
902 Eric J Haywiser <ejh1-AT-MIT.EDU>.
893
903
894 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
904 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
895 by applying the provided patch. Thanks to Liu Jin
905 by applying the provided patch. Thanks to Liu Jin
896 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
906 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
897 XEmacs/Linux, I'm trusting the submitter that it actually helps
907 XEmacs/Linux, I'm trusting the submitter that it actually helps
898 under win32/GNU Emacs. Will revisit if any problems are reported.
908 under win32/GNU Emacs. Will revisit if any problems are reported.
899
909
900 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
910 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
901
911
902 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
912 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
903 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
913 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
904
914
905 2006-03-12 Ville Vainio <vivainio@gmail.com>
915 2006-03-12 Ville Vainio <vivainio@gmail.com>
906
916
907 * Magic.py (magic_timeit): Added %timeit magic, contributed by
917 * Magic.py (magic_timeit): Added %timeit magic, contributed by
908 Torsten Marek.
918 Torsten Marek.
909
919
910 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
920 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
911
921
912 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
922 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
913 line ranges works again.
923 line ranges works again.
914
924
915 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
925 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
916
926
917 * IPython/iplib.py (showtraceback): add back sys.last_traceback
927 * IPython/iplib.py (showtraceback): add back sys.last_traceback
918 and friends, after a discussion with Zach Pincus on ipython-user.
928 and friends, after a discussion with Zach Pincus on ipython-user.
919 I'm not 100% sure, but after thinking about it quite a bit, it may
929 I'm not 100% sure, but after thinking about it quite a bit, it may
920 be OK. Testing with the multithreaded shells didn't reveal any
930 be OK. Testing with the multithreaded shells didn't reveal any
921 problems, but let's keep an eye out.
931 problems, but let's keep an eye out.
922
932
923 In the process, I fixed a few things which were calling
933 In the process, I fixed a few things which were calling
924 self.InteractiveTB() directly (like safe_execfile), which is a
934 self.InteractiveTB() directly (like safe_execfile), which is a
925 mistake: ALL exception reporting should be done by calling
935 mistake: ALL exception reporting should be done by calling
926 self.showtraceback(), which handles state and tab-completion and
936 self.showtraceback(), which handles state and tab-completion and
927 more.
937 more.
928
938
929 2006-03-01 Ville Vainio <vivainio@gmail.com>
939 2006-03-01 Ville Vainio <vivainio@gmail.com>
930
940
931 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
941 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
932 To use, do "from ipipe import *".
942 To use, do "from ipipe import *".
933
943
934 2006-02-24 Ville Vainio <vivainio@gmail.com>
944 2006-02-24 Ville Vainio <vivainio@gmail.com>
935
945
936 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
946 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
937 "cleanly" and safely than the older upgrade mechanism.
947 "cleanly" and safely than the older upgrade mechanism.
938
948
939 2006-02-21 Ville Vainio <vivainio@gmail.com>
949 2006-02-21 Ville Vainio <vivainio@gmail.com>
940
950
941 * Magic.py: %save works again.
951 * Magic.py: %save works again.
942
952
943 2006-02-15 Ville Vainio <vivainio@gmail.com>
953 2006-02-15 Ville Vainio <vivainio@gmail.com>
944
954
945 * Magic.py: %Pprint works again
955 * Magic.py: %Pprint works again
946
956
947 * Extensions/ipy_sane_defaults.py: Provide everything provided
957 * Extensions/ipy_sane_defaults.py: Provide everything provided
948 in default ipythonrc, to make it possible to have a completely empty
958 in default ipythonrc, to make it possible to have a completely empty
949 ipythonrc (and thus completely rc-file free configuration)
959 ipythonrc (and thus completely rc-file free configuration)
950
960
951 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
961 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
952
962
953 * IPython/hooks.py (editor): quote the call to the editor command,
963 * IPython/hooks.py (editor): quote the call to the editor command,
954 to allow commands with spaces in them. Problem noted by watching
964 to allow commands with spaces in them. Problem noted by watching
955 Ian Oswald's video about textpad under win32 at
965 Ian Oswald's video about textpad under win32 at
956 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
966 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
957
967
958 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
968 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
959 describing magics (we haven't used @ for a loong time).
969 describing magics (we haven't used @ for a loong time).
960
970
961 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
971 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
962 contributed by marienz to close
972 contributed by marienz to close
963 http://www.scipy.net/roundup/ipython/issue53.
973 http://www.scipy.net/roundup/ipython/issue53.
964
974
965 2006-02-10 Ville Vainio <vivainio@gmail.com>
975 2006-02-10 Ville Vainio <vivainio@gmail.com>
966
976
967 * genutils.py: getoutput now works in win32 too
977 * genutils.py: getoutput now works in win32 too
968
978
969 * completer.py: alias and magic completion only invoked
979 * completer.py: alias and magic completion only invoked
970 at the first "item" in the line, to avoid "cd %store"
980 at the first "item" in the line, to avoid "cd %store"
971 nonsense.
981 nonsense.
972
982
973 2006-02-09 Ville Vainio <vivainio@gmail.com>
983 2006-02-09 Ville Vainio <vivainio@gmail.com>
974
984
975 * test/*: Added a unit testing framework (finally).
985 * test/*: Added a unit testing framework (finally).
976 '%run runtests.py' to run test_*.
986 '%run runtests.py' to run test_*.
977
987
978 * ipapi.py: Exposed runlines and set_custom_exc
988 * ipapi.py: Exposed runlines and set_custom_exc
979
989
980 2006-02-07 Ville Vainio <vivainio@gmail.com>
990 2006-02-07 Ville Vainio <vivainio@gmail.com>
981
991
982 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
992 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
983 instead use "f(1 2)" as before.
993 instead use "f(1 2)" as before.
984
994
985 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
995 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
986
996
987 * IPython/demo.py (IPythonDemo): Add new classes to the demo
997 * IPython/demo.py (IPythonDemo): Add new classes to the demo
988 facilities, for demos processed by the IPython input filter
998 facilities, for demos processed by the IPython input filter
989 (IPythonDemo), and for running a script one-line-at-a-time as a
999 (IPythonDemo), and for running a script one-line-at-a-time as a
990 demo, both for pure Python (LineDemo) and for IPython-processed
1000 demo, both for pure Python (LineDemo) and for IPython-processed
991 input (IPythonLineDemo). After a request by Dave Kohel, from the
1001 input (IPythonLineDemo). After a request by Dave Kohel, from the
992 SAGE team.
1002 SAGE team.
993 (Demo.edit): added an edit() method to the demo objects, to edit
1003 (Demo.edit): added an edit() method to the demo objects, to edit
994 the in-memory copy of the last executed block.
1004 the in-memory copy of the last executed block.
995
1005
996 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1006 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
997 processing to %edit, %macro and %save. These commands can now be
1007 processing to %edit, %macro and %save. These commands can now be
998 invoked on the unprocessed input as it was typed by the user
1008 invoked on the unprocessed input as it was typed by the user
999 (without any prefilters applied). After requests by the SAGE team
1009 (without any prefilters applied). After requests by the SAGE team
1000 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1010 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1001
1011
1002 2006-02-01 Ville Vainio <vivainio@gmail.com>
1012 2006-02-01 Ville Vainio <vivainio@gmail.com>
1003
1013
1004 * setup.py, eggsetup.py: easy_install ipython==dev works
1014 * setup.py, eggsetup.py: easy_install ipython==dev works
1005 correctly now (on Linux)
1015 correctly now (on Linux)
1006
1016
1007 * ipy_user_conf,ipmaker: user config changes, removed spurious
1017 * ipy_user_conf,ipmaker: user config changes, removed spurious
1008 warnings
1018 warnings
1009
1019
1010 * iplib: if rc.banner is string, use it as is.
1020 * iplib: if rc.banner is string, use it as is.
1011
1021
1012 * Magic: %pycat accepts a string argument and pages it's contents.
1022 * Magic: %pycat accepts a string argument and pages it's contents.
1013
1023
1014
1024
1015 2006-01-30 Ville Vainio <vivainio@gmail.com>
1025 2006-01-30 Ville Vainio <vivainio@gmail.com>
1016
1026
1017 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1027 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1018 Now %store and bookmarks work through PickleShare, meaning that
1028 Now %store and bookmarks work through PickleShare, meaning that
1019 concurrent access is possible and all ipython sessions see the
1029 concurrent access is possible and all ipython sessions see the
1020 same database situation all the time, instead of snapshot of
1030 same database situation all the time, instead of snapshot of
1021 the situation when the session was started. Hence, %bookmark
1031 the situation when the session was started. Hence, %bookmark
1022 results are immediately accessible from othes sessions. The database
1032 results are immediately accessible from othes sessions. The database
1023 is also available for use by user extensions. See:
1033 is also available for use by user extensions. See:
1024 http://www.python.org/pypi/pickleshare
1034 http://www.python.org/pypi/pickleshare
1025
1035
1026 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1036 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1027
1037
1028 * aliases can now be %store'd
1038 * aliases can now be %store'd
1029
1039
1030 * path.py moved to Extensions so that pickleshare does not need
1040 * path.py moved to Extensions so that pickleshare does not need
1031 IPython-specific import. Extensions added to pythonpath right
1041 IPython-specific import. Extensions added to pythonpath right
1032 at __init__.
1042 at __init__.
1033
1043
1034 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1044 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1035 called with _ip.system and the pre-transformed command string.
1045 called with _ip.system and the pre-transformed command string.
1036
1046
1037 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1047 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1038
1048
1039 * IPython/iplib.py (interact): Fix that we were not catching
1049 * IPython/iplib.py (interact): Fix that we were not catching
1040 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1050 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1041 logic here had to change, but it's fixed now.
1051 logic here had to change, but it's fixed now.
1042
1052
1043 2006-01-29 Ville Vainio <vivainio@gmail.com>
1053 2006-01-29 Ville Vainio <vivainio@gmail.com>
1044
1054
1045 * iplib.py: Try to import pyreadline on Windows.
1055 * iplib.py: Try to import pyreadline on Windows.
1046
1056
1047 2006-01-27 Ville Vainio <vivainio@gmail.com>
1057 2006-01-27 Ville Vainio <vivainio@gmail.com>
1048
1058
1049 * iplib.py: Expose ipapi as _ip in builtin namespace.
1059 * iplib.py: Expose ipapi as _ip in builtin namespace.
1050 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1060 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1051 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1061 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1052 syntax now produce _ip.* variant of the commands.
1062 syntax now produce _ip.* variant of the commands.
1053
1063
1054 * "_ip.options().autoedit_syntax = 2" automatically throws
1064 * "_ip.options().autoedit_syntax = 2" automatically throws
1055 user to editor for syntax error correction without prompting.
1065 user to editor for syntax error correction without prompting.
1056
1066
1057 2006-01-27 Ville Vainio <vivainio@gmail.com>
1067 2006-01-27 Ville Vainio <vivainio@gmail.com>
1058
1068
1059 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1069 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1060 'ipython' at argv[0]) executed through command line.
1070 'ipython' at argv[0]) executed through command line.
1061 NOTE: this DEPRECATES calling ipython with multiple scripts
1071 NOTE: this DEPRECATES calling ipython with multiple scripts
1062 ("ipython a.py b.py c.py")
1072 ("ipython a.py b.py c.py")
1063
1073
1064 * iplib.py, hooks.py: Added configurable input prefilter,
1074 * iplib.py, hooks.py: Added configurable input prefilter,
1065 named 'input_prefilter'. See ext_rescapture.py for example
1075 named 'input_prefilter'. See ext_rescapture.py for example
1066 usage.
1076 usage.
1067
1077
1068 * ext_rescapture.py, Magic.py: Better system command output capture
1078 * ext_rescapture.py, Magic.py: Better system command output capture
1069 through 'var = !ls' (deprecates user-visible %sc). Same notation
1079 through 'var = !ls' (deprecates user-visible %sc). Same notation
1070 applies for magics, 'var = %alias' assigns alias list to var.
1080 applies for magics, 'var = %alias' assigns alias list to var.
1071
1081
1072 * ipapi.py: added meta() for accessing extension-usable data store.
1082 * ipapi.py: added meta() for accessing extension-usable data store.
1073
1083
1074 * iplib.py: added InteractiveShell.getapi(). New magics should be
1084 * iplib.py: added InteractiveShell.getapi(). New magics should be
1075 written doing self.getapi() instead of using the shell directly.
1085 written doing self.getapi() instead of using the shell directly.
1076
1086
1077 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1087 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1078 %store foo >> ~/myfoo.txt to store variables to files (in clean
1088 %store foo >> ~/myfoo.txt to store variables to files (in clean
1079 textual form, not a restorable pickle).
1089 textual form, not a restorable pickle).
1080
1090
1081 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1091 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1082
1092
1083 * usage.py, Magic.py: added %quickref
1093 * usage.py, Magic.py: added %quickref
1084
1094
1085 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1095 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1086
1096
1087 * GetoptErrors when invoking magics etc. with wrong args
1097 * GetoptErrors when invoking magics etc. with wrong args
1088 are now more helpful:
1098 are now more helpful:
1089 GetoptError: option -l not recognized (allowed: "qb" )
1099 GetoptError: option -l not recognized (allowed: "qb" )
1090
1100
1091 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1101 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1092
1102
1093 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1103 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1094 computationally intensive blocks don't appear to stall the demo.
1104 computationally intensive blocks don't appear to stall the demo.
1095
1105
1096 2006-01-24 Ville Vainio <vivainio@gmail.com>
1106 2006-01-24 Ville Vainio <vivainio@gmail.com>
1097
1107
1098 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1108 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1099 value to manipulate resulting history entry.
1109 value to manipulate resulting history entry.
1100
1110
1101 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1111 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1102 to instance methods of IPApi class, to make extending an embedded
1112 to instance methods of IPApi class, to make extending an embedded
1103 IPython feasible. See ext_rehashdir.py for example usage.
1113 IPython feasible. See ext_rehashdir.py for example usage.
1104
1114
1105 * Merged 1071-1076 from branches/0.7.1
1115 * Merged 1071-1076 from branches/0.7.1
1106
1116
1107
1117
1108 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1118 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1109
1119
1110 * tools/release (daystamp): Fix build tools to use the new
1120 * tools/release (daystamp): Fix build tools to use the new
1111 eggsetup.py script to build lightweight eggs.
1121 eggsetup.py script to build lightweight eggs.
1112
1122
1113 * Applied changesets 1062 and 1064 before 0.7.1 release.
1123 * Applied changesets 1062 and 1064 before 0.7.1 release.
1114
1124
1115 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1125 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1116 see the raw input history (without conversions like %ls ->
1126 see the raw input history (without conversions like %ls ->
1117 ipmagic("ls")). After a request from W. Stein, SAGE
1127 ipmagic("ls")). After a request from W. Stein, SAGE
1118 (http://modular.ucsd.edu/sage) developer. This information is
1128 (http://modular.ucsd.edu/sage) developer. This information is
1119 stored in the input_hist_raw attribute of the IPython instance, so
1129 stored in the input_hist_raw attribute of the IPython instance, so
1120 developers can access it if needed (it's an InputList instance).
1130 developers can access it if needed (it's an InputList instance).
1121
1131
1122 * Versionstring = 0.7.2.svn
1132 * Versionstring = 0.7.2.svn
1123
1133
1124 * eggsetup.py: A separate script for constructing eggs, creates
1134 * eggsetup.py: A separate script for constructing eggs, creates
1125 proper launch scripts even on Windows (an .exe file in
1135 proper launch scripts even on Windows (an .exe file in
1126 \python24\scripts).
1136 \python24\scripts).
1127
1137
1128 * ipapi.py: launch_new_instance, launch entry point needed for the
1138 * ipapi.py: launch_new_instance, launch entry point needed for the
1129 egg.
1139 egg.
1130
1140
1131 2006-01-23 Ville Vainio <vivainio@gmail.com>
1141 2006-01-23 Ville Vainio <vivainio@gmail.com>
1132
1142
1133 * Added %cpaste magic for pasting python code
1143 * Added %cpaste magic for pasting python code
1134
1144
1135 2006-01-22 Ville Vainio <vivainio@gmail.com>
1145 2006-01-22 Ville Vainio <vivainio@gmail.com>
1136
1146
1137 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1147 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1138
1148
1139 * Versionstring = 0.7.2.svn
1149 * Versionstring = 0.7.2.svn
1140
1150
1141 * eggsetup.py: A separate script for constructing eggs, creates
1151 * eggsetup.py: A separate script for constructing eggs, creates
1142 proper launch scripts even on Windows (an .exe file in
1152 proper launch scripts even on Windows (an .exe file in
1143 \python24\scripts).
1153 \python24\scripts).
1144
1154
1145 * ipapi.py: launch_new_instance, launch entry point needed for the
1155 * ipapi.py: launch_new_instance, launch entry point needed for the
1146 egg.
1156 egg.
1147
1157
1148 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1158 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1149
1159
1150 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1160 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1151 %pfile foo would print the file for foo even if it was a binary.
1161 %pfile foo would print the file for foo even if it was a binary.
1152 Now, extensions '.so' and '.dll' are skipped.
1162 Now, extensions '.so' and '.dll' are skipped.
1153
1163
1154 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1164 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1155 bug, where macros would fail in all threaded modes. I'm not 100%
1165 bug, where macros would fail in all threaded modes. I'm not 100%
1156 sure, so I'm going to put out an rc instead of making a release
1166 sure, so I'm going to put out an rc instead of making a release
1157 today, and wait for feedback for at least a few days.
1167 today, and wait for feedback for at least a few days.
1158
1168
1159 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1169 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1160 it...) the handling of pasting external code with autoindent on.
1170 it...) the handling of pasting external code with autoindent on.
1161 To get out of a multiline input, the rule will appear for most
1171 To get out of a multiline input, the rule will appear for most
1162 users unchanged: two blank lines or change the indent level
1172 users unchanged: two blank lines or change the indent level
1163 proposed by IPython. But there is a twist now: you can
1173 proposed by IPython. But there is a twist now: you can
1164 add/subtract only *one or two spaces*. If you add/subtract three
1174 add/subtract only *one or two spaces*. If you add/subtract three
1165 or more (unless you completely delete the line), IPython will
1175 or more (unless you completely delete the line), IPython will
1166 accept that line, and you'll need to enter a second one of pure
1176 accept that line, and you'll need to enter a second one of pure
1167 whitespace. I know it sounds complicated, but I can't find a
1177 whitespace. I know it sounds complicated, but I can't find a
1168 different solution that covers all the cases, with the right
1178 different solution that covers all the cases, with the right
1169 heuristics. Hopefully in actual use, nobody will really notice
1179 heuristics. Hopefully in actual use, nobody will really notice
1170 all these strange rules and things will 'just work'.
1180 all these strange rules and things will 'just work'.
1171
1181
1172 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1182 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1173
1183
1174 * IPython/iplib.py (interact): catch exceptions which can be
1184 * IPython/iplib.py (interact): catch exceptions which can be
1175 triggered asynchronously by signal handlers. Thanks to an
1185 triggered asynchronously by signal handlers. Thanks to an
1176 automatic crash report, submitted by Colin Kingsley
1186 automatic crash report, submitted by Colin Kingsley
1177 <tercel-AT-gentoo.org>.
1187 <tercel-AT-gentoo.org>.
1178
1188
1179 2006-01-20 Ville Vainio <vivainio@gmail.com>
1189 2006-01-20 Ville Vainio <vivainio@gmail.com>
1180
1190
1181 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1191 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1182 (%rehashdir, very useful, try it out) of how to extend ipython
1192 (%rehashdir, very useful, try it out) of how to extend ipython
1183 with new magics. Also added Extensions dir to pythonpath to make
1193 with new magics. Also added Extensions dir to pythonpath to make
1184 importing extensions easy.
1194 importing extensions easy.
1185
1195
1186 * %store now complains when trying to store interactively declared
1196 * %store now complains when trying to store interactively declared
1187 classes / instances of those classes.
1197 classes / instances of those classes.
1188
1198
1189 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1199 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1190 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1200 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1191 if they exist, and ipy_user_conf.py with some defaults is created for
1201 if they exist, and ipy_user_conf.py with some defaults is created for
1192 the user.
1202 the user.
1193
1203
1194 * Startup rehashing done by the config file, not InterpreterExec.
1204 * Startup rehashing done by the config file, not InterpreterExec.
1195 This means system commands are available even without selecting the
1205 This means system commands are available even without selecting the
1196 pysh profile. It's the sensible default after all.
1206 pysh profile. It's the sensible default after all.
1197
1207
1198 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1208 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1199
1209
1200 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1210 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1201 multiline code with autoindent on working. But I am really not
1211 multiline code with autoindent on working. But I am really not
1202 sure, so this needs more testing. Will commit a debug-enabled
1212 sure, so this needs more testing. Will commit a debug-enabled
1203 version for now, while I test it some more, so that Ville and
1213 version for now, while I test it some more, so that Ville and
1204 others may also catch any problems. Also made
1214 others may also catch any problems. Also made
1205 self.indent_current_str() a method, to ensure that there's no
1215 self.indent_current_str() a method, to ensure that there's no
1206 chance of the indent space count and the corresponding string
1216 chance of the indent space count and the corresponding string
1207 falling out of sync. All code needing the string should just call
1217 falling out of sync. All code needing the string should just call
1208 the method.
1218 the method.
1209
1219
1210 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1220 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1211
1221
1212 * IPython/Magic.py (magic_edit): fix check for when users don't
1222 * IPython/Magic.py (magic_edit): fix check for when users don't
1213 save their output files, the try/except was in the wrong section.
1223 save their output files, the try/except was in the wrong section.
1214
1224
1215 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1225 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1216
1226
1217 * IPython/Magic.py (magic_run): fix __file__ global missing from
1227 * IPython/Magic.py (magic_run): fix __file__ global missing from
1218 script's namespace when executed via %run. After a report by
1228 script's namespace when executed via %run. After a report by
1219 Vivian.
1229 Vivian.
1220
1230
1221 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1231 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1222 when using python 2.4. The parent constructor changed in 2.4, and
1232 when using python 2.4. The parent constructor changed in 2.4, and
1223 we need to track it directly (we can't call it, as it messes up
1233 we need to track it directly (we can't call it, as it messes up
1224 readline and tab-completion inside our pdb would stop working).
1234 readline and tab-completion inside our pdb would stop working).
1225 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1235 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1226
1236
1227 2006-01-16 Ville Vainio <vivainio@gmail.com>
1237 2006-01-16 Ville Vainio <vivainio@gmail.com>
1228
1238
1229 * Ipython/magic.py: Reverted back to old %edit functionality
1239 * Ipython/magic.py: Reverted back to old %edit functionality
1230 that returns file contents on exit.
1240 that returns file contents on exit.
1231
1241
1232 * IPython/path.py: Added Jason Orendorff's "path" module to
1242 * IPython/path.py: Added Jason Orendorff's "path" module to
1233 IPython tree, http://www.jorendorff.com/articles/python/path/.
1243 IPython tree, http://www.jorendorff.com/articles/python/path/.
1234 You can get path objects conveniently through %sc, and !!, e.g.:
1244 You can get path objects conveniently through %sc, and !!, e.g.:
1235 sc files=ls
1245 sc files=ls
1236 for p in files.paths: # or files.p
1246 for p in files.paths: # or files.p
1237 print p,p.mtime
1247 print p,p.mtime
1238
1248
1239 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1249 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1240 now work again without considering the exclusion regexp -
1250 now work again without considering the exclusion regexp -
1241 hence, things like ',foo my/path' turn to 'foo("my/path")'
1251 hence, things like ',foo my/path' turn to 'foo("my/path")'
1242 instead of syntax error.
1252 instead of syntax error.
1243
1253
1244
1254
1245 2006-01-14 Ville Vainio <vivainio@gmail.com>
1255 2006-01-14 Ville Vainio <vivainio@gmail.com>
1246
1256
1247 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1257 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1248 ipapi decorators for python 2.4 users, options() provides access to rc
1258 ipapi decorators for python 2.4 users, options() provides access to rc
1249 data.
1259 data.
1250
1260
1251 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1261 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1252 as path separators (even on Linux ;-). Space character after
1262 as path separators (even on Linux ;-). Space character after
1253 backslash (as yielded by tab completer) is still space;
1263 backslash (as yielded by tab completer) is still space;
1254 "%cd long\ name" works as expected.
1264 "%cd long\ name" works as expected.
1255
1265
1256 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1266 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1257 as "chain of command", with priority. API stays the same,
1267 as "chain of command", with priority. API stays the same,
1258 TryNext exception raised by a hook function signals that
1268 TryNext exception raised by a hook function signals that
1259 current hook failed and next hook should try handling it, as
1269 current hook failed and next hook should try handling it, as
1260 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1270 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1261 requested configurable display hook, which is now implemented.
1271 requested configurable display hook, which is now implemented.
1262
1272
1263 2006-01-13 Ville Vainio <vivainio@gmail.com>
1273 2006-01-13 Ville Vainio <vivainio@gmail.com>
1264
1274
1265 * IPython/platutils*.py: platform specific utility functions,
1275 * IPython/platutils*.py: platform specific utility functions,
1266 so far only set_term_title is implemented (change terminal
1276 so far only set_term_title is implemented (change terminal
1267 label in windowing systems). %cd now changes the title to
1277 label in windowing systems). %cd now changes the title to
1268 current dir.
1278 current dir.
1269
1279
1270 * IPython/Release.py: Added myself to "authors" list,
1280 * IPython/Release.py: Added myself to "authors" list,
1271 had to create new files.
1281 had to create new files.
1272
1282
1273 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1283 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1274 shell escape; not a known bug but had potential to be one in the
1284 shell escape; not a known bug but had potential to be one in the
1275 future.
1285 future.
1276
1286
1277 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1287 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1278 extension API for IPython! See the module for usage example. Fix
1288 extension API for IPython! See the module for usage example. Fix
1279 OInspect for docstring-less magic functions.
1289 OInspect for docstring-less magic functions.
1280
1290
1281
1291
1282 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1292 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1283
1293
1284 * IPython/iplib.py (raw_input): temporarily deactivate all
1294 * IPython/iplib.py (raw_input): temporarily deactivate all
1285 attempts at allowing pasting of code with autoindent on. It
1295 attempts at allowing pasting of code with autoindent on. It
1286 introduced bugs (reported by Prabhu) and I can't seem to find a
1296 introduced bugs (reported by Prabhu) and I can't seem to find a
1287 robust combination which works in all cases. Will have to revisit
1297 robust combination which works in all cases. Will have to revisit
1288 later.
1298 later.
1289
1299
1290 * IPython/genutils.py: remove isspace() function. We've dropped
1300 * IPython/genutils.py: remove isspace() function. We've dropped
1291 2.2 compatibility, so it's OK to use the string method.
1301 2.2 compatibility, so it's OK to use the string method.
1292
1302
1293 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1303 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1294
1304
1295 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1305 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1296 matching what NOT to autocall on, to include all python binary
1306 matching what NOT to autocall on, to include all python binary
1297 operators (including things like 'and', 'or', 'is' and 'in').
1307 operators (including things like 'and', 'or', 'is' and 'in').
1298 Prompted by a bug report on 'foo & bar', but I realized we had
1308 Prompted by a bug report on 'foo & bar', but I realized we had
1299 many more potential bug cases with other operators. The regexp is
1309 many more potential bug cases with other operators. The regexp is
1300 self.re_exclude_auto, it's fairly commented.
1310 self.re_exclude_auto, it's fairly commented.
1301
1311
1302 2006-01-12 Ville Vainio <vivainio@gmail.com>
1312 2006-01-12 Ville Vainio <vivainio@gmail.com>
1303
1313
1304 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1314 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1305 Prettified and hardened string/backslash quoting with ipsystem(),
1315 Prettified and hardened string/backslash quoting with ipsystem(),
1306 ipalias() and ipmagic(). Now even \ characters are passed to
1316 ipalias() and ipmagic(). Now even \ characters are passed to
1307 %magics, !shell escapes and aliases exactly as they are in the
1317 %magics, !shell escapes and aliases exactly as they are in the
1308 ipython command line. Should improve backslash experience,
1318 ipython command line. Should improve backslash experience,
1309 particularly in Windows (path delimiter for some commands that
1319 particularly in Windows (path delimiter for some commands that
1310 won't understand '/'), but Unix benefits as well (regexps). %cd
1320 won't understand '/'), but Unix benefits as well (regexps). %cd
1311 magic still doesn't support backslash path delimiters, though. Also
1321 magic still doesn't support backslash path delimiters, though. Also
1312 deleted all pretense of supporting multiline command strings in
1322 deleted all pretense of supporting multiline command strings in
1313 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1323 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1314
1324
1315 * doc/build_doc_instructions.txt added. Documentation on how to
1325 * doc/build_doc_instructions.txt added. Documentation on how to
1316 use doc/update_manual.py, added yesterday. Both files contributed
1326 use doc/update_manual.py, added yesterday. Both files contributed
1317 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1327 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1318 doc/*.sh for deprecation at a later date.
1328 doc/*.sh for deprecation at a later date.
1319
1329
1320 * /ipython.py Added ipython.py to root directory for
1330 * /ipython.py Added ipython.py to root directory for
1321 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1331 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1322 ipython.py) and development convenience (no need to keep doing
1332 ipython.py) and development convenience (no need to keep doing
1323 "setup.py install" between changes).
1333 "setup.py install" between changes).
1324
1334
1325 * Made ! and !! shell escapes work (again) in multiline expressions:
1335 * Made ! and !! shell escapes work (again) in multiline expressions:
1326 if 1:
1336 if 1:
1327 !ls
1337 !ls
1328 !!ls
1338 !!ls
1329
1339
1330 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1340 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1331
1341
1332 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1342 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1333 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1343 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1334 module in case-insensitive installation. Was causing crashes
1344 module in case-insensitive installation. Was causing crashes
1335 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1345 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1336
1346
1337 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1347 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1338 <marienz-AT-gentoo.org>, closes
1348 <marienz-AT-gentoo.org>, closes
1339 http://www.scipy.net/roundup/ipython/issue51.
1349 http://www.scipy.net/roundup/ipython/issue51.
1340
1350
1341 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1351 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1342
1352
1343 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1353 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1344 problem of excessive CPU usage under *nix and keyboard lag under
1354 problem of excessive CPU usage under *nix and keyboard lag under
1345 win32.
1355 win32.
1346
1356
1347 2006-01-10 *** Released version 0.7.0
1357 2006-01-10 *** Released version 0.7.0
1348
1358
1349 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1359 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1350
1360
1351 * IPython/Release.py (revision): tag version number to 0.7.0,
1361 * IPython/Release.py (revision): tag version number to 0.7.0,
1352 ready for release.
1362 ready for release.
1353
1363
1354 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1364 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1355 it informs the user of the name of the temp. file used. This can
1365 it informs the user of the name of the temp. file used. This can
1356 help if you decide later to reuse that same file, so you know
1366 help if you decide later to reuse that same file, so you know
1357 where to copy the info from.
1367 where to copy the info from.
1358
1368
1359 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1369 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1360
1370
1361 * setup_bdist_egg.py: little script to build an egg. Added
1371 * setup_bdist_egg.py: little script to build an egg. Added
1362 support in the release tools as well.
1372 support in the release tools as well.
1363
1373
1364 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1374 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1365
1375
1366 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1376 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1367 version selection (new -wxversion command line and ipythonrc
1377 version selection (new -wxversion command line and ipythonrc
1368 parameter). Patch contributed by Arnd Baecker
1378 parameter). Patch contributed by Arnd Baecker
1369 <arnd.baecker-AT-web.de>.
1379 <arnd.baecker-AT-web.de>.
1370
1380
1371 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1381 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1372 embedded instances, for variables defined at the interactive
1382 embedded instances, for variables defined at the interactive
1373 prompt of the embedded ipython. Reported by Arnd.
1383 prompt of the embedded ipython. Reported by Arnd.
1374
1384
1375 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1385 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1376 it can be used as a (stateful) toggle, or with a direct parameter.
1386 it can be used as a (stateful) toggle, or with a direct parameter.
1377
1387
1378 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1388 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1379 could be triggered in certain cases and cause the traceback
1389 could be triggered in certain cases and cause the traceback
1380 printer not to work.
1390 printer not to work.
1381
1391
1382 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1392 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1383
1393
1384 * IPython/iplib.py (_should_recompile): Small fix, closes
1394 * IPython/iplib.py (_should_recompile): Small fix, closes
1385 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1395 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1386
1396
1387 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1397 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1388
1398
1389 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1399 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1390 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1400 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1391 Moad for help with tracking it down.
1401 Moad for help with tracking it down.
1392
1402
1393 * IPython/iplib.py (handle_auto): fix autocall handling for
1403 * IPython/iplib.py (handle_auto): fix autocall handling for
1394 objects which support BOTH __getitem__ and __call__ (so that f [x]
1404 objects which support BOTH __getitem__ and __call__ (so that f [x]
1395 is left alone, instead of becoming f([x]) automatically).
1405 is left alone, instead of becoming f([x]) automatically).
1396
1406
1397 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1407 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1398 Ville's patch.
1408 Ville's patch.
1399
1409
1400 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1410 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1401
1411
1402 * IPython/iplib.py (handle_auto): changed autocall semantics to
1412 * IPython/iplib.py (handle_auto): changed autocall semantics to
1403 include 'smart' mode, where the autocall transformation is NOT
1413 include 'smart' mode, where the autocall transformation is NOT
1404 applied if there are no arguments on the line. This allows you to
1414 applied if there are no arguments on the line. This allows you to
1405 just type 'foo' if foo is a callable to see its internal form,
1415 just type 'foo' if foo is a callable to see its internal form,
1406 instead of having it called with no arguments (typically a
1416 instead of having it called with no arguments (typically a
1407 mistake). The old 'full' autocall still exists: for that, you
1417 mistake). The old 'full' autocall still exists: for that, you
1408 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1418 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1409
1419
1410 * IPython/completer.py (Completer.attr_matches): add
1420 * IPython/completer.py (Completer.attr_matches): add
1411 tab-completion support for Enthoughts' traits. After a report by
1421 tab-completion support for Enthoughts' traits. After a report by
1412 Arnd and a patch by Prabhu.
1422 Arnd and a patch by Prabhu.
1413
1423
1414 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1424 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1415
1425
1416 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1426 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1417 Schmolck's patch to fix inspect.getinnerframes().
1427 Schmolck's patch to fix inspect.getinnerframes().
1418
1428
1419 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1429 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1420 for embedded instances, regarding handling of namespaces and items
1430 for embedded instances, regarding handling of namespaces and items
1421 added to the __builtin__ one. Multiple embedded instances and
1431 added to the __builtin__ one. Multiple embedded instances and
1422 recursive embeddings should work better now (though I'm not sure
1432 recursive embeddings should work better now (though I'm not sure
1423 I've got all the corner cases fixed, that code is a bit of a brain
1433 I've got all the corner cases fixed, that code is a bit of a brain
1424 twister).
1434 twister).
1425
1435
1426 * IPython/Magic.py (magic_edit): added support to edit in-memory
1436 * IPython/Magic.py (magic_edit): added support to edit in-memory
1427 macros (automatically creates the necessary temp files). %edit
1437 macros (automatically creates the necessary temp files). %edit
1428 also doesn't return the file contents anymore, it's just noise.
1438 also doesn't return the file contents anymore, it's just noise.
1429
1439
1430 * IPython/completer.py (Completer.attr_matches): revert change to
1440 * IPython/completer.py (Completer.attr_matches): revert change to
1431 complete only on attributes listed in __all__. I realized it
1441 complete only on attributes listed in __all__. I realized it
1432 cripples the tab-completion system as a tool for exploring the
1442 cripples the tab-completion system as a tool for exploring the
1433 internals of unknown libraries (it renders any non-__all__
1443 internals of unknown libraries (it renders any non-__all__
1434 attribute off-limits). I got bit by this when trying to see
1444 attribute off-limits). I got bit by this when trying to see
1435 something inside the dis module.
1445 something inside the dis module.
1436
1446
1437 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1447 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1438
1448
1439 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1449 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1440 namespace for users and extension writers to hold data in. This
1450 namespace for users and extension writers to hold data in. This
1441 follows the discussion in
1451 follows the discussion in
1442 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1452 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1443
1453
1444 * IPython/completer.py (IPCompleter.complete): small patch to help
1454 * IPython/completer.py (IPCompleter.complete): small patch to help
1445 tab-completion under Emacs, after a suggestion by John Barnard
1455 tab-completion under Emacs, after a suggestion by John Barnard
1446 <barnarj-AT-ccf.org>.
1456 <barnarj-AT-ccf.org>.
1447
1457
1448 * IPython/Magic.py (Magic.extract_input_slices): added support for
1458 * IPython/Magic.py (Magic.extract_input_slices): added support for
1449 the slice notation in magics to use N-M to represent numbers N...M
1459 the slice notation in magics to use N-M to represent numbers N...M
1450 (closed endpoints). This is used by %macro and %save.
1460 (closed endpoints). This is used by %macro and %save.
1451
1461
1452 * IPython/completer.py (Completer.attr_matches): for modules which
1462 * IPython/completer.py (Completer.attr_matches): for modules which
1453 define __all__, complete only on those. After a patch by Jeffrey
1463 define __all__, complete only on those. After a patch by Jeffrey
1454 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1464 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1455 speed up this routine.
1465 speed up this routine.
1456
1466
1457 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1467 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1458 don't know if this is the end of it, but the behavior now is
1468 don't know if this is the end of it, but the behavior now is
1459 certainly much more correct. Note that coupled with macros,
1469 certainly much more correct. Note that coupled with macros,
1460 slightly surprising (at first) behavior may occur: a macro will in
1470 slightly surprising (at first) behavior may occur: a macro will in
1461 general expand to multiple lines of input, so upon exiting, the
1471 general expand to multiple lines of input, so upon exiting, the
1462 in/out counters will both be bumped by the corresponding amount
1472 in/out counters will both be bumped by the corresponding amount
1463 (as if the macro's contents had been typed interactively). Typing
1473 (as if the macro's contents had been typed interactively). Typing
1464 %hist will reveal the intermediate (silently processed) lines.
1474 %hist will reveal the intermediate (silently processed) lines.
1465
1475
1466 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1476 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1467 pickle to fail (%run was overwriting __main__ and not restoring
1477 pickle to fail (%run was overwriting __main__ and not restoring
1468 it, but pickle relies on __main__ to operate).
1478 it, but pickle relies on __main__ to operate).
1469
1479
1470 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1480 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1471 using properties, but forgot to make the main InteractiveShell
1481 using properties, but forgot to make the main InteractiveShell
1472 class a new-style class. Properties fail silently, and
1482 class a new-style class. Properties fail silently, and
1473 mysteriously, with old-style class (getters work, but
1483 mysteriously, with old-style class (getters work, but
1474 setters don't do anything).
1484 setters don't do anything).
1475
1485
1476 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1486 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1477
1487
1478 * IPython/Magic.py (magic_history): fix history reporting bug (I
1488 * IPython/Magic.py (magic_history): fix history reporting bug (I
1479 know some nasties are still there, I just can't seem to find a
1489 know some nasties are still there, I just can't seem to find a
1480 reproducible test case to track them down; the input history is
1490 reproducible test case to track them down; the input history is
1481 falling out of sync...)
1491 falling out of sync...)
1482
1492
1483 * IPython/iplib.py (handle_shell_escape): fix bug where both
1493 * IPython/iplib.py (handle_shell_escape): fix bug where both
1484 aliases and system accesses where broken for indented code (such
1494 aliases and system accesses where broken for indented code (such
1485 as loops).
1495 as loops).
1486
1496
1487 * IPython/genutils.py (shell): fix small but critical bug for
1497 * IPython/genutils.py (shell): fix small but critical bug for
1488 win32 system access.
1498 win32 system access.
1489
1499
1490 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1500 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1491
1501
1492 * IPython/iplib.py (showtraceback): remove use of the
1502 * IPython/iplib.py (showtraceback): remove use of the
1493 sys.last_{type/value/traceback} structures, which are non
1503 sys.last_{type/value/traceback} structures, which are non
1494 thread-safe.
1504 thread-safe.
1495 (_prefilter): change control flow to ensure that we NEVER
1505 (_prefilter): change control flow to ensure that we NEVER
1496 introspect objects when autocall is off. This will guarantee that
1506 introspect objects when autocall is off. This will guarantee that
1497 having an input line of the form 'x.y', where access to attribute
1507 having an input line of the form 'x.y', where access to attribute
1498 'y' has side effects, doesn't trigger the side effect TWICE. It
1508 'y' has side effects, doesn't trigger the side effect TWICE. It
1499 is important to note that, with autocall on, these side effects
1509 is important to note that, with autocall on, these side effects
1500 can still happen.
1510 can still happen.
1501 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1511 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1502 trio. IPython offers these three kinds of special calls which are
1512 trio. IPython offers these three kinds of special calls which are
1503 not python code, and it's a good thing to have their call method
1513 not python code, and it's a good thing to have their call method
1504 be accessible as pure python functions (not just special syntax at
1514 be accessible as pure python functions (not just special syntax at
1505 the command line). It gives us a better internal implementation
1515 the command line). It gives us a better internal implementation
1506 structure, as well as exposing these for user scripting more
1516 structure, as well as exposing these for user scripting more
1507 cleanly.
1517 cleanly.
1508
1518
1509 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1519 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1510 file. Now that they'll be more likely to be used with the
1520 file. Now that they'll be more likely to be used with the
1511 persistance system (%store), I want to make sure their module path
1521 persistance system (%store), I want to make sure their module path
1512 doesn't change in the future, so that we don't break things for
1522 doesn't change in the future, so that we don't break things for
1513 users' persisted data.
1523 users' persisted data.
1514
1524
1515 * IPython/iplib.py (autoindent_update): move indentation
1525 * IPython/iplib.py (autoindent_update): move indentation
1516 management into the _text_ processing loop, not the keyboard
1526 management into the _text_ processing loop, not the keyboard
1517 interactive one. This is necessary to correctly process non-typed
1527 interactive one. This is necessary to correctly process non-typed
1518 multiline input (such as macros).
1528 multiline input (such as macros).
1519
1529
1520 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1530 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1521 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1531 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1522 which was producing problems in the resulting manual.
1532 which was producing problems in the resulting manual.
1523 (magic_whos): improve reporting of instances (show their class,
1533 (magic_whos): improve reporting of instances (show their class,
1524 instead of simply printing 'instance' which isn't terribly
1534 instead of simply printing 'instance' which isn't terribly
1525 informative).
1535 informative).
1526
1536
1527 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1537 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1528 (minor mods) to support network shares under win32.
1538 (minor mods) to support network shares under win32.
1529
1539
1530 * IPython/winconsole.py (get_console_size): add new winconsole
1540 * IPython/winconsole.py (get_console_size): add new winconsole
1531 module and fixes to page_dumb() to improve its behavior under
1541 module and fixes to page_dumb() to improve its behavior under
1532 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1542 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1533
1543
1534 * IPython/Magic.py (Macro): simplified Macro class to just
1544 * IPython/Magic.py (Macro): simplified Macro class to just
1535 subclass list. We've had only 2.2 compatibility for a very long
1545 subclass list. We've had only 2.2 compatibility for a very long
1536 time, yet I was still avoiding subclassing the builtin types. No
1546 time, yet I was still avoiding subclassing the builtin types. No
1537 more (I'm also starting to use properties, though I won't shift to
1547 more (I'm also starting to use properties, though I won't shift to
1538 2.3-specific features quite yet).
1548 2.3-specific features quite yet).
1539 (magic_store): added Ville's patch for lightweight variable
1549 (magic_store): added Ville's patch for lightweight variable
1540 persistence, after a request on the user list by Matt Wilkie
1550 persistence, after a request on the user list by Matt Wilkie
1541 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1551 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1542 details.
1552 details.
1543
1553
1544 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1554 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1545 changed the default logfile name from 'ipython.log' to
1555 changed the default logfile name from 'ipython.log' to
1546 'ipython_log.py'. These logs are real python files, and now that
1556 'ipython_log.py'. These logs are real python files, and now that
1547 we have much better multiline support, people are more likely to
1557 we have much better multiline support, people are more likely to
1548 want to use them as such. Might as well name them correctly.
1558 want to use them as such. Might as well name them correctly.
1549
1559
1550 * IPython/Magic.py: substantial cleanup. While we can't stop
1560 * IPython/Magic.py: substantial cleanup. While we can't stop
1551 using magics as mixins, due to the existing customizations 'out
1561 using magics as mixins, due to the existing customizations 'out
1552 there' which rely on the mixin naming conventions, at least I
1562 there' which rely on the mixin naming conventions, at least I
1553 cleaned out all cross-class name usage. So once we are OK with
1563 cleaned out all cross-class name usage. So once we are OK with
1554 breaking compatibility, the two systems can be separated.
1564 breaking compatibility, the two systems can be separated.
1555
1565
1556 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1566 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1557 anymore, and the class is a fair bit less hideous as well. New
1567 anymore, and the class is a fair bit less hideous as well. New
1558 features were also introduced: timestamping of input, and logging
1568 features were also introduced: timestamping of input, and logging
1559 of output results. These are user-visible with the -t and -o
1569 of output results. These are user-visible with the -t and -o
1560 options to %logstart. Closes
1570 options to %logstart. Closes
1561 http://www.scipy.net/roundup/ipython/issue11 and a request by
1571 http://www.scipy.net/roundup/ipython/issue11 and a request by
1562 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1572 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1563
1573
1564 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1574 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1565
1575
1566 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1576 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1567 better handle backslashes in paths. See the thread 'More Windows
1577 better handle backslashes in paths. See the thread 'More Windows
1568 questions part 2 - \/ characters revisited' on the iypthon user
1578 questions part 2 - \/ characters revisited' on the iypthon user
1569 list:
1579 list:
1570 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1580 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1571
1581
1572 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1582 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1573
1583
1574 (InteractiveShell.__init__): change threaded shells to not use the
1584 (InteractiveShell.__init__): change threaded shells to not use the
1575 ipython crash handler. This was causing more problems than not,
1585 ipython crash handler. This was causing more problems than not,
1576 as exceptions in the main thread (GUI code, typically) would
1586 as exceptions in the main thread (GUI code, typically) would
1577 always show up as a 'crash', when they really weren't.
1587 always show up as a 'crash', when they really weren't.
1578
1588
1579 The colors and exception mode commands (%colors/%xmode) have been
1589 The colors and exception mode commands (%colors/%xmode) have been
1580 synchronized to also take this into account, so users can get
1590 synchronized to also take this into account, so users can get
1581 verbose exceptions for their threaded code as well. I also added
1591 verbose exceptions for their threaded code as well. I also added
1582 support for activating pdb inside this exception handler as well,
1592 support for activating pdb inside this exception handler as well,
1583 so now GUI authors can use IPython's enhanced pdb at runtime.
1593 so now GUI authors can use IPython's enhanced pdb at runtime.
1584
1594
1585 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1595 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1586 true by default, and add it to the shipped ipythonrc file. Since
1596 true by default, and add it to the shipped ipythonrc file. Since
1587 this asks the user before proceeding, I think it's OK to make it
1597 this asks the user before proceeding, I think it's OK to make it
1588 true by default.
1598 true by default.
1589
1599
1590 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1600 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1591 of the previous special-casing of input in the eval loop. I think
1601 of the previous special-casing of input in the eval loop. I think
1592 this is cleaner, as they really are commands and shouldn't have
1602 this is cleaner, as they really are commands and shouldn't have
1593 a special role in the middle of the core code.
1603 a special role in the middle of the core code.
1594
1604
1595 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1605 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1596
1606
1597 * IPython/iplib.py (edit_syntax_error): added support for
1607 * IPython/iplib.py (edit_syntax_error): added support for
1598 automatically reopening the editor if the file had a syntax error
1608 automatically reopening the editor if the file had a syntax error
1599 in it. Thanks to scottt who provided the patch at:
1609 in it. Thanks to scottt who provided the patch at:
1600 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1610 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1601 version committed).
1611 version committed).
1602
1612
1603 * IPython/iplib.py (handle_normal): add suport for multi-line
1613 * IPython/iplib.py (handle_normal): add suport for multi-line
1604 input with emtpy lines. This fixes
1614 input with emtpy lines. This fixes
1605 http://www.scipy.net/roundup/ipython/issue43 and a similar
1615 http://www.scipy.net/roundup/ipython/issue43 and a similar
1606 discussion on the user list.
1616 discussion on the user list.
1607
1617
1608 WARNING: a behavior change is necessarily introduced to support
1618 WARNING: a behavior change is necessarily introduced to support
1609 blank lines: now a single blank line with whitespace does NOT
1619 blank lines: now a single blank line with whitespace does NOT
1610 break the input loop, which means that when autoindent is on, by
1620 break the input loop, which means that when autoindent is on, by
1611 default hitting return on the next (indented) line does NOT exit.
1621 default hitting return on the next (indented) line does NOT exit.
1612
1622
1613 Instead, to exit a multiline input you can either have:
1623 Instead, to exit a multiline input you can either have:
1614
1624
1615 - TWO whitespace lines (just hit return again), or
1625 - TWO whitespace lines (just hit return again), or
1616 - a single whitespace line of a different length than provided
1626 - a single whitespace line of a different length than provided
1617 by the autoindent (add or remove a space).
1627 by the autoindent (add or remove a space).
1618
1628
1619 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1629 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1620 module to better organize all readline-related functionality.
1630 module to better organize all readline-related functionality.
1621 I've deleted FlexCompleter and put all completion clases here.
1631 I've deleted FlexCompleter and put all completion clases here.
1622
1632
1623 * IPython/iplib.py (raw_input): improve indentation management.
1633 * IPython/iplib.py (raw_input): improve indentation management.
1624 It is now possible to paste indented code with autoindent on, and
1634 It is now possible to paste indented code with autoindent on, and
1625 the code is interpreted correctly (though it still looks bad on
1635 the code is interpreted correctly (though it still looks bad on
1626 screen, due to the line-oriented nature of ipython).
1636 screen, due to the line-oriented nature of ipython).
1627 (MagicCompleter.complete): change behavior so that a TAB key on an
1637 (MagicCompleter.complete): change behavior so that a TAB key on an
1628 otherwise empty line actually inserts a tab, instead of completing
1638 otherwise empty line actually inserts a tab, instead of completing
1629 on the entire global namespace. This makes it easier to use the
1639 on the entire global namespace. This makes it easier to use the
1630 TAB key for indentation. After a request by Hans Meine
1640 TAB key for indentation. After a request by Hans Meine
1631 <hans_meine-AT-gmx.net>
1641 <hans_meine-AT-gmx.net>
1632 (_prefilter): add support so that typing plain 'exit' or 'quit'
1642 (_prefilter): add support so that typing plain 'exit' or 'quit'
1633 does a sensible thing. Originally I tried to deviate as little as
1643 does a sensible thing. Originally I tried to deviate as little as
1634 possible from the default python behavior, but even that one may
1644 possible from the default python behavior, but even that one may
1635 change in this direction (thread on python-dev to that effect).
1645 change in this direction (thread on python-dev to that effect).
1636 Regardless, ipython should do the right thing even if CPython's
1646 Regardless, ipython should do the right thing even if CPython's
1637 '>>>' prompt doesn't.
1647 '>>>' prompt doesn't.
1638 (InteractiveShell): removed subclassing code.InteractiveConsole
1648 (InteractiveShell): removed subclassing code.InteractiveConsole
1639 class. By now we'd overridden just about all of its methods: I've
1649 class. By now we'd overridden just about all of its methods: I've
1640 copied the remaining two over, and now ipython is a standalone
1650 copied the remaining two over, and now ipython is a standalone
1641 class. This will provide a clearer picture for the chainsaw
1651 class. This will provide a clearer picture for the chainsaw
1642 branch refactoring.
1652 branch refactoring.
1643
1653
1644 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1654 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1645
1655
1646 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1656 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1647 failures for objects which break when dir() is called on them.
1657 failures for objects which break when dir() is called on them.
1648
1658
1649 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1659 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1650 distinct local and global namespaces in the completer API. This
1660 distinct local and global namespaces in the completer API. This
1651 change allows us to properly handle completion with distinct
1661 change allows us to properly handle completion with distinct
1652 scopes, including in embedded instances (this had never really
1662 scopes, including in embedded instances (this had never really
1653 worked correctly).
1663 worked correctly).
1654
1664
1655 Note: this introduces a change in the constructor for
1665 Note: this introduces a change in the constructor for
1656 MagicCompleter, as a new global_namespace parameter is now the
1666 MagicCompleter, as a new global_namespace parameter is now the
1657 second argument (the others were bumped one position).
1667 second argument (the others were bumped one position).
1658
1668
1659 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1669 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1660
1670
1661 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1671 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1662 embedded instances (which can be done now thanks to Vivian's
1672 embedded instances (which can be done now thanks to Vivian's
1663 frame-handling fixes for pdb).
1673 frame-handling fixes for pdb).
1664 (InteractiveShell.__init__): Fix namespace handling problem in
1674 (InteractiveShell.__init__): Fix namespace handling problem in
1665 embedded instances. We were overwriting __main__ unconditionally,
1675 embedded instances. We were overwriting __main__ unconditionally,
1666 and this should only be done for 'full' (non-embedded) IPython;
1676 and this should only be done for 'full' (non-embedded) IPython;
1667 embedded instances must respect the caller's __main__. Thanks to
1677 embedded instances must respect the caller's __main__. Thanks to
1668 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1678 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1669
1679
1670 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1680 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1671
1681
1672 * setup.py: added download_url to setup(). This registers the
1682 * setup.py: added download_url to setup(). This registers the
1673 download address at PyPI, which is not only useful to humans
1683 download address at PyPI, which is not only useful to humans
1674 browsing the site, but is also picked up by setuptools (the Eggs
1684 browsing the site, but is also picked up by setuptools (the Eggs
1675 machinery). Thanks to Ville and R. Kern for the info/discussion
1685 machinery). Thanks to Ville and R. Kern for the info/discussion
1676 on this.
1686 on this.
1677
1687
1678 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1688 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1679
1689
1680 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1690 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1681 This brings a lot of nice functionality to the pdb mode, which now
1691 This brings a lot of nice functionality to the pdb mode, which now
1682 has tab-completion, syntax highlighting, and better stack handling
1692 has tab-completion, syntax highlighting, and better stack handling
1683 than before. Many thanks to Vivian De Smedt
1693 than before. Many thanks to Vivian De Smedt
1684 <vivian-AT-vdesmedt.com> for the original patches.
1694 <vivian-AT-vdesmedt.com> for the original patches.
1685
1695
1686 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1696 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1687
1697
1688 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1698 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1689 sequence to consistently accept the banner argument. The
1699 sequence to consistently accept the banner argument. The
1690 inconsistency was tripping SAGE, thanks to Gary Zablackis
1700 inconsistency was tripping SAGE, thanks to Gary Zablackis
1691 <gzabl-AT-yahoo.com> for the report.
1701 <gzabl-AT-yahoo.com> for the report.
1692
1702
1693 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1703 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1694
1704
1695 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1705 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1696 Fix bug where a naked 'alias' call in the ipythonrc file would
1706 Fix bug where a naked 'alias' call in the ipythonrc file would
1697 cause a crash. Bug reported by Jorgen Stenarson.
1707 cause a crash. Bug reported by Jorgen Stenarson.
1698
1708
1699 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1709 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1700
1710
1701 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1711 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1702 startup time.
1712 startup time.
1703
1713
1704 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1714 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1705 instances had introduced a bug with globals in normal code. Now
1715 instances had introduced a bug with globals in normal code. Now
1706 it's working in all cases.
1716 it's working in all cases.
1707
1717
1708 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1718 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1709 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1719 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1710 has been introduced to set the default case sensitivity of the
1720 has been introduced to set the default case sensitivity of the
1711 searches. Users can still select either mode at runtime on a
1721 searches. Users can still select either mode at runtime on a
1712 per-search basis.
1722 per-search basis.
1713
1723
1714 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1724 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1715
1725
1716 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1726 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1717 attributes in wildcard searches for subclasses. Modified version
1727 attributes in wildcard searches for subclasses. Modified version
1718 of a patch by Jorgen.
1728 of a patch by Jorgen.
1719
1729
1720 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1730 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1721
1731
1722 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1732 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1723 embedded instances. I added a user_global_ns attribute to the
1733 embedded instances. I added a user_global_ns attribute to the
1724 InteractiveShell class to handle this.
1734 InteractiveShell class to handle this.
1725
1735
1726 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1736 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1727
1737
1728 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1738 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1729 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1739 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1730 (reported under win32, but may happen also in other platforms).
1740 (reported under win32, but may happen also in other platforms).
1731 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1741 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1732
1742
1733 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1743 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1734
1744
1735 * IPython/Magic.py (magic_psearch): new support for wildcard
1745 * IPython/Magic.py (magic_psearch): new support for wildcard
1736 patterns. Now, typing ?a*b will list all names which begin with a
1746 patterns. Now, typing ?a*b will list all names which begin with a
1737 and end in b, for example. The %psearch magic has full
1747 and end in b, for example. The %psearch magic has full
1738 docstrings. Many thanks to JΓΆrgen Stenarson
1748 docstrings. Many thanks to JΓΆrgen Stenarson
1739 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1749 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1740 implementing this functionality.
1750 implementing this functionality.
1741
1751
1742 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1752 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1743
1753
1744 * Manual: fixed long-standing annoyance of double-dashes (as in
1754 * Manual: fixed long-standing annoyance of double-dashes (as in
1745 --prefix=~, for example) being stripped in the HTML version. This
1755 --prefix=~, for example) being stripped in the HTML version. This
1746 is a latex2html bug, but a workaround was provided. Many thanks
1756 is a latex2html bug, but a workaround was provided. Many thanks
1747 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1757 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1748 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1758 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1749 rolling. This seemingly small issue had tripped a number of users
1759 rolling. This seemingly small issue had tripped a number of users
1750 when first installing, so I'm glad to see it gone.
1760 when first installing, so I'm glad to see it gone.
1751
1761
1752 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1762 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1753
1763
1754 * IPython/Extensions/numeric_formats.py: fix missing import,
1764 * IPython/Extensions/numeric_formats.py: fix missing import,
1755 reported by Stephen Walton.
1765 reported by Stephen Walton.
1756
1766
1757 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1767 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1758
1768
1759 * IPython/demo.py: finish demo module, fully documented now.
1769 * IPython/demo.py: finish demo module, fully documented now.
1760
1770
1761 * IPython/genutils.py (file_read): simple little utility to read a
1771 * IPython/genutils.py (file_read): simple little utility to read a
1762 file and ensure it's closed afterwards.
1772 file and ensure it's closed afterwards.
1763
1773
1764 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1774 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1765
1775
1766 * IPython/demo.py (Demo.__init__): added support for individually
1776 * IPython/demo.py (Demo.__init__): added support for individually
1767 tagging blocks for automatic execution.
1777 tagging blocks for automatic execution.
1768
1778
1769 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1779 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1770 syntax-highlighted python sources, requested by John.
1780 syntax-highlighted python sources, requested by John.
1771
1781
1772 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1782 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1773
1783
1774 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1784 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1775 finishing.
1785 finishing.
1776
1786
1777 * IPython/genutils.py (shlex_split): moved from Magic to here,
1787 * IPython/genutils.py (shlex_split): moved from Magic to here,
1778 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1788 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1779
1789
1780 * IPython/demo.py (Demo.__init__): added support for silent
1790 * IPython/demo.py (Demo.__init__): added support for silent
1781 blocks, improved marks as regexps, docstrings written.
1791 blocks, improved marks as regexps, docstrings written.
1782 (Demo.__init__): better docstring, added support for sys.argv.
1792 (Demo.__init__): better docstring, added support for sys.argv.
1783
1793
1784 * IPython/genutils.py (marquee): little utility used by the demo
1794 * IPython/genutils.py (marquee): little utility used by the demo
1785 code, handy in general.
1795 code, handy in general.
1786
1796
1787 * IPython/demo.py (Demo.__init__): new class for interactive
1797 * IPython/demo.py (Demo.__init__): new class for interactive
1788 demos. Not documented yet, I just wrote it in a hurry for
1798 demos. Not documented yet, I just wrote it in a hurry for
1789 scipy'05. Will docstring later.
1799 scipy'05. Will docstring later.
1790
1800
1791 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1801 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1792
1802
1793 * IPython/Shell.py (sigint_handler): Drastic simplification which
1803 * IPython/Shell.py (sigint_handler): Drastic simplification which
1794 also seems to make Ctrl-C work correctly across threads! This is
1804 also seems to make Ctrl-C work correctly across threads! This is
1795 so simple, that I can't beleive I'd missed it before. Needs more
1805 so simple, that I can't beleive I'd missed it before. Needs more
1796 testing, though.
1806 testing, though.
1797 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1807 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1798 like this before...
1808 like this before...
1799
1809
1800 * IPython/genutils.py (get_home_dir): add protection against
1810 * IPython/genutils.py (get_home_dir): add protection against
1801 non-dirs in win32 registry.
1811 non-dirs in win32 registry.
1802
1812
1803 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1813 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1804 bug where dict was mutated while iterating (pysh crash).
1814 bug where dict was mutated while iterating (pysh crash).
1805
1815
1806 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1816 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1807
1817
1808 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1818 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1809 spurious newlines added by this routine. After a report by
1819 spurious newlines added by this routine. After a report by
1810 F. Mantegazza.
1820 F. Mantegazza.
1811
1821
1812 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1822 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1813
1823
1814 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1824 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1815 calls. These were a leftover from the GTK 1.x days, and can cause
1825 calls. These were a leftover from the GTK 1.x days, and can cause
1816 problems in certain cases (after a report by John Hunter).
1826 problems in certain cases (after a report by John Hunter).
1817
1827
1818 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1828 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1819 os.getcwd() fails at init time. Thanks to patch from David Remahl
1829 os.getcwd() fails at init time. Thanks to patch from David Remahl
1820 <chmod007-AT-mac.com>.
1830 <chmod007-AT-mac.com>.
1821 (InteractiveShell.__init__): prevent certain special magics from
1831 (InteractiveShell.__init__): prevent certain special magics from
1822 being shadowed by aliases. Closes
1832 being shadowed by aliases. Closes
1823 http://www.scipy.net/roundup/ipython/issue41.
1833 http://www.scipy.net/roundup/ipython/issue41.
1824
1834
1825 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1835 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1826
1836
1827 * IPython/iplib.py (InteractiveShell.complete): Added new
1837 * IPython/iplib.py (InteractiveShell.complete): Added new
1828 top-level completion method to expose the completion mechanism
1838 top-level completion method to expose the completion mechanism
1829 beyond readline-based environments.
1839 beyond readline-based environments.
1830
1840
1831 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1841 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1832
1842
1833 * tools/ipsvnc (svnversion): fix svnversion capture.
1843 * tools/ipsvnc (svnversion): fix svnversion capture.
1834
1844
1835 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1845 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1836 attribute to self, which was missing. Before, it was set by a
1846 attribute to self, which was missing. Before, it was set by a
1837 routine which in certain cases wasn't being called, so the
1847 routine which in certain cases wasn't being called, so the
1838 instance could end up missing the attribute. This caused a crash.
1848 instance could end up missing the attribute. This caused a crash.
1839 Closes http://www.scipy.net/roundup/ipython/issue40.
1849 Closes http://www.scipy.net/roundup/ipython/issue40.
1840
1850
1841 2005-08-16 Fernando Perez <fperez@colorado.edu>
1851 2005-08-16 Fernando Perez <fperez@colorado.edu>
1842
1852
1843 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1853 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1844 contains non-string attribute. Closes
1854 contains non-string attribute. Closes
1845 http://www.scipy.net/roundup/ipython/issue38.
1855 http://www.scipy.net/roundup/ipython/issue38.
1846
1856
1847 2005-08-14 Fernando Perez <fperez@colorado.edu>
1857 2005-08-14 Fernando Perez <fperez@colorado.edu>
1848
1858
1849 * tools/ipsvnc: Minor improvements, to add changeset info.
1859 * tools/ipsvnc: Minor improvements, to add changeset info.
1850
1860
1851 2005-08-12 Fernando Perez <fperez@colorado.edu>
1861 2005-08-12 Fernando Perez <fperez@colorado.edu>
1852
1862
1853 * IPython/iplib.py (runsource): remove self.code_to_run_src
1863 * IPython/iplib.py (runsource): remove self.code_to_run_src
1854 attribute. I realized this is nothing more than
1864 attribute. I realized this is nothing more than
1855 '\n'.join(self.buffer), and having the same data in two different
1865 '\n'.join(self.buffer), and having the same data in two different
1856 places is just asking for synchronization bugs. This may impact
1866 places is just asking for synchronization bugs. This may impact
1857 people who have custom exception handlers, so I need to warn
1867 people who have custom exception handlers, so I need to warn
1858 ipython-dev about it (F. Mantegazza may use them).
1868 ipython-dev about it (F. Mantegazza may use them).
1859
1869
1860 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1870 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1861
1871
1862 * IPython/genutils.py: fix 2.2 compatibility (generators)
1872 * IPython/genutils.py: fix 2.2 compatibility (generators)
1863
1873
1864 2005-07-18 Fernando Perez <fperez@colorado.edu>
1874 2005-07-18 Fernando Perez <fperez@colorado.edu>
1865
1875
1866 * IPython/genutils.py (get_home_dir): fix to help users with
1876 * IPython/genutils.py (get_home_dir): fix to help users with
1867 invalid $HOME under win32.
1877 invalid $HOME under win32.
1868
1878
1869 2005-07-17 Fernando Perez <fperez@colorado.edu>
1879 2005-07-17 Fernando Perez <fperez@colorado.edu>
1870
1880
1871 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1881 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1872 some old hacks and clean up a bit other routines; code should be
1882 some old hacks and clean up a bit other routines; code should be
1873 simpler and a bit faster.
1883 simpler and a bit faster.
1874
1884
1875 * IPython/iplib.py (interact): removed some last-resort attempts
1885 * IPython/iplib.py (interact): removed some last-resort attempts
1876 to survive broken stdout/stderr. That code was only making it
1886 to survive broken stdout/stderr. That code was only making it
1877 harder to abstract out the i/o (necessary for gui integration),
1887 harder to abstract out the i/o (necessary for gui integration),
1878 and the crashes it could prevent were extremely rare in practice
1888 and the crashes it could prevent were extremely rare in practice
1879 (besides being fully user-induced in a pretty violent manner).
1889 (besides being fully user-induced in a pretty violent manner).
1880
1890
1881 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1891 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1882 Nothing major yet, but the code is simpler to read; this should
1892 Nothing major yet, but the code is simpler to read; this should
1883 make it easier to do more serious modifications in the future.
1893 make it easier to do more serious modifications in the future.
1884
1894
1885 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1895 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1886 which broke in .15 (thanks to a report by Ville).
1896 which broke in .15 (thanks to a report by Ville).
1887
1897
1888 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1898 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1889 be quite correct, I know next to nothing about unicode). This
1899 be quite correct, I know next to nothing about unicode). This
1890 will allow unicode strings to be used in prompts, amongst other
1900 will allow unicode strings to be used in prompts, amongst other
1891 cases. It also will prevent ipython from crashing when unicode
1901 cases. It also will prevent ipython from crashing when unicode
1892 shows up unexpectedly in many places. If ascii encoding fails, we
1902 shows up unexpectedly in many places. If ascii encoding fails, we
1893 assume utf_8. Currently the encoding is not a user-visible
1903 assume utf_8. Currently the encoding is not a user-visible
1894 setting, though it could be made so if there is demand for it.
1904 setting, though it could be made so if there is demand for it.
1895
1905
1896 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1906 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1897
1907
1898 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1908 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1899
1909
1900 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1910 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1901
1911
1902 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1912 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1903 code can work transparently for 2.2/2.3.
1913 code can work transparently for 2.2/2.3.
1904
1914
1905 2005-07-16 Fernando Perez <fperez@colorado.edu>
1915 2005-07-16 Fernando Perez <fperez@colorado.edu>
1906
1916
1907 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1917 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1908 out of the color scheme table used for coloring exception
1918 out of the color scheme table used for coloring exception
1909 tracebacks. This allows user code to add new schemes at runtime.
1919 tracebacks. This allows user code to add new schemes at runtime.
1910 This is a minimally modified version of the patch at
1920 This is a minimally modified version of the patch at
1911 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1921 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1912 for the contribution.
1922 for the contribution.
1913
1923
1914 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1924 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1915 slightly modified version of the patch in
1925 slightly modified version of the patch in
1916 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1926 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1917 to remove the previous try/except solution (which was costlier).
1927 to remove the previous try/except solution (which was costlier).
1918 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1928 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1919
1929
1920 2005-06-08 Fernando Perez <fperez@colorado.edu>
1930 2005-06-08 Fernando Perez <fperez@colorado.edu>
1921
1931
1922 * IPython/iplib.py (write/write_err): Add methods to abstract all
1932 * IPython/iplib.py (write/write_err): Add methods to abstract all
1923 I/O a bit more.
1933 I/O a bit more.
1924
1934
1925 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1935 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1926 warning, reported by Aric Hagberg, fix by JD Hunter.
1936 warning, reported by Aric Hagberg, fix by JD Hunter.
1927
1937
1928 2005-06-02 *** Released version 0.6.15
1938 2005-06-02 *** Released version 0.6.15
1929
1939
1930 2005-06-01 Fernando Perez <fperez@colorado.edu>
1940 2005-06-01 Fernando Perez <fperez@colorado.edu>
1931
1941
1932 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1942 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1933 tab-completion of filenames within open-quoted strings. Note that
1943 tab-completion of filenames within open-quoted strings. Note that
1934 this requires that in ~/.ipython/ipythonrc, users change the
1944 this requires that in ~/.ipython/ipythonrc, users change the
1935 readline delimiters configuration to read:
1945 readline delimiters configuration to read:
1936
1946
1937 readline_remove_delims -/~
1947 readline_remove_delims -/~
1938
1948
1939
1949
1940 2005-05-31 *** Released version 0.6.14
1950 2005-05-31 *** Released version 0.6.14
1941
1951
1942 2005-05-29 Fernando Perez <fperez@colorado.edu>
1952 2005-05-29 Fernando Perez <fperez@colorado.edu>
1943
1953
1944 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1954 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1945 with files not on the filesystem. Reported by Eliyahu Sandler
1955 with files not on the filesystem. Reported by Eliyahu Sandler
1946 <eli@gondolin.net>
1956 <eli@gondolin.net>
1947
1957
1948 2005-05-22 Fernando Perez <fperez@colorado.edu>
1958 2005-05-22 Fernando Perez <fperez@colorado.edu>
1949
1959
1950 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1960 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1951 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1961 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1952
1962
1953 2005-05-19 Fernando Perez <fperez@colorado.edu>
1963 2005-05-19 Fernando Perez <fperez@colorado.edu>
1954
1964
1955 * IPython/iplib.py (safe_execfile): close a file which could be
1965 * IPython/iplib.py (safe_execfile): close a file which could be
1956 left open (causing problems in win32, which locks open files).
1966 left open (causing problems in win32, which locks open files).
1957 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1967 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1958
1968
1959 2005-05-18 Fernando Perez <fperez@colorado.edu>
1969 2005-05-18 Fernando Perez <fperez@colorado.edu>
1960
1970
1961 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1971 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1962 keyword arguments correctly to safe_execfile().
1972 keyword arguments correctly to safe_execfile().
1963
1973
1964 2005-05-13 Fernando Perez <fperez@colorado.edu>
1974 2005-05-13 Fernando Perez <fperez@colorado.edu>
1965
1975
1966 * ipython.1: Added info about Qt to manpage, and threads warning
1976 * ipython.1: Added info about Qt to manpage, and threads warning
1967 to usage page (invoked with --help).
1977 to usage page (invoked with --help).
1968
1978
1969 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1979 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1970 new matcher (it goes at the end of the priority list) to do
1980 new matcher (it goes at the end of the priority list) to do
1971 tab-completion on named function arguments. Submitted by George
1981 tab-completion on named function arguments. Submitted by George
1972 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1982 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1973 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1983 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1974 for more details.
1984 for more details.
1975
1985
1976 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1986 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1977 SystemExit exceptions in the script being run. Thanks to a report
1987 SystemExit exceptions in the script being run. Thanks to a report
1978 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1988 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1979 producing very annoying behavior when running unit tests.
1989 producing very annoying behavior when running unit tests.
1980
1990
1981 2005-05-12 Fernando Perez <fperez@colorado.edu>
1991 2005-05-12 Fernando Perez <fperez@colorado.edu>
1982
1992
1983 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1993 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1984 which I'd broken (again) due to a changed regexp. In the process,
1994 which I'd broken (again) due to a changed regexp. In the process,
1985 added ';' as an escape to auto-quote the whole line without
1995 added ';' as an escape to auto-quote the whole line without
1986 splitting its arguments. Thanks to a report by Jerry McRae
1996 splitting its arguments. Thanks to a report by Jerry McRae
1987 <qrs0xyc02-AT-sneakemail.com>.
1997 <qrs0xyc02-AT-sneakemail.com>.
1988
1998
1989 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1999 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1990 possible crashes caused by a TokenError. Reported by Ed Schofield
2000 possible crashes caused by a TokenError. Reported by Ed Schofield
1991 <schofield-AT-ftw.at>.
2001 <schofield-AT-ftw.at>.
1992
2002
1993 2005-05-06 Fernando Perez <fperez@colorado.edu>
2003 2005-05-06 Fernando Perez <fperez@colorado.edu>
1994
2004
1995 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2005 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1996
2006
1997 2005-04-29 Fernando Perez <fperez@colorado.edu>
2007 2005-04-29 Fernando Perez <fperez@colorado.edu>
1998
2008
1999 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2009 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2000 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2010 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2001 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2011 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2002 which provides support for Qt interactive usage (similar to the
2012 which provides support for Qt interactive usage (similar to the
2003 existing one for WX and GTK). This had been often requested.
2013 existing one for WX and GTK). This had been often requested.
2004
2014
2005 2005-04-14 *** Released version 0.6.13
2015 2005-04-14 *** Released version 0.6.13
2006
2016
2007 2005-04-08 Fernando Perez <fperez@colorado.edu>
2017 2005-04-08 Fernando Perez <fperez@colorado.edu>
2008
2018
2009 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2019 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2010 from _ofind, which gets called on almost every input line. Now,
2020 from _ofind, which gets called on almost every input line. Now,
2011 we only try to get docstrings if they are actually going to be
2021 we only try to get docstrings if they are actually going to be
2012 used (the overhead of fetching unnecessary docstrings can be
2022 used (the overhead of fetching unnecessary docstrings can be
2013 noticeable for certain objects, such as Pyro proxies).
2023 noticeable for certain objects, such as Pyro proxies).
2014
2024
2015 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2025 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2016 for completers. For some reason I had been passing them the state
2026 for completers. For some reason I had been passing them the state
2017 variable, which completers never actually need, and was in
2027 variable, which completers never actually need, and was in
2018 conflict with the rlcompleter API. Custom completers ONLY need to
2028 conflict with the rlcompleter API. Custom completers ONLY need to
2019 take the text parameter.
2029 take the text parameter.
2020
2030
2021 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2031 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2022 work correctly in pysh. I've also moved all the logic which used
2032 work correctly in pysh. I've also moved all the logic which used
2023 to be in pysh.py here, which will prevent problems with future
2033 to be in pysh.py here, which will prevent problems with future
2024 upgrades. However, this time I must warn users to update their
2034 upgrades. However, this time I must warn users to update their
2025 pysh profile to include the line
2035 pysh profile to include the line
2026
2036
2027 import_all IPython.Extensions.InterpreterExec
2037 import_all IPython.Extensions.InterpreterExec
2028
2038
2029 because otherwise things won't work for them. They MUST also
2039 because otherwise things won't work for them. They MUST also
2030 delete pysh.py and the line
2040 delete pysh.py and the line
2031
2041
2032 execfile pysh.py
2042 execfile pysh.py
2033
2043
2034 from their ipythonrc-pysh.
2044 from their ipythonrc-pysh.
2035
2045
2036 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2046 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2037 robust in the face of objects whose dir() returns non-strings
2047 robust in the face of objects whose dir() returns non-strings
2038 (which it shouldn't, but some broken libs like ITK do). Thanks to
2048 (which it shouldn't, but some broken libs like ITK do). Thanks to
2039 a patch by John Hunter (implemented differently, though). Also
2049 a patch by John Hunter (implemented differently, though). Also
2040 minor improvements by using .extend instead of + on lists.
2050 minor improvements by using .extend instead of + on lists.
2041
2051
2042 * pysh.py:
2052 * pysh.py:
2043
2053
2044 2005-04-06 Fernando Perez <fperez@colorado.edu>
2054 2005-04-06 Fernando Perez <fperez@colorado.edu>
2045
2055
2046 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2056 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2047 by default, so that all users benefit from it. Those who don't
2057 by default, so that all users benefit from it. Those who don't
2048 want it can still turn it off.
2058 want it can still turn it off.
2049
2059
2050 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2060 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2051 config file, I'd forgotten about this, so users were getting it
2061 config file, I'd forgotten about this, so users were getting it
2052 off by default.
2062 off by default.
2053
2063
2054 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2064 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2055 consistency. Now magics can be called in multiline statements,
2065 consistency. Now magics can be called in multiline statements,
2056 and python variables can be expanded in magic calls via $var.
2066 and python variables can be expanded in magic calls via $var.
2057 This makes the magic system behave just like aliases or !system
2067 This makes the magic system behave just like aliases or !system
2058 calls.
2068 calls.
2059
2069
2060 2005-03-28 Fernando Perez <fperez@colorado.edu>
2070 2005-03-28 Fernando Perez <fperez@colorado.edu>
2061
2071
2062 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2072 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2063 expensive string additions for building command. Add support for
2073 expensive string additions for building command. Add support for
2064 trailing ';' when autocall is used.
2074 trailing ';' when autocall is used.
2065
2075
2066 2005-03-26 Fernando Perez <fperez@colorado.edu>
2076 2005-03-26 Fernando Perez <fperez@colorado.edu>
2067
2077
2068 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2078 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2069 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2079 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2070 ipython.el robust against prompts with any number of spaces
2080 ipython.el robust against prompts with any number of spaces
2071 (including 0) after the ':' character.
2081 (including 0) after the ':' character.
2072
2082
2073 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2083 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2074 continuation prompt, which misled users to think the line was
2084 continuation prompt, which misled users to think the line was
2075 already indented. Closes debian Bug#300847, reported to me by
2085 already indented. Closes debian Bug#300847, reported to me by
2076 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2086 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2077
2087
2078 2005-03-23 Fernando Perez <fperez@colorado.edu>
2088 2005-03-23 Fernando Perez <fperez@colorado.edu>
2079
2089
2080 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2090 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2081 properly aligned if they have embedded newlines.
2091 properly aligned if they have embedded newlines.
2082
2092
2083 * IPython/iplib.py (runlines): Add a public method to expose
2093 * IPython/iplib.py (runlines): Add a public method to expose
2084 IPython's code execution machinery, so that users can run strings
2094 IPython's code execution machinery, so that users can run strings
2085 as if they had been typed at the prompt interactively.
2095 as if they had been typed at the prompt interactively.
2086 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2096 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2087 methods which can call the system shell, but with python variable
2097 methods which can call the system shell, but with python variable
2088 expansion. The three such methods are: __IPYTHON__.system,
2098 expansion. The three such methods are: __IPYTHON__.system,
2089 .getoutput and .getoutputerror. These need to be documented in a
2099 .getoutput and .getoutputerror. These need to be documented in a
2090 'public API' section (to be written) of the manual.
2100 'public API' section (to be written) of the manual.
2091
2101
2092 2005-03-20 Fernando Perez <fperez@colorado.edu>
2102 2005-03-20 Fernando Perez <fperez@colorado.edu>
2093
2103
2094 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2104 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2095 for custom exception handling. This is quite powerful, and it
2105 for custom exception handling. This is quite powerful, and it
2096 allows for user-installable exception handlers which can trap
2106 allows for user-installable exception handlers which can trap
2097 custom exceptions at runtime and treat them separately from
2107 custom exceptions at runtime and treat them separately from
2098 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2108 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2099 Mantegazza <mantegazza-AT-ill.fr>.
2109 Mantegazza <mantegazza-AT-ill.fr>.
2100 (InteractiveShell.set_custom_completer): public API function to
2110 (InteractiveShell.set_custom_completer): public API function to
2101 add new completers at runtime.
2111 add new completers at runtime.
2102
2112
2103 2005-03-19 Fernando Perez <fperez@colorado.edu>
2113 2005-03-19 Fernando Perez <fperez@colorado.edu>
2104
2114
2105 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2115 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2106 allow objects which provide their docstrings via non-standard
2116 allow objects which provide their docstrings via non-standard
2107 mechanisms (like Pyro proxies) to still be inspected by ipython's
2117 mechanisms (like Pyro proxies) to still be inspected by ipython's
2108 ? system.
2118 ? system.
2109
2119
2110 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2120 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2111 automatic capture system. I tried quite hard to make it work
2121 automatic capture system. I tried quite hard to make it work
2112 reliably, and simply failed. I tried many combinations with the
2122 reliably, and simply failed. I tried many combinations with the
2113 subprocess module, but eventually nothing worked in all needed
2123 subprocess module, but eventually nothing worked in all needed
2114 cases (not blocking stdin for the child, duplicating stdout
2124 cases (not blocking stdin for the child, duplicating stdout
2115 without blocking, etc). The new %sc/%sx still do capture to these
2125 without blocking, etc). The new %sc/%sx still do capture to these
2116 magical list/string objects which make shell use much more
2126 magical list/string objects which make shell use much more
2117 conveninent, so not all is lost.
2127 conveninent, so not all is lost.
2118
2128
2119 XXX - FIX MANUAL for the change above!
2129 XXX - FIX MANUAL for the change above!
2120
2130
2121 (runsource): I copied code.py's runsource() into ipython to modify
2131 (runsource): I copied code.py's runsource() into ipython to modify
2122 it a bit. Now the code object and source to be executed are
2132 it a bit. Now the code object and source to be executed are
2123 stored in ipython. This makes this info accessible to third-party
2133 stored in ipython. This makes this info accessible to third-party
2124 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2134 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2125 Mantegazza <mantegazza-AT-ill.fr>.
2135 Mantegazza <mantegazza-AT-ill.fr>.
2126
2136
2127 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2137 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2128 history-search via readline (like C-p/C-n). I'd wanted this for a
2138 history-search via readline (like C-p/C-n). I'd wanted this for a
2129 long time, but only recently found out how to do it. For users
2139 long time, but only recently found out how to do it. For users
2130 who already have their ipythonrc files made and want this, just
2140 who already have their ipythonrc files made and want this, just
2131 add:
2141 add:
2132
2142
2133 readline_parse_and_bind "\e[A": history-search-backward
2143 readline_parse_and_bind "\e[A": history-search-backward
2134 readline_parse_and_bind "\e[B": history-search-forward
2144 readline_parse_and_bind "\e[B": history-search-forward
2135
2145
2136 2005-03-18 Fernando Perez <fperez@colorado.edu>
2146 2005-03-18 Fernando Perez <fperez@colorado.edu>
2137
2147
2138 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2148 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2139 LSString and SList classes which allow transparent conversions
2149 LSString and SList classes which allow transparent conversions
2140 between list mode and whitespace-separated string.
2150 between list mode and whitespace-separated string.
2141 (magic_r): Fix recursion problem in %r.
2151 (magic_r): Fix recursion problem in %r.
2142
2152
2143 * IPython/genutils.py (LSString): New class to be used for
2153 * IPython/genutils.py (LSString): New class to be used for
2144 automatic storage of the results of all alias/system calls in _o
2154 automatic storage of the results of all alias/system calls in _o
2145 and _e (stdout/err). These provide a .l/.list attribute which
2155 and _e (stdout/err). These provide a .l/.list attribute which
2146 does automatic splitting on newlines. This means that for most
2156 does automatic splitting on newlines. This means that for most
2147 uses, you'll never need to do capturing of output with %sc/%sx
2157 uses, you'll never need to do capturing of output with %sc/%sx
2148 anymore, since ipython keeps this always done for you. Note that
2158 anymore, since ipython keeps this always done for you. Note that
2149 only the LAST results are stored, the _o/e variables are
2159 only the LAST results are stored, the _o/e variables are
2150 overwritten on each call. If you need to save their contents
2160 overwritten on each call. If you need to save their contents
2151 further, simply bind them to any other name.
2161 further, simply bind them to any other name.
2152
2162
2153 2005-03-17 Fernando Perez <fperez@colorado.edu>
2163 2005-03-17 Fernando Perez <fperez@colorado.edu>
2154
2164
2155 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2165 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2156 prompt namespace handling.
2166 prompt namespace handling.
2157
2167
2158 2005-03-16 Fernando Perez <fperez@colorado.edu>
2168 2005-03-16 Fernando Perez <fperez@colorado.edu>
2159
2169
2160 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2170 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2161 classic prompts to be '>>> ' (final space was missing, and it
2171 classic prompts to be '>>> ' (final space was missing, and it
2162 trips the emacs python mode).
2172 trips the emacs python mode).
2163 (BasePrompt.__str__): Added safe support for dynamic prompt
2173 (BasePrompt.__str__): Added safe support for dynamic prompt
2164 strings. Now you can set your prompt string to be '$x', and the
2174 strings. Now you can set your prompt string to be '$x', and the
2165 value of x will be printed from your interactive namespace. The
2175 value of x will be printed from your interactive namespace. The
2166 interpolation syntax includes the full Itpl support, so
2176 interpolation syntax includes the full Itpl support, so
2167 ${foo()+x+bar()} is a valid prompt string now, and the function
2177 ${foo()+x+bar()} is a valid prompt string now, and the function
2168 calls will be made at runtime.
2178 calls will be made at runtime.
2169
2179
2170 2005-03-15 Fernando Perez <fperez@colorado.edu>
2180 2005-03-15 Fernando Perez <fperez@colorado.edu>
2171
2181
2172 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2182 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2173 avoid name clashes in pylab. %hist still works, it just forwards
2183 avoid name clashes in pylab. %hist still works, it just forwards
2174 the call to %history.
2184 the call to %history.
2175
2185
2176 2005-03-02 *** Released version 0.6.12
2186 2005-03-02 *** Released version 0.6.12
2177
2187
2178 2005-03-02 Fernando Perez <fperez@colorado.edu>
2188 2005-03-02 Fernando Perez <fperez@colorado.edu>
2179
2189
2180 * IPython/iplib.py (handle_magic): log magic calls properly as
2190 * IPython/iplib.py (handle_magic): log magic calls properly as
2181 ipmagic() function calls.
2191 ipmagic() function calls.
2182
2192
2183 * IPython/Magic.py (magic_time): Improved %time to support
2193 * IPython/Magic.py (magic_time): Improved %time to support
2184 statements and provide wall-clock as well as CPU time.
2194 statements and provide wall-clock as well as CPU time.
2185
2195
2186 2005-02-27 Fernando Perez <fperez@colorado.edu>
2196 2005-02-27 Fernando Perez <fperez@colorado.edu>
2187
2197
2188 * IPython/hooks.py: New hooks module, to expose user-modifiable
2198 * IPython/hooks.py: New hooks module, to expose user-modifiable
2189 IPython functionality in a clean manner. For now only the editor
2199 IPython functionality in a clean manner. For now only the editor
2190 hook is actually written, and other thigns which I intend to turn
2200 hook is actually written, and other thigns which I intend to turn
2191 into proper hooks aren't yet there. The display and prefilter
2201 into proper hooks aren't yet there. The display and prefilter
2192 stuff, for example, should be hooks. But at least now the
2202 stuff, for example, should be hooks. But at least now the
2193 framework is in place, and the rest can be moved here with more
2203 framework is in place, and the rest can be moved here with more
2194 time later. IPython had had a .hooks variable for a long time for
2204 time later. IPython had had a .hooks variable for a long time for
2195 this purpose, but I'd never actually used it for anything.
2205 this purpose, but I'd never actually used it for anything.
2196
2206
2197 2005-02-26 Fernando Perez <fperez@colorado.edu>
2207 2005-02-26 Fernando Perez <fperez@colorado.edu>
2198
2208
2199 * IPython/ipmaker.py (make_IPython): make the default ipython
2209 * IPython/ipmaker.py (make_IPython): make the default ipython
2200 directory be called _ipython under win32, to follow more the
2210 directory be called _ipython under win32, to follow more the
2201 naming peculiarities of that platform (where buggy software like
2211 naming peculiarities of that platform (where buggy software like
2202 Visual Sourcesafe breaks with .named directories). Reported by
2212 Visual Sourcesafe breaks with .named directories). Reported by
2203 Ville Vainio.
2213 Ville Vainio.
2204
2214
2205 2005-02-23 Fernando Perez <fperez@colorado.edu>
2215 2005-02-23 Fernando Perez <fperez@colorado.edu>
2206
2216
2207 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2217 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2208 auto_aliases for win32 which were causing problems. Users can
2218 auto_aliases for win32 which were causing problems. Users can
2209 define the ones they personally like.
2219 define the ones they personally like.
2210
2220
2211 2005-02-21 Fernando Perez <fperez@colorado.edu>
2221 2005-02-21 Fernando Perez <fperez@colorado.edu>
2212
2222
2213 * IPython/Magic.py (magic_time): new magic to time execution of
2223 * IPython/Magic.py (magic_time): new magic to time execution of
2214 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2224 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2215
2225
2216 2005-02-19 Fernando Perez <fperez@colorado.edu>
2226 2005-02-19 Fernando Perez <fperez@colorado.edu>
2217
2227
2218 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2228 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2219 into keys (for prompts, for example).
2229 into keys (for prompts, for example).
2220
2230
2221 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2231 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2222 prompts in case users want them. This introduces a small behavior
2232 prompts in case users want them. This introduces a small behavior
2223 change: ipython does not automatically add a space to all prompts
2233 change: ipython does not automatically add a space to all prompts
2224 anymore. To get the old prompts with a space, users should add it
2234 anymore. To get the old prompts with a space, users should add it
2225 manually to their ipythonrc file, so for example prompt_in1 should
2235 manually to their ipythonrc file, so for example prompt_in1 should
2226 now read 'In [\#]: ' instead of 'In [\#]:'.
2236 now read 'In [\#]: ' instead of 'In [\#]:'.
2227 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2237 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2228 file) to control left-padding of secondary prompts.
2238 file) to control left-padding of secondary prompts.
2229
2239
2230 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2240 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2231 the profiler can't be imported. Fix for Debian, which removed
2241 the profiler can't be imported. Fix for Debian, which removed
2232 profile.py because of License issues. I applied a slightly
2242 profile.py because of License issues. I applied a slightly
2233 modified version of the original Debian patch at
2243 modified version of the original Debian patch at
2234 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2244 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2235
2245
2236 2005-02-17 Fernando Perez <fperez@colorado.edu>
2246 2005-02-17 Fernando Perez <fperez@colorado.edu>
2237
2247
2238 * IPython/genutils.py (native_line_ends): Fix bug which would
2248 * IPython/genutils.py (native_line_ends): Fix bug which would
2239 cause improper line-ends under win32 b/c I was not opening files
2249 cause improper line-ends under win32 b/c I was not opening files
2240 in binary mode. Bug report and fix thanks to Ville.
2250 in binary mode. Bug report and fix thanks to Ville.
2241
2251
2242 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2252 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2243 trying to catch spurious foo[1] autocalls. My fix actually broke
2253 trying to catch spurious foo[1] autocalls. My fix actually broke
2244 ',/' autoquote/call with explicit escape (bad regexp).
2254 ',/' autoquote/call with explicit escape (bad regexp).
2245
2255
2246 2005-02-15 *** Released version 0.6.11
2256 2005-02-15 *** Released version 0.6.11
2247
2257
2248 2005-02-14 Fernando Perez <fperez@colorado.edu>
2258 2005-02-14 Fernando Perez <fperez@colorado.edu>
2249
2259
2250 * IPython/background_jobs.py: New background job management
2260 * IPython/background_jobs.py: New background job management
2251 subsystem. This is implemented via a new set of classes, and
2261 subsystem. This is implemented via a new set of classes, and
2252 IPython now provides a builtin 'jobs' object for background job
2262 IPython now provides a builtin 'jobs' object for background job
2253 execution. A convenience %bg magic serves as a lightweight
2263 execution. A convenience %bg magic serves as a lightweight
2254 frontend for starting the more common type of calls. This was
2264 frontend for starting the more common type of calls. This was
2255 inspired by discussions with B. Granger and the BackgroundCommand
2265 inspired by discussions with B. Granger and the BackgroundCommand
2256 class described in the book Python Scripting for Computational
2266 class described in the book Python Scripting for Computational
2257 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2267 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2258 (although ultimately no code from this text was used, as IPython's
2268 (although ultimately no code from this text was used, as IPython's
2259 system is a separate implementation).
2269 system is a separate implementation).
2260
2270
2261 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2271 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2262 to control the completion of single/double underscore names
2272 to control the completion of single/double underscore names
2263 separately. As documented in the example ipytonrc file, the
2273 separately. As documented in the example ipytonrc file, the
2264 readline_omit__names variable can now be set to 2, to omit even
2274 readline_omit__names variable can now be set to 2, to omit even
2265 single underscore names. Thanks to a patch by Brian Wong
2275 single underscore names. Thanks to a patch by Brian Wong
2266 <BrianWong-AT-AirgoNetworks.Com>.
2276 <BrianWong-AT-AirgoNetworks.Com>.
2267 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2277 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2268 be autocalled as foo([1]) if foo were callable. A problem for
2278 be autocalled as foo([1]) if foo were callable. A problem for
2269 things which are both callable and implement __getitem__.
2279 things which are both callable and implement __getitem__.
2270 (init_readline): Fix autoindentation for win32. Thanks to a patch
2280 (init_readline): Fix autoindentation for win32. Thanks to a patch
2271 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2281 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2272
2282
2273 2005-02-12 Fernando Perez <fperez@colorado.edu>
2283 2005-02-12 Fernando Perez <fperez@colorado.edu>
2274
2284
2275 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2285 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2276 which I had written long ago to sort out user error messages which
2286 which I had written long ago to sort out user error messages which
2277 may occur during startup. This seemed like a good idea initially,
2287 may occur during startup. This seemed like a good idea initially,
2278 but it has proven a disaster in retrospect. I don't want to
2288 but it has proven a disaster in retrospect. I don't want to
2279 change much code for now, so my fix is to set the internal 'debug'
2289 change much code for now, so my fix is to set the internal 'debug'
2280 flag to true everywhere, whose only job was precisely to control
2290 flag to true everywhere, whose only job was precisely to control
2281 this subsystem. This closes issue 28 (as well as avoiding all
2291 this subsystem. This closes issue 28 (as well as avoiding all
2282 sorts of strange hangups which occur from time to time).
2292 sorts of strange hangups which occur from time to time).
2283
2293
2284 2005-02-07 Fernando Perez <fperez@colorado.edu>
2294 2005-02-07 Fernando Perez <fperez@colorado.edu>
2285
2295
2286 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2296 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2287 previous call produced a syntax error.
2297 previous call produced a syntax error.
2288
2298
2289 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2299 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2290 classes without constructor.
2300 classes without constructor.
2291
2301
2292 2005-02-06 Fernando Perez <fperez@colorado.edu>
2302 2005-02-06 Fernando Perez <fperez@colorado.edu>
2293
2303
2294 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2304 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2295 completions with the results of each matcher, so we return results
2305 completions with the results of each matcher, so we return results
2296 to the user from all namespaces. This breaks with ipython
2306 to the user from all namespaces. This breaks with ipython
2297 tradition, but I think it's a nicer behavior. Now you get all
2307 tradition, but I think it's a nicer behavior. Now you get all
2298 possible completions listed, from all possible namespaces (python,
2308 possible completions listed, from all possible namespaces (python,
2299 filesystem, magics...) After a request by John Hunter
2309 filesystem, magics...) After a request by John Hunter
2300 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2310 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2301
2311
2302 2005-02-05 Fernando Perez <fperez@colorado.edu>
2312 2005-02-05 Fernando Perez <fperez@colorado.edu>
2303
2313
2304 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2314 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2305 the call had quote characters in it (the quotes were stripped).
2315 the call had quote characters in it (the quotes were stripped).
2306
2316
2307 2005-01-31 Fernando Perez <fperez@colorado.edu>
2317 2005-01-31 Fernando Perez <fperez@colorado.edu>
2308
2318
2309 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2319 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2310 Itpl.itpl() to make the code more robust against psyco
2320 Itpl.itpl() to make the code more robust against psyco
2311 optimizations.
2321 optimizations.
2312
2322
2313 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2323 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2314 of causing an exception. Quicker, cleaner.
2324 of causing an exception. Quicker, cleaner.
2315
2325
2316 2005-01-28 Fernando Perez <fperez@colorado.edu>
2326 2005-01-28 Fernando Perez <fperez@colorado.edu>
2317
2327
2318 * scripts/ipython_win_post_install.py (install): hardcode
2328 * scripts/ipython_win_post_install.py (install): hardcode
2319 sys.prefix+'python.exe' as the executable path. It turns out that
2329 sys.prefix+'python.exe' as the executable path. It turns out that
2320 during the post-installation run, sys.executable resolves to the
2330 during the post-installation run, sys.executable resolves to the
2321 name of the binary installer! I should report this as a distutils
2331 name of the binary installer! I should report this as a distutils
2322 bug, I think. I updated the .10 release with this tiny fix, to
2332 bug, I think. I updated the .10 release with this tiny fix, to
2323 avoid annoying the lists further.
2333 avoid annoying the lists further.
2324
2334
2325 2005-01-27 *** Released version 0.6.10
2335 2005-01-27 *** Released version 0.6.10
2326
2336
2327 2005-01-27 Fernando Perez <fperez@colorado.edu>
2337 2005-01-27 Fernando Perez <fperez@colorado.edu>
2328
2338
2329 * IPython/numutils.py (norm): Added 'inf' as optional name for
2339 * IPython/numutils.py (norm): Added 'inf' as optional name for
2330 L-infinity norm, included references to mathworld.com for vector
2340 L-infinity norm, included references to mathworld.com for vector
2331 norm definitions.
2341 norm definitions.
2332 (amin/amax): added amin/amax for array min/max. Similar to what
2342 (amin/amax): added amin/amax for array min/max. Similar to what
2333 pylab ships with after the recent reorganization of names.
2343 pylab ships with after the recent reorganization of names.
2334 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2344 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2335
2345
2336 * ipython.el: committed Alex's recent fixes and improvements.
2346 * ipython.el: committed Alex's recent fixes and improvements.
2337 Tested with python-mode from CVS, and it looks excellent. Since
2347 Tested with python-mode from CVS, and it looks excellent. Since
2338 python-mode hasn't released anything in a while, I'm temporarily
2348 python-mode hasn't released anything in a while, I'm temporarily
2339 putting a copy of today's CVS (v 4.70) of python-mode in:
2349 putting a copy of today's CVS (v 4.70) of python-mode in:
2340 http://ipython.scipy.org/tmp/python-mode.el
2350 http://ipython.scipy.org/tmp/python-mode.el
2341
2351
2342 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2352 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2343 sys.executable for the executable name, instead of assuming it's
2353 sys.executable for the executable name, instead of assuming it's
2344 called 'python.exe' (the post-installer would have produced broken
2354 called 'python.exe' (the post-installer would have produced broken
2345 setups on systems with a differently named python binary).
2355 setups on systems with a differently named python binary).
2346
2356
2347 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2357 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2348 references to os.linesep, to make the code more
2358 references to os.linesep, to make the code more
2349 platform-independent. This is also part of the win32 coloring
2359 platform-independent. This is also part of the win32 coloring
2350 fixes.
2360 fixes.
2351
2361
2352 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2362 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2353 lines, which actually cause coloring bugs because the length of
2363 lines, which actually cause coloring bugs because the length of
2354 the line is very difficult to correctly compute with embedded
2364 the line is very difficult to correctly compute with embedded
2355 escapes. This was the source of all the coloring problems under
2365 escapes. This was the source of all the coloring problems under
2356 Win32. I think that _finally_, Win32 users have a properly
2366 Win32. I think that _finally_, Win32 users have a properly
2357 working ipython in all respects. This would never have happened
2367 working ipython in all respects. This would never have happened
2358 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2368 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2359
2369
2360 2005-01-26 *** Released version 0.6.9
2370 2005-01-26 *** Released version 0.6.9
2361
2371
2362 2005-01-25 Fernando Perez <fperez@colorado.edu>
2372 2005-01-25 Fernando Perez <fperez@colorado.edu>
2363
2373
2364 * setup.py: finally, we have a true Windows installer, thanks to
2374 * setup.py: finally, we have a true Windows installer, thanks to
2365 the excellent work of Viktor Ransmayr
2375 the excellent work of Viktor Ransmayr
2366 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2376 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2367 Windows users. The setup routine is quite a bit cleaner thanks to
2377 Windows users. The setup routine is quite a bit cleaner thanks to
2368 this, and the post-install script uses the proper functions to
2378 this, and the post-install script uses the proper functions to
2369 allow a clean de-installation using the standard Windows Control
2379 allow a clean de-installation using the standard Windows Control
2370 Panel.
2380 Panel.
2371
2381
2372 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2382 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2373 environment variable under all OSes (including win32) if
2383 environment variable under all OSes (including win32) if
2374 available. This will give consistency to win32 users who have set
2384 available. This will give consistency to win32 users who have set
2375 this variable for any reason. If os.environ['HOME'] fails, the
2385 this variable for any reason. If os.environ['HOME'] fails, the
2376 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2386 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2377
2387
2378 2005-01-24 Fernando Perez <fperez@colorado.edu>
2388 2005-01-24 Fernando Perez <fperez@colorado.edu>
2379
2389
2380 * IPython/numutils.py (empty_like): add empty_like(), similar to
2390 * IPython/numutils.py (empty_like): add empty_like(), similar to
2381 zeros_like() but taking advantage of the new empty() Numeric routine.
2391 zeros_like() but taking advantage of the new empty() Numeric routine.
2382
2392
2383 2005-01-23 *** Released version 0.6.8
2393 2005-01-23 *** Released version 0.6.8
2384
2394
2385 2005-01-22 Fernando Perez <fperez@colorado.edu>
2395 2005-01-22 Fernando Perez <fperez@colorado.edu>
2386
2396
2387 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2397 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2388 automatic show() calls. After discussing things with JDH, it
2398 automatic show() calls. After discussing things with JDH, it
2389 turns out there are too many corner cases where this can go wrong.
2399 turns out there are too many corner cases where this can go wrong.
2390 It's best not to try to be 'too smart', and simply have ipython
2400 It's best not to try to be 'too smart', and simply have ipython
2391 reproduce as much as possible the default behavior of a normal
2401 reproduce as much as possible the default behavior of a normal
2392 python shell.
2402 python shell.
2393
2403
2394 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2404 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2395 line-splitting regexp and _prefilter() to avoid calling getattr()
2405 line-splitting regexp and _prefilter() to avoid calling getattr()
2396 on assignments. This closes
2406 on assignments. This closes
2397 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2407 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2398 readline uses getattr(), so a simple <TAB> keypress is still
2408 readline uses getattr(), so a simple <TAB> keypress is still
2399 enough to trigger getattr() calls on an object.
2409 enough to trigger getattr() calls on an object.
2400
2410
2401 2005-01-21 Fernando Perez <fperez@colorado.edu>
2411 2005-01-21 Fernando Perez <fperez@colorado.edu>
2402
2412
2403 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2413 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2404 docstring under pylab so it doesn't mask the original.
2414 docstring under pylab so it doesn't mask the original.
2405
2415
2406 2005-01-21 *** Released version 0.6.7
2416 2005-01-21 *** Released version 0.6.7
2407
2417
2408 2005-01-21 Fernando Perez <fperez@colorado.edu>
2418 2005-01-21 Fernando Perez <fperez@colorado.edu>
2409
2419
2410 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2420 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2411 signal handling for win32 users in multithreaded mode.
2421 signal handling for win32 users in multithreaded mode.
2412
2422
2413 2005-01-17 Fernando Perez <fperez@colorado.edu>
2423 2005-01-17 Fernando Perez <fperez@colorado.edu>
2414
2424
2415 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2425 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2416 instances with no __init__. After a crash report by Norbert Nemec
2426 instances with no __init__. After a crash report by Norbert Nemec
2417 <Norbert-AT-nemec-online.de>.
2427 <Norbert-AT-nemec-online.de>.
2418
2428
2419 2005-01-14 Fernando Perez <fperez@colorado.edu>
2429 2005-01-14 Fernando Perez <fperez@colorado.edu>
2420
2430
2421 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2431 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2422 names for verbose exceptions, when multiple dotted names and the
2432 names for verbose exceptions, when multiple dotted names and the
2423 'parent' object were present on the same line.
2433 'parent' object were present on the same line.
2424
2434
2425 2005-01-11 Fernando Perez <fperez@colorado.edu>
2435 2005-01-11 Fernando Perez <fperez@colorado.edu>
2426
2436
2427 * IPython/genutils.py (flag_calls): new utility to trap and flag
2437 * IPython/genutils.py (flag_calls): new utility to trap and flag
2428 calls in functions. I need it to clean up matplotlib support.
2438 calls in functions. I need it to clean up matplotlib support.
2429 Also removed some deprecated code in genutils.
2439 Also removed some deprecated code in genutils.
2430
2440
2431 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2441 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2432 that matplotlib scripts called with %run, which don't call show()
2442 that matplotlib scripts called with %run, which don't call show()
2433 themselves, still have their plotting windows open.
2443 themselves, still have their plotting windows open.
2434
2444
2435 2005-01-05 Fernando Perez <fperez@colorado.edu>
2445 2005-01-05 Fernando Perez <fperez@colorado.edu>
2436
2446
2437 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2447 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2438 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2448 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2439
2449
2440 2004-12-19 Fernando Perez <fperez@colorado.edu>
2450 2004-12-19 Fernando Perez <fperez@colorado.edu>
2441
2451
2442 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2452 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2443 parent_runcode, which was an eyesore. The same result can be
2453 parent_runcode, which was an eyesore. The same result can be
2444 obtained with Python's regular superclass mechanisms.
2454 obtained with Python's regular superclass mechanisms.
2445
2455
2446 2004-12-17 Fernando Perez <fperez@colorado.edu>
2456 2004-12-17 Fernando Perez <fperez@colorado.edu>
2447
2457
2448 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2458 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2449 reported by Prabhu.
2459 reported by Prabhu.
2450 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2460 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2451 sys.stderr) instead of explicitly calling sys.stderr. This helps
2461 sys.stderr) instead of explicitly calling sys.stderr. This helps
2452 maintain our I/O abstractions clean, for future GUI embeddings.
2462 maintain our I/O abstractions clean, for future GUI embeddings.
2453
2463
2454 * IPython/genutils.py (info): added new utility for sys.stderr
2464 * IPython/genutils.py (info): added new utility for sys.stderr
2455 unified info message handling (thin wrapper around warn()).
2465 unified info message handling (thin wrapper around warn()).
2456
2466
2457 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2467 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2458 composite (dotted) names on verbose exceptions.
2468 composite (dotted) names on verbose exceptions.
2459 (VerboseTB.nullrepr): harden against another kind of errors which
2469 (VerboseTB.nullrepr): harden against another kind of errors which
2460 Python's inspect module can trigger, and which were crashing
2470 Python's inspect module can trigger, and which were crashing
2461 IPython. Thanks to a report by Marco Lombardi
2471 IPython. Thanks to a report by Marco Lombardi
2462 <mlombard-AT-ma010192.hq.eso.org>.
2472 <mlombard-AT-ma010192.hq.eso.org>.
2463
2473
2464 2004-12-13 *** Released version 0.6.6
2474 2004-12-13 *** Released version 0.6.6
2465
2475
2466 2004-12-12 Fernando Perez <fperez@colorado.edu>
2476 2004-12-12 Fernando Perez <fperez@colorado.edu>
2467
2477
2468 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2478 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2469 generated by pygtk upon initialization if it was built without
2479 generated by pygtk upon initialization if it was built without
2470 threads (for matplotlib users). After a crash reported by
2480 threads (for matplotlib users). After a crash reported by
2471 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2481 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2472
2482
2473 * IPython/ipmaker.py (make_IPython): fix small bug in the
2483 * IPython/ipmaker.py (make_IPython): fix small bug in the
2474 import_some parameter for multiple imports.
2484 import_some parameter for multiple imports.
2475
2485
2476 * IPython/iplib.py (ipmagic): simplified the interface of
2486 * IPython/iplib.py (ipmagic): simplified the interface of
2477 ipmagic() to take a single string argument, just as it would be
2487 ipmagic() to take a single string argument, just as it would be
2478 typed at the IPython cmd line.
2488 typed at the IPython cmd line.
2479 (ipalias): Added new ipalias() with an interface identical to
2489 (ipalias): Added new ipalias() with an interface identical to
2480 ipmagic(). This completes exposing a pure python interface to the
2490 ipmagic(). This completes exposing a pure python interface to the
2481 alias and magic system, which can be used in loops or more complex
2491 alias and magic system, which can be used in loops or more complex
2482 code where IPython's automatic line mangling is not active.
2492 code where IPython's automatic line mangling is not active.
2483
2493
2484 * IPython/genutils.py (timing): changed interface of timing to
2494 * IPython/genutils.py (timing): changed interface of timing to
2485 simply run code once, which is the most common case. timings()
2495 simply run code once, which is the most common case. timings()
2486 remains unchanged, for the cases where you want multiple runs.
2496 remains unchanged, for the cases where you want multiple runs.
2487
2497
2488 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2498 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2489 bug where Python2.2 crashes with exec'ing code which does not end
2499 bug where Python2.2 crashes with exec'ing code which does not end
2490 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2500 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2491 before.
2501 before.
2492
2502
2493 2004-12-10 Fernando Perez <fperez@colorado.edu>
2503 2004-12-10 Fernando Perez <fperez@colorado.edu>
2494
2504
2495 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2505 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2496 -t to -T, to accomodate the new -t flag in %run (the %run and
2506 -t to -T, to accomodate the new -t flag in %run (the %run and
2497 %prun options are kind of intermixed, and it's not easy to change
2507 %prun options are kind of intermixed, and it's not easy to change
2498 this with the limitations of python's getopt).
2508 this with the limitations of python's getopt).
2499
2509
2500 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2510 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2501 the execution of scripts. It's not as fine-tuned as timeit.py,
2511 the execution of scripts. It's not as fine-tuned as timeit.py,
2502 but it works from inside ipython (and under 2.2, which lacks
2512 but it works from inside ipython (and under 2.2, which lacks
2503 timeit.py). Optionally a number of runs > 1 can be given for
2513 timeit.py). Optionally a number of runs > 1 can be given for
2504 timing very short-running code.
2514 timing very short-running code.
2505
2515
2506 * IPython/genutils.py (uniq_stable): new routine which returns a
2516 * IPython/genutils.py (uniq_stable): new routine which returns a
2507 list of unique elements in any iterable, but in stable order of
2517 list of unique elements in any iterable, but in stable order of
2508 appearance. I needed this for the ultraTB fixes, and it's a handy
2518 appearance. I needed this for the ultraTB fixes, and it's a handy
2509 utility.
2519 utility.
2510
2520
2511 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2521 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2512 dotted names in Verbose exceptions. This had been broken since
2522 dotted names in Verbose exceptions. This had been broken since
2513 the very start, now x.y will properly be printed in a Verbose
2523 the very start, now x.y will properly be printed in a Verbose
2514 traceback, instead of x being shown and y appearing always as an
2524 traceback, instead of x being shown and y appearing always as an
2515 'undefined global'. Getting this to work was a bit tricky,
2525 'undefined global'. Getting this to work was a bit tricky,
2516 because by default python tokenizers are stateless. Saved by
2526 because by default python tokenizers are stateless. Saved by
2517 python's ability to easily add a bit of state to an arbitrary
2527 python's ability to easily add a bit of state to an arbitrary
2518 function (without needing to build a full-blown callable object).
2528 function (without needing to build a full-blown callable object).
2519
2529
2520 Also big cleanup of this code, which had horrendous runtime
2530 Also big cleanup of this code, which had horrendous runtime
2521 lookups of zillions of attributes for colorization. Moved all
2531 lookups of zillions of attributes for colorization. Moved all
2522 this code into a few templates, which make it cleaner and quicker.
2532 this code into a few templates, which make it cleaner and quicker.
2523
2533
2524 Printout quality was also improved for Verbose exceptions: one
2534 Printout quality was also improved for Verbose exceptions: one
2525 variable per line, and memory addresses are printed (this can be
2535 variable per line, and memory addresses are printed (this can be
2526 quite handy in nasty debugging situations, which is what Verbose
2536 quite handy in nasty debugging situations, which is what Verbose
2527 is for).
2537 is for).
2528
2538
2529 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2539 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2530 the command line as scripts to be loaded by embedded instances.
2540 the command line as scripts to be loaded by embedded instances.
2531 Doing so has the potential for an infinite recursion if there are
2541 Doing so has the potential for an infinite recursion if there are
2532 exceptions thrown in the process. This fixes a strange crash
2542 exceptions thrown in the process. This fixes a strange crash
2533 reported by Philippe MULLER <muller-AT-irit.fr>.
2543 reported by Philippe MULLER <muller-AT-irit.fr>.
2534
2544
2535 2004-12-09 Fernando Perez <fperez@colorado.edu>
2545 2004-12-09 Fernando Perez <fperez@colorado.edu>
2536
2546
2537 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2547 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2538 to reflect new names in matplotlib, which now expose the
2548 to reflect new names in matplotlib, which now expose the
2539 matlab-compatible interface via a pylab module instead of the
2549 matlab-compatible interface via a pylab module instead of the
2540 'matlab' name. The new code is backwards compatible, so users of
2550 'matlab' name. The new code is backwards compatible, so users of
2541 all matplotlib versions are OK. Patch by J. Hunter.
2551 all matplotlib versions are OK. Patch by J. Hunter.
2542
2552
2543 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2553 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2544 of __init__ docstrings for instances (class docstrings are already
2554 of __init__ docstrings for instances (class docstrings are already
2545 automatically printed). Instances with customized docstrings
2555 automatically printed). Instances with customized docstrings
2546 (indep. of the class) are also recognized and all 3 separate
2556 (indep. of the class) are also recognized and all 3 separate
2547 docstrings are printed (instance, class, constructor). After some
2557 docstrings are printed (instance, class, constructor). After some
2548 comments/suggestions by J. Hunter.
2558 comments/suggestions by J. Hunter.
2549
2559
2550 2004-12-05 Fernando Perez <fperez@colorado.edu>
2560 2004-12-05 Fernando Perez <fperez@colorado.edu>
2551
2561
2552 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2562 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2553 warnings when tab-completion fails and triggers an exception.
2563 warnings when tab-completion fails and triggers an exception.
2554
2564
2555 2004-12-03 Fernando Perez <fperez@colorado.edu>
2565 2004-12-03 Fernando Perez <fperez@colorado.edu>
2556
2566
2557 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2567 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2558 be triggered when using 'run -p'. An incorrect option flag was
2568 be triggered when using 'run -p'. An incorrect option flag was
2559 being set ('d' instead of 'D').
2569 being set ('d' instead of 'D').
2560 (manpage): fix missing escaped \- sign.
2570 (manpage): fix missing escaped \- sign.
2561
2571
2562 2004-11-30 *** Released version 0.6.5
2572 2004-11-30 *** Released version 0.6.5
2563
2573
2564 2004-11-30 Fernando Perez <fperez@colorado.edu>
2574 2004-11-30 Fernando Perez <fperez@colorado.edu>
2565
2575
2566 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2576 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2567 setting with -d option.
2577 setting with -d option.
2568
2578
2569 * setup.py (docfiles): Fix problem where the doc glob I was using
2579 * setup.py (docfiles): Fix problem where the doc glob I was using
2570 was COMPLETELY BROKEN. It was giving the right files by pure
2580 was COMPLETELY BROKEN. It was giving the right files by pure
2571 accident, but failed once I tried to include ipython.el. Note:
2581 accident, but failed once I tried to include ipython.el. Note:
2572 glob() does NOT allow you to do exclusion on multiple endings!
2582 glob() does NOT allow you to do exclusion on multiple endings!
2573
2583
2574 2004-11-29 Fernando Perez <fperez@colorado.edu>
2584 2004-11-29 Fernando Perez <fperez@colorado.edu>
2575
2585
2576 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2586 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2577 the manpage as the source. Better formatting & consistency.
2587 the manpage as the source. Better formatting & consistency.
2578
2588
2579 * IPython/Magic.py (magic_run): Added new -d option, to run
2589 * IPython/Magic.py (magic_run): Added new -d option, to run
2580 scripts under the control of the python pdb debugger. Note that
2590 scripts under the control of the python pdb debugger. Note that
2581 this required changing the %prun option -d to -D, to avoid a clash
2591 this required changing the %prun option -d to -D, to avoid a clash
2582 (since %run must pass options to %prun, and getopt is too dumb to
2592 (since %run must pass options to %prun, and getopt is too dumb to
2583 handle options with string values with embedded spaces). Thanks
2593 handle options with string values with embedded spaces). Thanks
2584 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2594 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2585 (magic_who_ls): added type matching to %who and %whos, so that one
2595 (magic_who_ls): added type matching to %who and %whos, so that one
2586 can filter their output to only include variables of certain
2596 can filter their output to only include variables of certain
2587 types. Another suggestion by Matthew.
2597 types. Another suggestion by Matthew.
2588 (magic_whos): Added memory summaries in kb and Mb for arrays.
2598 (magic_whos): Added memory summaries in kb and Mb for arrays.
2589 (magic_who): Improve formatting (break lines every 9 vars).
2599 (magic_who): Improve formatting (break lines every 9 vars).
2590
2600
2591 2004-11-28 Fernando Perez <fperez@colorado.edu>
2601 2004-11-28 Fernando Perez <fperez@colorado.edu>
2592
2602
2593 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2603 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2594 cache when empty lines were present.
2604 cache when empty lines were present.
2595
2605
2596 2004-11-24 Fernando Perez <fperez@colorado.edu>
2606 2004-11-24 Fernando Perez <fperez@colorado.edu>
2597
2607
2598 * IPython/usage.py (__doc__): document the re-activated threading
2608 * IPython/usage.py (__doc__): document the re-activated threading
2599 options for WX and GTK.
2609 options for WX and GTK.
2600
2610
2601 2004-11-23 Fernando Perez <fperez@colorado.edu>
2611 2004-11-23 Fernando Perez <fperez@colorado.edu>
2602
2612
2603 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2613 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2604 the -wthread and -gthread options, along with a new -tk one to try
2614 the -wthread and -gthread options, along with a new -tk one to try
2605 and coordinate Tk threading with wx/gtk. The tk support is very
2615 and coordinate Tk threading with wx/gtk. The tk support is very
2606 platform dependent, since it seems to require Tcl and Tk to be
2616 platform dependent, since it seems to require Tcl and Tk to be
2607 built with threads (Fedora1/2 appears NOT to have it, but in
2617 built with threads (Fedora1/2 appears NOT to have it, but in
2608 Prabhu's Debian boxes it works OK). But even with some Tk
2618 Prabhu's Debian boxes it works OK). But even with some Tk
2609 limitations, this is a great improvement.
2619 limitations, this is a great improvement.
2610
2620
2611 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2621 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2612 info in user prompts. Patch by Prabhu.
2622 info in user prompts. Patch by Prabhu.
2613
2623
2614 2004-11-18 Fernando Perez <fperez@colorado.edu>
2624 2004-11-18 Fernando Perez <fperez@colorado.edu>
2615
2625
2616 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2626 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2617 EOFErrors and bail, to avoid infinite loops if a non-terminating
2627 EOFErrors and bail, to avoid infinite loops if a non-terminating
2618 file is fed into ipython. Patch submitted in issue 19 by user,
2628 file is fed into ipython. Patch submitted in issue 19 by user,
2619 many thanks.
2629 many thanks.
2620
2630
2621 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2631 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2622 autoquote/parens in continuation prompts, which can cause lots of
2632 autoquote/parens in continuation prompts, which can cause lots of
2623 problems. Closes roundup issue 20.
2633 problems. Closes roundup issue 20.
2624
2634
2625 2004-11-17 Fernando Perez <fperez@colorado.edu>
2635 2004-11-17 Fernando Perez <fperez@colorado.edu>
2626
2636
2627 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2637 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2628 reported as debian bug #280505. I'm not sure my local changelog
2638 reported as debian bug #280505. I'm not sure my local changelog
2629 entry has the proper debian format (Jack?).
2639 entry has the proper debian format (Jack?).
2630
2640
2631 2004-11-08 *** Released version 0.6.4
2641 2004-11-08 *** Released version 0.6.4
2632
2642
2633 2004-11-08 Fernando Perez <fperez@colorado.edu>
2643 2004-11-08 Fernando Perez <fperez@colorado.edu>
2634
2644
2635 * IPython/iplib.py (init_readline): Fix exit message for Windows
2645 * IPython/iplib.py (init_readline): Fix exit message for Windows
2636 when readline is active. Thanks to a report by Eric Jones
2646 when readline is active. Thanks to a report by Eric Jones
2637 <eric-AT-enthought.com>.
2647 <eric-AT-enthought.com>.
2638
2648
2639 2004-11-07 Fernando Perez <fperez@colorado.edu>
2649 2004-11-07 Fernando Perez <fperez@colorado.edu>
2640
2650
2641 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2651 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2642 sometimes seen by win2k/cygwin users.
2652 sometimes seen by win2k/cygwin users.
2643
2653
2644 2004-11-06 Fernando Perez <fperez@colorado.edu>
2654 2004-11-06 Fernando Perez <fperez@colorado.edu>
2645
2655
2646 * IPython/iplib.py (interact): Change the handling of %Exit from
2656 * IPython/iplib.py (interact): Change the handling of %Exit from
2647 trying to propagate a SystemExit to an internal ipython flag.
2657 trying to propagate a SystemExit to an internal ipython flag.
2648 This is less elegant than using Python's exception mechanism, but
2658 This is less elegant than using Python's exception mechanism, but
2649 I can't get that to work reliably with threads, so under -pylab
2659 I can't get that to work reliably with threads, so under -pylab
2650 %Exit was hanging IPython. Cross-thread exception handling is
2660 %Exit was hanging IPython. Cross-thread exception handling is
2651 really a bitch. Thaks to a bug report by Stephen Walton
2661 really a bitch. Thaks to a bug report by Stephen Walton
2652 <stephen.walton-AT-csun.edu>.
2662 <stephen.walton-AT-csun.edu>.
2653
2663
2654 2004-11-04 Fernando Perez <fperez@colorado.edu>
2664 2004-11-04 Fernando Perez <fperez@colorado.edu>
2655
2665
2656 * IPython/iplib.py (raw_input_original): store a pointer to the
2666 * IPython/iplib.py (raw_input_original): store a pointer to the
2657 true raw_input to harden against code which can modify it
2667 true raw_input to harden against code which can modify it
2658 (wx.py.PyShell does this and would otherwise crash ipython).
2668 (wx.py.PyShell does this and would otherwise crash ipython).
2659 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2669 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2660
2670
2661 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2671 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2662 Ctrl-C problem, which does not mess up the input line.
2672 Ctrl-C problem, which does not mess up the input line.
2663
2673
2664 2004-11-03 Fernando Perez <fperez@colorado.edu>
2674 2004-11-03 Fernando Perez <fperez@colorado.edu>
2665
2675
2666 * IPython/Release.py: Changed licensing to BSD, in all files.
2676 * IPython/Release.py: Changed licensing to BSD, in all files.
2667 (name): lowercase name for tarball/RPM release.
2677 (name): lowercase name for tarball/RPM release.
2668
2678
2669 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2679 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2670 use throughout ipython.
2680 use throughout ipython.
2671
2681
2672 * IPython/Magic.py (Magic._ofind): Switch to using the new
2682 * IPython/Magic.py (Magic._ofind): Switch to using the new
2673 OInspect.getdoc() function.
2683 OInspect.getdoc() function.
2674
2684
2675 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2685 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2676 of the line currently being canceled via Ctrl-C. It's extremely
2686 of the line currently being canceled via Ctrl-C. It's extremely
2677 ugly, but I don't know how to do it better (the problem is one of
2687 ugly, but I don't know how to do it better (the problem is one of
2678 handling cross-thread exceptions).
2688 handling cross-thread exceptions).
2679
2689
2680 2004-10-28 Fernando Perez <fperez@colorado.edu>
2690 2004-10-28 Fernando Perez <fperez@colorado.edu>
2681
2691
2682 * IPython/Shell.py (signal_handler): add signal handlers to trap
2692 * IPython/Shell.py (signal_handler): add signal handlers to trap
2683 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2693 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2684 report by Francesc Alted.
2694 report by Francesc Alted.
2685
2695
2686 2004-10-21 Fernando Perez <fperez@colorado.edu>
2696 2004-10-21 Fernando Perez <fperez@colorado.edu>
2687
2697
2688 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2698 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2689 to % for pysh syntax extensions.
2699 to % for pysh syntax extensions.
2690
2700
2691 2004-10-09 Fernando Perez <fperez@colorado.edu>
2701 2004-10-09 Fernando Perez <fperez@colorado.edu>
2692
2702
2693 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2703 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2694 arrays to print a more useful summary, without calling str(arr).
2704 arrays to print a more useful summary, without calling str(arr).
2695 This avoids the problem of extremely lengthy computations which
2705 This avoids the problem of extremely lengthy computations which
2696 occur if arr is large, and appear to the user as a system lockup
2706 occur if arr is large, and appear to the user as a system lockup
2697 with 100% cpu activity. After a suggestion by Kristian Sandberg
2707 with 100% cpu activity. After a suggestion by Kristian Sandberg
2698 <Kristian.Sandberg@colorado.edu>.
2708 <Kristian.Sandberg@colorado.edu>.
2699 (Magic.__init__): fix bug in global magic escapes not being
2709 (Magic.__init__): fix bug in global magic escapes not being
2700 correctly set.
2710 correctly set.
2701
2711
2702 2004-10-08 Fernando Perez <fperez@colorado.edu>
2712 2004-10-08 Fernando Perez <fperez@colorado.edu>
2703
2713
2704 * IPython/Magic.py (__license__): change to absolute imports of
2714 * IPython/Magic.py (__license__): change to absolute imports of
2705 ipython's own internal packages, to start adapting to the absolute
2715 ipython's own internal packages, to start adapting to the absolute
2706 import requirement of PEP-328.
2716 import requirement of PEP-328.
2707
2717
2708 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2718 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2709 files, and standardize author/license marks through the Release
2719 files, and standardize author/license marks through the Release
2710 module instead of having per/file stuff (except for files with
2720 module instead of having per/file stuff (except for files with
2711 particular licenses, like the MIT/PSF-licensed codes).
2721 particular licenses, like the MIT/PSF-licensed codes).
2712
2722
2713 * IPython/Debugger.py: remove dead code for python 2.1
2723 * IPython/Debugger.py: remove dead code for python 2.1
2714
2724
2715 2004-10-04 Fernando Perez <fperez@colorado.edu>
2725 2004-10-04 Fernando Perez <fperez@colorado.edu>
2716
2726
2717 * IPython/iplib.py (ipmagic): New function for accessing magics
2727 * IPython/iplib.py (ipmagic): New function for accessing magics
2718 via a normal python function call.
2728 via a normal python function call.
2719
2729
2720 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2730 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2721 from '@' to '%', to accomodate the new @decorator syntax of python
2731 from '@' to '%', to accomodate the new @decorator syntax of python
2722 2.4.
2732 2.4.
2723
2733
2724 2004-09-29 Fernando Perez <fperez@colorado.edu>
2734 2004-09-29 Fernando Perez <fperez@colorado.edu>
2725
2735
2726 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2736 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2727 matplotlib.use to prevent running scripts which try to switch
2737 matplotlib.use to prevent running scripts which try to switch
2728 interactive backends from within ipython. This will just crash
2738 interactive backends from within ipython. This will just crash
2729 the python interpreter, so we can't allow it (but a detailed error
2739 the python interpreter, so we can't allow it (but a detailed error
2730 is given to the user).
2740 is given to the user).
2731
2741
2732 2004-09-28 Fernando Perez <fperez@colorado.edu>
2742 2004-09-28 Fernando Perez <fperez@colorado.edu>
2733
2743
2734 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2744 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2735 matplotlib-related fixes so that using @run with non-matplotlib
2745 matplotlib-related fixes so that using @run with non-matplotlib
2736 scripts doesn't pop up spurious plot windows. This requires
2746 scripts doesn't pop up spurious plot windows. This requires
2737 matplotlib >= 0.63, where I had to make some changes as well.
2747 matplotlib >= 0.63, where I had to make some changes as well.
2738
2748
2739 * IPython/ipmaker.py (make_IPython): update version requirement to
2749 * IPython/ipmaker.py (make_IPython): update version requirement to
2740 python 2.2.
2750 python 2.2.
2741
2751
2742 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2752 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2743 banner arg for embedded customization.
2753 banner arg for embedded customization.
2744
2754
2745 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2755 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2746 explicit uses of __IP as the IPython's instance name. Now things
2756 explicit uses of __IP as the IPython's instance name. Now things
2747 are properly handled via the shell.name value. The actual code
2757 are properly handled via the shell.name value. The actual code
2748 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2758 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2749 is much better than before. I'll clean things completely when the
2759 is much better than before. I'll clean things completely when the
2750 magic stuff gets a real overhaul.
2760 magic stuff gets a real overhaul.
2751
2761
2752 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2762 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2753 minor changes to debian dir.
2763 minor changes to debian dir.
2754
2764
2755 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2765 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2756 pointer to the shell itself in the interactive namespace even when
2766 pointer to the shell itself in the interactive namespace even when
2757 a user-supplied dict is provided. This is needed for embedding
2767 a user-supplied dict is provided. This is needed for embedding
2758 purposes (found by tests with Michel Sanner).
2768 purposes (found by tests with Michel Sanner).
2759
2769
2760 2004-09-27 Fernando Perez <fperez@colorado.edu>
2770 2004-09-27 Fernando Perez <fperez@colorado.edu>
2761
2771
2762 * IPython/UserConfig/ipythonrc: remove []{} from
2772 * IPython/UserConfig/ipythonrc: remove []{} from
2763 readline_remove_delims, so that things like [modname.<TAB> do
2773 readline_remove_delims, so that things like [modname.<TAB> do
2764 proper completion. This disables [].TAB, but that's a less common
2774 proper completion. This disables [].TAB, but that's a less common
2765 case than module names in list comprehensions, for example.
2775 case than module names in list comprehensions, for example.
2766 Thanks to a report by Andrea Riciputi.
2776 Thanks to a report by Andrea Riciputi.
2767
2777
2768 2004-09-09 Fernando Perez <fperez@colorado.edu>
2778 2004-09-09 Fernando Perez <fperez@colorado.edu>
2769
2779
2770 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2780 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2771 blocking problems in win32 and osx. Fix by John.
2781 blocking problems in win32 and osx. Fix by John.
2772
2782
2773 2004-09-08 Fernando Perez <fperez@colorado.edu>
2783 2004-09-08 Fernando Perez <fperez@colorado.edu>
2774
2784
2775 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2785 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2776 for Win32 and OSX. Fix by John Hunter.
2786 for Win32 and OSX. Fix by John Hunter.
2777
2787
2778 2004-08-30 *** Released version 0.6.3
2788 2004-08-30 *** Released version 0.6.3
2779
2789
2780 2004-08-30 Fernando Perez <fperez@colorado.edu>
2790 2004-08-30 Fernando Perez <fperez@colorado.edu>
2781
2791
2782 * setup.py (isfile): Add manpages to list of dependent files to be
2792 * setup.py (isfile): Add manpages to list of dependent files to be
2783 updated.
2793 updated.
2784
2794
2785 2004-08-27 Fernando Perez <fperez@colorado.edu>
2795 2004-08-27 Fernando Perez <fperez@colorado.edu>
2786
2796
2787 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2797 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2788 for now. They don't really work with standalone WX/GTK code
2798 for now. They don't really work with standalone WX/GTK code
2789 (though matplotlib IS working fine with both of those backends).
2799 (though matplotlib IS working fine with both of those backends).
2790 This will neeed much more testing. I disabled most things with
2800 This will neeed much more testing. I disabled most things with
2791 comments, so turning it back on later should be pretty easy.
2801 comments, so turning it back on later should be pretty easy.
2792
2802
2793 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2803 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2794 autocalling of expressions like r'foo', by modifying the line
2804 autocalling of expressions like r'foo', by modifying the line
2795 split regexp. Closes
2805 split regexp. Closes
2796 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2806 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2797 Riley <ipythonbugs-AT-sabi.net>.
2807 Riley <ipythonbugs-AT-sabi.net>.
2798 (InteractiveShell.mainloop): honor --nobanner with banner
2808 (InteractiveShell.mainloop): honor --nobanner with banner
2799 extensions.
2809 extensions.
2800
2810
2801 * IPython/Shell.py: Significant refactoring of all classes, so
2811 * IPython/Shell.py: Significant refactoring of all classes, so
2802 that we can really support ALL matplotlib backends and threading
2812 that we can really support ALL matplotlib backends and threading
2803 models (John spotted a bug with Tk which required this). Now we
2813 models (John spotted a bug with Tk which required this). Now we
2804 should support single-threaded, WX-threads and GTK-threads, both
2814 should support single-threaded, WX-threads and GTK-threads, both
2805 for generic code and for matplotlib.
2815 for generic code and for matplotlib.
2806
2816
2807 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2817 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2808 -pylab, to simplify things for users. Will also remove the pylab
2818 -pylab, to simplify things for users. Will also remove the pylab
2809 profile, since now all of matplotlib configuration is directly
2819 profile, since now all of matplotlib configuration is directly
2810 handled here. This also reduces startup time.
2820 handled here. This also reduces startup time.
2811
2821
2812 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2822 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2813 shell wasn't being correctly called. Also in IPShellWX.
2823 shell wasn't being correctly called. Also in IPShellWX.
2814
2824
2815 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2825 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2816 fine-tune banner.
2826 fine-tune banner.
2817
2827
2818 * IPython/numutils.py (spike): Deprecate these spike functions,
2828 * IPython/numutils.py (spike): Deprecate these spike functions,
2819 delete (long deprecated) gnuplot_exec handler.
2829 delete (long deprecated) gnuplot_exec handler.
2820
2830
2821 2004-08-26 Fernando Perez <fperez@colorado.edu>
2831 2004-08-26 Fernando Perez <fperez@colorado.edu>
2822
2832
2823 * ipython.1: Update for threading options, plus some others which
2833 * ipython.1: Update for threading options, plus some others which
2824 were missing.
2834 were missing.
2825
2835
2826 * IPython/ipmaker.py (__call__): Added -wthread option for
2836 * IPython/ipmaker.py (__call__): Added -wthread option for
2827 wxpython thread handling. Make sure threading options are only
2837 wxpython thread handling. Make sure threading options are only
2828 valid at the command line.
2838 valid at the command line.
2829
2839
2830 * scripts/ipython: moved shell selection into a factory function
2840 * scripts/ipython: moved shell selection into a factory function
2831 in Shell.py, to keep the starter script to a minimum.
2841 in Shell.py, to keep the starter script to a minimum.
2832
2842
2833 2004-08-25 Fernando Perez <fperez@colorado.edu>
2843 2004-08-25 Fernando Perez <fperez@colorado.edu>
2834
2844
2835 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2845 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2836 John. Along with some recent changes he made to matplotlib, the
2846 John. Along with some recent changes he made to matplotlib, the
2837 next versions of both systems should work very well together.
2847 next versions of both systems should work very well together.
2838
2848
2839 2004-08-24 Fernando Perez <fperez@colorado.edu>
2849 2004-08-24 Fernando Perez <fperez@colorado.edu>
2840
2850
2841 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2851 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2842 tried to switch the profiling to using hotshot, but I'm getting
2852 tried to switch the profiling to using hotshot, but I'm getting
2843 strange errors from prof.runctx() there. I may be misreading the
2853 strange errors from prof.runctx() there. I may be misreading the
2844 docs, but it looks weird. For now the profiling code will
2854 docs, but it looks weird. For now the profiling code will
2845 continue to use the standard profiler.
2855 continue to use the standard profiler.
2846
2856
2847 2004-08-23 Fernando Perez <fperez@colorado.edu>
2857 2004-08-23 Fernando Perez <fperez@colorado.edu>
2848
2858
2849 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2859 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2850 threaded shell, by John Hunter. It's not quite ready yet, but
2860 threaded shell, by John Hunter. It's not quite ready yet, but
2851 close.
2861 close.
2852
2862
2853 2004-08-22 Fernando Perez <fperez@colorado.edu>
2863 2004-08-22 Fernando Perez <fperez@colorado.edu>
2854
2864
2855 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2865 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2856 in Magic and ultraTB.
2866 in Magic and ultraTB.
2857
2867
2858 * ipython.1: document threading options in manpage.
2868 * ipython.1: document threading options in manpage.
2859
2869
2860 * scripts/ipython: Changed name of -thread option to -gthread,
2870 * scripts/ipython: Changed name of -thread option to -gthread,
2861 since this is GTK specific. I want to leave the door open for a
2871 since this is GTK specific. I want to leave the door open for a
2862 -wthread option for WX, which will most likely be necessary. This
2872 -wthread option for WX, which will most likely be necessary. This
2863 change affects usage and ipmaker as well.
2873 change affects usage and ipmaker as well.
2864
2874
2865 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2875 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2866 handle the matplotlib shell issues. Code by John Hunter
2876 handle the matplotlib shell issues. Code by John Hunter
2867 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2877 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2868 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2878 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2869 broken (and disabled for end users) for now, but it puts the
2879 broken (and disabled for end users) for now, but it puts the
2870 infrastructure in place.
2880 infrastructure in place.
2871
2881
2872 2004-08-21 Fernando Perez <fperez@colorado.edu>
2882 2004-08-21 Fernando Perez <fperez@colorado.edu>
2873
2883
2874 * ipythonrc-pylab: Add matplotlib support.
2884 * ipythonrc-pylab: Add matplotlib support.
2875
2885
2876 * matplotlib_config.py: new files for matplotlib support, part of
2886 * matplotlib_config.py: new files for matplotlib support, part of
2877 the pylab profile.
2887 the pylab profile.
2878
2888
2879 * IPython/usage.py (__doc__): documented the threading options.
2889 * IPython/usage.py (__doc__): documented the threading options.
2880
2890
2881 2004-08-20 Fernando Perez <fperez@colorado.edu>
2891 2004-08-20 Fernando Perez <fperez@colorado.edu>
2882
2892
2883 * ipython: Modified the main calling routine to handle the -thread
2893 * ipython: Modified the main calling routine to handle the -thread
2884 and -mpthread options. This needs to be done as a top-level hack,
2894 and -mpthread options. This needs to be done as a top-level hack,
2885 because it determines which class to instantiate for IPython
2895 because it determines which class to instantiate for IPython
2886 itself.
2896 itself.
2887
2897
2888 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2898 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2889 classes to support multithreaded GTK operation without blocking,
2899 classes to support multithreaded GTK operation without blocking,
2890 and matplotlib with all backends. This is a lot of still very
2900 and matplotlib with all backends. This is a lot of still very
2891 experimental code, and threads are tricky. So it may still have a
2901 experimental code, and threads are tricky. So it may still have a
2892 few rough edges... This code owes a lot to
2902 few rough edges... This code owes a lot to
2893 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2903 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2894 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2904 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2895 to John Hunter for all the matplotlib work.
2905 to John Hunter for all the matplotlib work.
2896
2906
2897 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2907 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2898 options for gtk thread and matplotlib support.
2908 options for gtk thread and matplotlib support.
2899
2909
2900 2004-08-16 Fernando Perez <fperez@colorado.edu>
2910 2004-08-16 Fernando Perez <fperez@colorado.edu>
2901
2911
2902 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2912 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2903 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2913 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2904 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2914 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2905
2915
2906 2004-08-11 Fernando Perez <fperez@colorado.edu>
2916 2004-08-11 Fernando Perez <fperez@colorado.edu>
2907
2917
2908 * setup.py (isfile): Fix build so documentation gets updated for
2918 * setup.py (isfile): Fix build so documentation gets updated for
2909 rpms (it was only done for .tgz builds).
2919 rpms (it was only done for .tgz builds).
2910
2920
2911 2004-08-10 Fernando Perez <fperez@colorado.edu>
2921 2004-08-10 Fernando Perez <fperez@colorado.edu>
2912
2922
2913 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2923 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2914
2924
2915 * iplib.py : Silence syntax error exceptions in tab-completion.
2925 * iplib.py : Silence syntax error exceptions in tab-completion.
2916
2926
2917 2004-08-05 Fernando Perez <fperez@colorado.edu>
2927 2004-08-05 Fernando Perez <fperez@colorado.edu>
2918
2928
2919 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2929 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2920 'color off' mark for continuation prompts. This was causing long
2930 'color off' mark for continuation prompts. This was causing long
2921 continuation lines to mis-wrap.
2931 continuation lines to mis-wrap.
2922
2932
2923 2004-08-01 Fernando Perez <fperez@colorado.edu>
2933 2004-08-01 Fernando Perez <fperez@colorado.edu>
2924
2934
2925 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2935 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2926 for building ipython to be a parameter. All this is necessary
2936 for building ipython to be a parameter. All this is necessary
2927 right now to have a multithreaded version, but this insane
2937 right now to have a multithreaded version, but this insane
2928 non-design will be cleaned up soon. For now, it's a hack that
2938 non-design will be cleaned up soon. For now, it's a hack that
2929 works.
2939 works.
2930
2940
2931 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2941 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2932 args in various places. No bugs so far, but it's a dangerous
2942 args in various places. No bugs so far, but it's a dangerous
2933 practice.
2943 practice.
2934
2944
2935 2004-07-31 Fernando Perez <fperez@colorado.edu>
2945 2004-07-31 Fernando Perez <fperez@colorado.edu>
2936
2946
2937 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2947 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2938 fix completion of files with dots in their names under most
2948 fix completion of files with dots in their names under most
2939 profiles (pysh was OK because the completion order is different).
2949 profiles (pysh was OK because the completion order is different).
2940
2950
2941 2004-07-27 Fernando Perez <fperez@colorado.edu>
2951 2004-07-27 Fernando Perez <fperez@colorado.edu>
2942
2952
2943 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2953 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2944 keywords manually, b/c the one in keyword.py was removed in python
2954 keywords manually, b/c the one in keyword.py was removed in python
2945 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2955 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2946 This is NOT a bug under python 2.3 and earlier.
2956 This is NOT a bug under python 2.3 and earlier.
2947
2957
2948 2004-07-26 Fernando Perez <fperez@colorado.edu>
2958 2004-07-26 Fernando Perez <fperez@colorado.edu>
2949
2959
2950 * IPython/ultraTB.py (VerboseTB.text): Add another
2960 * IPython/ultraTB.py (VerboseTB.text): Add another
2951 linecache.checkcache() call to try to prevent inspect.py from
2961 linecache.checkcache() call to try to prevent inspect.py from
2952 crashing under python 2.3. I think this fixes
2962 crashing under python 2.3. I think this fixes
2953 http://www.scipy.net/roundup/ipython/issue17.
2963 http://www.scipy.net/roundup/ipython/issue17.
2954
2964
2955 2004-07-26 *** Released version 0.6.2
2965 2004-07-26 *** Released version 0.6.2
2956
2966
2957 2004-07-26 Fernando Perez <fperez@colorado.edu>
2967 2004-07-26 Fernando Perez <fperez@colorado.edu>
2958
2968
2959 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2969 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2960 fail for any number.
2970 fail for any number.
2961 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2971 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2962 empty bookmarks.
2972 empty bookmarks.
2963
2973
2964 2004-07-26 *** Released version 0.6.1
2974 2004-07-26 *** Released version 0.6.1
2965
2975
2966 2004-07-26 Fernando Perez <fperez@colorado.edu>
2976 2004-07-26 Fernando Perez <fperez@colorado.edu>
2967
2977
2968 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2978 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2969
2979
2970 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2980 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2971 escaping '()[]{}' in filenames.
2981 escaping '()[]{}' in filenames.
2972
2982
2973 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2983 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2974 Python 2.2 users who lack a proper shlex.split.
2984 Python 2.2 users who lack a proper shlex.split.
2975
2985
2976 2004-07-19 Fernando Perez <fperez@colorado.edu>
2986 2004-07-19 Fernando Perez <fperez@colorado.edu>
2977
2987
2978 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2988 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2979 for reading readline's init file. I follow the normal chain:
2989 for reading readline's init file. I follow the normal chain:
2980 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2990 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2981 report by Mike Heeter. This closes
2991 report by Mike Heeter. This closes
2982 http://www.scipy.net/roundup/ipython/issue16.
2992 http://www.scipy.net/roundup/ipython/issue16.
2983
2993
2984 2004-07-18 Fernando Perez <fperez@colorado.edu>
2994 2004-07-18 Fernando Perez <fperez@colorado.edu>
2985
2995
2986 * IPython/iplib.py (__init__): Add better handling of '\' under
2996 * IPython/iplib.py (__init__): Add better handling of '\' under
2987 Win32 for filenames. After a patch by Ville.
2997 Win32 for filenames. After a patch by Ville.
2988
2998
2989 2004-07-17 Fernando Perez <fperez@colorado.edu>
2999 2004-07-17 Fernando Perez <fperez@colorado.edu>
2990
3000
2991 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3001 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2992 autocalling would be triggered for 'foo is bar' if foo is
3002 autocalling would be triggered for 'foo is bar' if foo is
2993 callable. I also cleaned up the autocall detection code to use a
3003 callable. I also cleaned up the autocall detection code to use a
2994 regexp, which is faster. Bug reported by Alexander Schmolck.
3004 regexp, which is faster. Bug reported by Alexander Schmolck.
2995
3005
2996 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3006 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2997 '?' in them would confuse the help system. Reported by Alex
3007 '?' in them would confuse the help system. Reported by Alex
2998 Schmolck.
3008 Schmolck.
2999
3009
3000 2004-07-16 Fernando Perez <fperez@colorado.edu>
3010 2004-07-16 Fernando Perez <fperez@colorado.edu>
3001
3011
3002 * IPython/GnuplotInteractive.py (__all__): added plot2.
3012 * IPython/GnuplotInteractive.py (__all__): added plot2.
3003
3013
3004 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3014 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3005 plotting dictionaries, lists or tuples of 1d arrays.
3015 plotting dictionaries, lists or tuples of 1d arrays.
3006
3016
3007 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3017 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3008 optimizations.
3018 optimizations.
3009
3019
3010 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3020 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3011 the information which was there from Janko's original IPP code:
3021 the information which was there from Janko's original IPP code:
3012
3022
3013 03.05.99 20:53 porto.ifm.uni-kiel.de
3023 03.05.99 20:53 porto.ifm.uni-kiel.de
3014 --Started changelog.
3024 --Started changelog.
3015 --make clear do what it say it does
3025 --make clear do what it say it does
3016 --added pretty output of lines from inputcache
3026 --added pretty output of lines from inputcache
3017 --Made Logger a mixin class, simplifies handling of switches
3027 --Made Logger a mixin class, simplifies handling of switches
3018 --Added own completer class. .string<TAB> expands to last history
3028 --Added own completer class. .string<TAB> expands to last history
3019 line which starts with string. The new expansion is also present
3029 line which starts with string. The new expansion is also present
3020 with Ctrl-r from the readline library. But this shows, who this
3030 with Ctrl-r from the readline library. But this shows, who this
3021 can be done for other cases.
3031 can be done for other cases.
3022 --Added convention that all shell functions should accept a
3032 --Added convention that all shell functions should accept a
3023 parameter_string This opens the door for different behaviour for
3033 parameter_string This opens the door for different behaviour for
3024 each function. @cd is a good example of this.
3034 each function. @cd is a good example of this.
3025
3035
3026 04.05.99 12:12 porto.ifm.uni-kiel.de
3036 04.05.99 12:12 porto.ifm.uni-kiel.de
3027 --added logfile rotation
3037 --added logfile rotation
3028 --added new mainloop method which freezes first the namespace
3038 --added new mainloop method which freezes first the namespace
3029
3039
3030 07.05.99 21:24 porto.ifm.uni-kiel.de
3040 07.05.99 21:24 porto.ifm.uni-kiel.de
3031 --added the docreader classes. Now there is a help system.
3041 --added the docreader classes. Now there is a help system.
3032 -This is only a first try. Currently it's not easy to put new
3042 -This is only a first try. Currently it's not easy to put new
3033 stuff in the indices. But this is the way to go. Info would be
3043 stuff in the indices. But this is the way to go. Info would be
3034 better, but HTML is every where and not everybody has an info
3044 better, but HTML is every where and not everybody has an info
3035 system installed and it's not so easy to change html-docs to info.
3045 system installed and it's not so easy to change html-docs to info.
3036 --added global logfile option
3046 --added global logfile option
3037 --there is now a hook for object inspection method pinfo needs to
3047 --there is now a hook for object inspection method pinfo needs to
3038 be provided for this. Can be reached by two '??'.
3048 be provided for this. Can be reached by two '??'.
3039
3049
3040 08.05.99 20:51 porto.ifm.uni-kiel.de
3050 08.05.99 20:51 porto.ifm.uni-kiel.de
3041 --added a README
3051 --added a README
3042 --bug in rc file. Something has changed so functions in the rc
3052 --bug in rc file. Something has changed so functions in the rc
3043 file need to reference the shell and not self. Not clear if it's a
3053 file need to reference the shell and not self. Not clear if it's a
3044 bug or feature.
3054 bug or feature.
3045 --changed rc file for new behavior
3055 --changed rc file for new behavior
3046
3056
3047 2004-07-15 Fernando Perez <fperez@colorado.edu>
3057 2004-07-15 Fernando Perez <fperez@colorado.edu>
3048
3058
3049 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3059 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3050 cache was falling out of sync in bizarre manners when multi-line
3060 cache was falling out of sync in bizarre manners when multi-line
3051 input was present. Minor optimizations and cleanup.
3061 input was present. Minor optimizations and cleanup.
3052
3062
3053 (Logger): Remove old Changelog info for cleanup. This is the
3063 (Logger): Remove old Changelog info for cleanup. This is the
3054 information which was there from Janko's original code:
3064 information which was there from Janko's original code:
3055
3065
3056 Changes to Logger: - made the default log filename a parameter
3066 Changes to Logger: - made the default log filename a parameter
3057
3067
3058 - put a check for lines beginning with !@? in log(). Needed
3068 - put a check for lines beginning with !@? in log(). Needed
3059 (even if the handlers properly log their lines) for mid-session
3069 (even if the handlers properly log their lines) for mid-session
3060 logging activation to work properly. Without this, lines logged
3070 logging activation to work properly. Without this, lines logged
3061 in mid session, which get read from the cache, would end up
3071 in mid session, which get read from the cache, would end up
3062 'bare' (with !@? in the open) in the log. Now they are caught
3072 'bare' (with !@? in the open) in the log. Now they are caught
3063 and prepended with a #.
3073 and prepended with a #.
3064
3074
3065 * IPython/iplib.py (InteractiveShell.init_readline): added check
3075 * IPython/iplib.py (InteractiveShell.init_readline): added check
3066 in case MagicCompleter fails to be defined, so we don't crash.
3076 in case MagicCompleter fails to be defined, so we don't crash.
3067
3077
3068 2004-07-13 Fernando Perez <fperez@colorado.edu>
3078 2004-07-13 Fernando Perez <fperez@colorado.edu>
3069
3079
3070 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3080 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3071 of EPS if the requested filename ends in '.eps'.
3081 of EPS if the requested filename ends in '.eps'.
3072
3082
3073 2004-07-04 Fernando Perez <fperez@colorado.edu>
3083 2004-07-04 Fernando Perez <fperez@colorado.edu>
3074
3084
3075 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3085 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3076 escaping of quotes when calling the shell.
3086 escaping of quotes when calling the shell.
3077
3087
3078 2004-07-02 Fernando Perez <fperez@colorado.edu>
3088 2004-07-02 Fernando Perez <fperez@colorado.edu>
3079
3089
3080 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3090 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3081 gettext not working because we were clobbering '_'. Fixes
3091 gettext not working because we were clobbering '_'. Fixes
3082 http://www.scipy.net/roundup/ipython/issue6.
3092 http://www.scipy.net/roundup/ipython/issue6.
3083
3093
3084 2004-07-01 Fernando Perez <fperez@colorado.edu>
3094 2004-07-01 Fernando Perez <fperez@colorado.edu>
3085
3095
3086 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3096 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3087 into @cd. Patch by Ville.
3097 into @cd. Patch by Ville.
3088
3098
3089 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3099 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3090 new function to store things after ipmaker runs. Patch by Ville.
3100 new function to store things after ipmaker runs. Patch by Ville.
3091 Eventually this will go away once ipmaker is removed and the class
3101 Eventually this will go away once ipmaker is removed and the class
3092 gets cleaned up, but for now it's ok. Key functionality here is
3102 gets cleaned up, but for now it's ok. Key functionality here is
3093 the addition of the persistent storage mechanism, a dict for
3103 the addition of the persistent storage mechanism, a dict for
3094 keeping data across sessions (for now just bookmarks, but more can
3104 keeping data across sessions (for now just bookmarks, but more can
3095 be implemented later).
3105 be implemented later).
3096
3106
3097 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3107 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3098 persistent across sections. Patch by Ville, I modified it
3108 persistent across sections. Patch by Ville, I modified it
3099 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3109 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3100 added a '-l' option to list all bookmarks.
3110 added a '-l' option to list all bookmarks.
3101
3111
3102 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3112 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3103 center for cleanup. Registered with atexit.register(). I moved
3113 center for cleanup. Registered with atexit.register(). I moved
3104 here the old exit_cleanup(). After a patch by Ville.
3114 here the old exit_cleanup(). After a patch by Ville.
3105
3115
3106 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3116 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3107 characters in the hacked shlex_split for python 2.2.
3117 characters in the hacked shlex_split for python 2.2.
3108
3118
3109 * IPython/iplib.py (file_matches): more fixes to filenames with
3119 * IPython/iplib.py (file_matches): more fixes to filenames with
3110 whitespace in them. It's not perfect, but limitations in python's
3120 whitespace in them. It's not perfect, but limitations in python's
3111 readline make it impossible to go further.
3121 readline make it impossible to go further.
3112
3122
3113 2004-06-29 Fernando Perez <fperez@colorado.edu>
3123 2004-06-29 Fernando Perez <fperez@colorado.edu>
3114
3124
3115 * IPython/iplib.py (file_matches): escape whitespace correctly in
3125 * IPython/iplib.py (file_matches): escape whitespace correctly in
3116 filename completions. Bug reported by Ville.
3126 filename completions. Bug reported by Ville.
3117
3127
3118 2004-06-28 Fernando Perez <fperez@colorado.edu>
3128 2004-06-28 Fernando Perez <fperez@colorado.edu>
3119
3129
3120 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3130 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3121 the history file will be called 'history-PROFNAME' (or just
3131 the history file will be called 'history-PROFNAME' (or just
3122 'history' if no profile is loaded). I was getting annoyed at
3132 'history' if no profile is loaded). I was getting annoyed at
3123 getting my Numerical work history clobbered by pysh sessions.
3133 getting my Numerical work history clobbered by pysh sessions.
3124
3134
3125 * IPython/iplib.py (InteractiveShell.__init__): Internal
3135 * IPython/iplib.py (InteractiveShell.__init__): Internal
3126 getoutputerror() function so that we can honor the system_verbose
3136 getoutputerror() function so that we can honor the system_verbose
3127 flag for _all_ system calls. I also added escaping of #
3137 flag for _all_ system calls. I also added escaping of #
3128 characters here to avoid confusing Itpl.
3138 characters here to avoid confusing Itpl.
3129
3139
3130 * IPython/Magic.py (shlex_split): removed call to shell in
3140 * IPython/Magic.py (shlex_split): removed call to shell in
3131 parse_options and replaced it with shlex.split(). The annoying
3141 parse_options and replaced it with shlex.split(). The annoying
3132 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3142 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3133 to backport it from 2.3, with several frail hacks (the shlex
3143 to backport it from 2.3, with several frail hacks (the shlex
3134 module is rather limited in 2.2). Thanks to a suggestion by Ville
3144 module is rather limited in 2.2). Thanks to a suggestion by Ville
3135 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3145 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3136 problem.
3146 problem.
3137
3147
3138 (Magic.magic_system_verbose): new toggle to print the actual
3148 (Magic.magic_system_verbose): new toggle to print the actual
3139 system calls made by ipython. Mainly for debugging purposes.
3149 system calls made by ipython. Mainly for debugging purposes.
3140
3150
3141 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3151 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3142 doesn't support persistence. Reported (and fix suggested) by
3152 doesn't support persistence. Reported (and fix suggested) by
3143 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3153 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3144
3154
3145 2004-06-26 Fernando Perez <fperez@colorado.edu>
3155 2004-06-26 Fernando Perez <fperez@colorado.edu>
3146
3156
3147 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3157 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3148 continue prompts.
3158 continue prompts.
3149
3159
3150 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3160 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3151 function (basically a big docstring) and a few more things here to
3161 function (basically a big docstring) and a few more things here to
3152 speedup startup. pysh.py is now very lightweight. We want because
3162 speedup startup. pysh.py is now very lightweight. We want because
3153 it gets execfile'd, while InterpreterExec gets imported, so
3163 it gets execfile'd, while InterpreterExec gets imported, so
3154 byte-compilation saves time.
3164 byte-compilation saves time.
3155
3165
3156 2004-06-25 Fernando Perez <fperez@colorado.edu>
3166 2004-06-25 Fernando Perez <fperez@colorado.edu>
3157
3167
3158 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3168 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3159 -NUM', which was recently broken.
3169 -NUM', which was recently broken.
3160
3170
3161 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3171 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3162 in multi-line input (but not !!, which doesn't make sense there).
3172 in multi-line input (but not !!, which doesn't make sense there).
3163
3173
3164 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3174 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3165 It's just too useful, and people can turn it off in the less
3175 It's just too useful, and people can turn it off in the less
3166 common cases where it's a problem.
3176 common cases where it's a problem.
3167
3177
3168 2004-06-24 Fernando Perez <fperez@colorado.edu>
3178 2004-06-24 Fernando Perez <fperez@colorado.edu>
3169
3179
3170 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3180 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3171 special syntaxes (like alias calling) is now allied in multi-line
3181 special syntaxes (like alias calling) is now allied in multi-line
3172 input. This is still _very_ experimental, but it's necessary for
3182 input. This is still _very_ experimental, but it's necessary for
3173 efficient shell usage combining python looping syntax with system
3183 efficient shell usage combining python looping syntax with system
3174 calls. For now it's restricted to aliases, I don't think it
3184 calls. For now it's restricted to aliases, I don't think it
3175 really even makes sense to have this for magics.
3185 really even makes sense to have this for magics.
3176
3186
3177 2004-06-23 Fernando Perez <fperez@colorado.edu>
3187 2004-06-23 Fernando Perez <fperez@colorado.edu>
3178
3188
3179 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3189 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3180 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3190 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3181
3191
3182 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3192 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3183 extensions under Windows (after code sent by Gary Bishop). The
3193 extensions under Windows (after code sent by Gary Bishop). The
3184 extensions considered 'executable' are stored in IPython's rc
3194 extensions considered 'executable' are stored in IPython's rc
3185 structure as win_exec_ext.
3195 structure as win_exec_ext.
3186
3196
3187 * IPython/genutils.py (shell): new function, like system() but
3197 * IPython/genutils.py (shell): new function, like system() but
3188 without return value. Very useful for interactive shell work.
3198 without return value. Very useful for interactive shell work.
3189
3199
3190 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3200 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3191 delete aliases.
3201 delete aliases.
3192
3202
3193 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3203 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3194 sure that the alias table doesn't contain python keywords.
3204 sure that the alias table doesn't contain python keywords.
3195
3205
3196 2004-06-21 Fernando Perez <fperez@colorado.edu>
3206 2004-06-21 Fernando Perez <fperez@colorado.edu>
3197
3207
3198 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3208 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3199 non-existent items are found in $PATH. Reported by Thorsten.
3209 non-existent items are found in $PATH. Reported by Thorsten.
3200
3210
3201 2004-06-20 Fernando Perez <fperez@colorado.edu>
3211 2004-06-20 Fernando Perez <fperez@colorado.edu>
3202
3212
3203 * IPython/iplib.py (complete): modified the completer so that the
3213 * IPython/iplib.py (complete): modified the completer so that the
3204 order of priorities can be easily changed at runtime.
3214 order of priorities can be easily changed at runtime.
3205
3215
3206 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3216 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3207 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3217 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3208
3218
3209 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3219 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3210 expand Python variables prepended with $ in all system calls. The
3220 expand Python variables prepended with $ in all system calls. The
3211 same was done to InteractiveShell.handle_shell_escape. Now all
3221 same was done to InteractiveShell.handle_shell_escape. Now all
3212 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3222 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3213 expansion of python variables and expressions according to the
3223 expansion of python variables and expressions according to the
3214 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3224 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3215
3225
3216 Though PEP-215 has been rejected, a similar (but simpler) one
3226 Though PEP-215 has been rejected, a similar (but simpler) one
3217 seems like it will go into Python 2.4, PEP-292 -
3227 seems like it will go into Python 2.4, PEP-292 -
3218 http://www.python.org/peps/pep-0292.html.
3228 http://www.python.org/peps/pep-0292.html.
3219
3229
3220 I'll keep the full syntax of PEP-215, since IPython has since the
3230 I'll keep the full syntax of PEP-215, since IPython has since the
3221 start used Ka-Ping Yee's reference implementation discussed there
3231 start used Ka-Ping Yee's reference implementation discussed there
3222 (Itpl), and I actually like the powerful semantics it offers.
3232 (Itpl), and I actually like the powerful semantics it offers.
3223
3233
3224 In order to access normal shell variables, the $ has to be escaped
3234 In order to access normal shell variables, the $ has to be escaped
3225 via an extra $. For example:
3235 via an extra $. For example:
3226
3236
3227 In [7]: PATH='a python variable'
3237 In [7]: PATH='a python variable'
3228
3238
3229 In [8]: !echo $PATH
3239 In [8]: !echo $PATH
3230 a python variable
3240 a python variable
3231
3241
3232 In [9]: !echo $$PATH
3242 In [9]: !echo $$PATH
3233 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3243 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3234
3244
3235 (Magic.parse_options): escape $ so the shell doesn't evaluate
3245 (Magic.parse_options): escape $ so the shell doesn't evaluate
3236 things prematurely.
3246 things prematurely.
3237
3247
3238 * IPython/iplib.py (InteractiveShell.call_alias): added the
3248 * IPython/iplib.py (InteractiveShell.call_alias): added the
3239 ability for aliases to expand python variables via $.
3249 ability for aliases to expand python variables via $.
3240
3250
3241 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3251 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3242 system, now there's a @rehash/@rehashx pair of magics. These work
3252 system, now there's a @rehash/@rehashx pair of magics. These work
3243 like the csh rehash command, and can be invoked at any time. They
3253 like the csh rehash command, and can be invoked at any time. They
3244 build a table of aliases to everything in the user's $PATH
3254 build a table of aliases to everything in the user's $PATH
3245 (@rehash uses everything, @rehashx is slower but only adds
3255 (@rehash uses everything, @rehashx is slower but only adds
3246 executable files). With this, the pysh.py-based shell profile can
3256 executable files). With this, the pysh.py-based shell profile can
3247 now simply call rehash upon startup, and full access to all
3257 now simply call rehash upon startup, and full access to all
3248 programs in the user's path is obtained.
3258 programs in the user's path is obtained.
3249
3259
3250 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3260 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3251 functionality is now fully in place. I removed the old dynamic
3261 functionality is now fully in place. I removed the old dynamic
3252 code generation based approach, in favor of a much lighter one
3262 code generation based approach, in favor of a much lighter one
3253 based on a simple dict. The advantage is that this allows me to
3263 based on a simple dict. The advantage is that this allows me to
3254 now have thousands of aliases with negligible cost (unthinkable
3264 now have thousands of aliases with negligible cost (unthinkable
3255 with the old system).
3265 with the old system).
3256
3266
3257 2004-06-19 Fernando Perez <fperez@colorado.edu>
3267 2004-06-19 Fernando Perez <fperez@colorado.edu>
3258
3268
3259 * IPython/iplib.py (__init__): extended MagicCompleter class to
3269 * IPython/iplib.py (__init__): extended MagicCompleter class to
3260 also complete (last in priority) on user aliases.
3270 also complete (last in priority) on user aliases.
3261
3271
3262 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3272 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3263 call to eval.
3273 call to eval.
3264 (ItplNS.__init__): Added a new class which functions like Itpl,
3274 (ItplNS.__init__): Added a new class which functions like Itpl,
3265 but allows configuring the namespace for the evaluation to occur
3275 but allows configuring the namespace for the evaluation to occur
3266 in.
3276 in.
3267
3277
3268 2004-06-18 Fernando Perez <fperez@colorado.edu>
3278 2004-06-18 Fernando Perez <fperez@colorado.edu>
3269
3279
3270 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3280 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3271 better message when 'exit' or 'quit' are typed (a common newbie
3281 better message when 'exit' or 'quit' are typed (a common newbie
3272 confusion).
3282 confusion).
3273
3283
3274 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3284 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3275 check for Windows users.
3285 check for Windows users.
3276
3286
3277 * IPython/iplib.py (InteractiveShell.user_setup): removed
3287 * IPython/iplib.py (InteractiveShell.user_setup): removed
3278 disabling of colors for Windows. I'll test at runtime and issue a
3288 disabling of colors for Windows. I'll test at runtime and issue a
3279 warning if Gary's readline isn't found, as to nudge users to
3289 warning if Gary's readline isn't found, as to nudge users to
3280 download it.
3290 download it.
3281
3291
3282 2004-06-16 Fernando Perez <fperez@colorado.edu>
3292 2004-06-16 Fernando Perez <fperez@colorado.edu>
3283
3293
3284 * IPython/genutils.py (Stream.__init__): changed to print errors
3294 * IPython/genutils.py (Stream.__init__): changed to print errors
3285 to sys.stderr. I had a circular dependency here. Now it's
3295 to sys.stderr. I had a circular dependency here. Now it's
3286 possible to run ipython as IDLE's shell (consider this pre-alpha,
3296 possible to run ipython as IDLE's shell (consider this pre-alpha,
3287 since true stdout things end up in the starting terminal instead
3297 since true stdout things end up in the starting terminal instead
3288 of IDLE's out).
3298 of IDLE's out).
3289
3299
3290 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3300 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3291 users who haven't # updated their prompt_in2 definitions. Remove
3301 users who haven't # updated their prompt_in2 definitions. Remove
3292 eventually.
3302 eventually.
3293 (multiple_replace): added credit to original ASPN recipe.
3303 (multiple_replace): added credit to original ASPN recipe.
3294
3304
3295 2004-06-15 Fernando Perez <fperez@colorado.edu>
3305 2004-06-15 Fernando Perez <fperez@colorado.edu>
3296
3306
3297 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3307 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3298 list of auto-defined aliases.
3308 list of auto-defined aliases.
3299
3309
3300 2004-06-13 Fernando Perez <fperez@colorado.edu>
3310 2004-06-13 Fernando Perez <fperez@colorado.edu>
3301
3311
3302 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3312 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3303 install was really requested (so setup.py can be used for other
3313 install was really requested (so setup.py can be used for other
3304 things under Windows).
3314 things under Windows).
3305
3315
3306 2004-06-10 Fernando Perez <fperez@colorado.edu>
3316 2004-06-10 Fernando Perez <fperez@colorado.edu>
3307
3317
3308 * IPython/Logger.py (Logger.create_log): Manually remove any old
3318 * IPython/Logger.py (Logger.create_log): Manually remove any old
3309 backup, since os.remove may fail under Windows. Fixes bug
3319 backup, since os.remove may fail under Windows. Fixes bug
3310 reported by Thorsten.
3320 reported by Thorsten.
3311
3321
3312 2004-06-09 Fernando Perez <fperez@colorado.edu>
3322 2004-06-09 Fernando Perez <fperez@colorado.edu>
3313
3323
3314 * examples/example-embed.py: fixed all references to %n (replaced
3324 * examples/example-embed.py: fixed all references to %n (replaced
3315 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3325 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3316 for all examples and the manual as well.
3326 for all examples and the manual as well.
3317
3327
3318 2004-06-08 Fernando Perez <fperez@colorado.edu>
3328 2004-06-08 Fernando Perez <fperez@colorado.edu>
3319
3329
3320 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3330 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3321 alignment and color management. All 3 prompt subsystems now
3331 alignment and color management. All 3 prompt subsystems now
3322 inherit from BasePrompt.
3332 inherit from BasePrompt.
3323
3333
3324 * tools/release: updates for windows installer build and tag rpms
3334 * tools/release: updates for windows installer build and tag rpms
3325 with python version (since paths are fixed).
3335 with python version (since paths are fixed).
3326
3336
3327 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3337 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3328 which will become eventually obsolete. Also fixed the default
3338 which will become eventually obsolete. Also fixed the default
3329 prompt_in2 to use \D, so at least new users start with the correct
3339 prompt_in2 to use \D, so at least new users start with the correct
3330 defaults.
3340 defaults.
3331 WARNING: Users with existing ipythonrc files will need to apply
3341 WARNING: Users with existing ipythonrc files will need to apply
3332 this fix manually!
3342 this fix manually!
3333
3343
3334 * setup.py: make windows installer (.exe). This is finally the
3344 * setup.py: make windows installer (.exe). This is finally the
3335 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3345 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3336 which I hadn't included because it required Python 2.3 (or recent
3346 which I hadn't included because it required Python 2.3 (or recent
3337 distutils).
3347 distutils).
3338
3348
3339 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3349 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3340 usage of new '\D' escape.
3350 usage of new '\D' escape.
3341
3351
3342 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3352 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3343 lacks os.getuid())
3353 lacks os.getuid())
3344 (CachedOutput.set_colors): Added the ability to turn coloring
3354 (CachedOutput.set_colors): Added the ability to turn coloring
3345 on/off with @colors even for manually defined prompt colors. It
3355 on/off with @colors even for manually defined prompt colors. It
3346 uses a nasty global, but it works safely and via the generic color
3356 uses a nasty global, but it works safely and via the generic color
3347 handling mechanism.
3357 handling mechanism.
3348 (Prompt2.__init__): Introduced new escape '\D' for continuation
3358 (Prompt2.__init__): Introduced new escape '\D' for continuation
3349 prompts. It represents the counter ('\#') as dots.
3359 prompts. It represents the counter ('\#') as dots.
3350 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3360 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3351 need to update their ipythonrc files and replace '%n' with '\D' in
3361 need to update their ipythonrc files and replace '%n' with '\D' in
3352 their prompt_in2 settings everywhere. Sorry, but there's
3362 their prompt_in2 settings everywhere. Sorry, but there's
3353 otherwise no clean way to get all prompts to properly align. The
3363 otherwise no clean way to get all prompts to properly align. The
3354 ipythonrc shipped with IPython has been updated.
3364 ipythonrc shipped with IPython has been updated.
3355
3365
3356 2004-06-07 Fernando Perez <fperez@colorado.edu>
3366 2004-06-07 Fernando Perez <fperez@colorado.edu>
3357
3367
3358 * setup.py (isfile): Pass local_icons option to latex2html, so the
3368 * setup.py (isfile): Pass local_icons option to latex2html, so the
3359 resulting HTML file is self-contained. Thanks to
3369 resulting HTML file is self-contained. Thanks to
3360 dryice-AT-liu.com.cn for the tip.
3370 dryice-AT-liu.com.cn for the tip.
3361
3371
3362 * pysh.py: I created a new profile 'shell', which implements a
3372 * pysh.py: I created a new profile 'shell', which implements a
3363 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3373 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3364 system shell, nor will it become one anytime soon. It's mainly
3374 system shell, nor will it become one anytime soon. It's mainly
3365 meant to illustrate the use of the new flexible bash-like prompts.
3375 meant to illustrate the use of the new flexible bash-like prompts.
3366 I guess it could be used by hardy souls for true shell management,
3376 I guess it could be used by hardy souls for true shell management,
3367 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3377 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3368 profile. This uses the InterpreterExec extension provided by
3378 profile. This uses the InterpreterExec extension provided by
3369 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3379 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3370
3380
3371 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3381 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3372 auto-align itself with the length of the previous input prompt
3382 auto-align itself with the length of the previous input prompt
3373 (taking into account the invisible color escapes).
3383 (taking into account the invisible color escapes).
3374 (CachedOutput.__init__): Large restructuring of this class. Now
3384 (CachedOutput.__init__): Large restructuring of this class. Now
3375 all three prompts (primary1, primary2, output) are proper objects,
3385 all three prompts (primary1, primary2, output) are proper objects,
3376 managed by the 'parent' CachedOutput class. The code is still a
3386 managed by the 'parent' CachedOutput class. The code is still a
3377 bit hackish (all prompts share state via a pointer to the cache),
3387 bit hackish (all prompts share state via a pointer to the cache),
3378 but it's overall far cleaner than before.
3388 but it's overall far cleaner than before.
3379
3389
3380 * IPython/genutils.py (getoutputerror): modified to add verbose,
3390 * IPython/genutils.py (getoutputerror): modified to add verbose,
3381 debug and header options. This makes the interface of all getout*
3391 debug and header options. This makes the interface of all getout*
3382 functions uniform.
3392 functions uniform.
3383 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3393 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3384
3394
3385 * IPython/Magic.py (Magic.default_option): added a function to
3395 * IPython/Magic.py (Magic.default_option): added a function to
3386 allow registering default options for any magic command. This
3396 allow registering default options for any magic command. This
3387 makes it easy to have profiles which customize the magics globally
3397 makes it easy to have profiles which customize the magics globally
3388 for a certain use. The values set through this function are
3398 for a certain use. The values set through this function are
3389 picked up by the parse_options() method, which all magics should
3399 picked up by the parse_options() method, which all magics should
3390 use to parse their options.
3400 use to parse their options.
3391
3401
3392 * IPython/genutils.py (warn): modified the warnings framework to
3402 * IPython/genutils.py (warn): modified the warnings framework to
3393 use the Term I/O class. I'm trying to slowly unify all of
3403 use the Term I/O class. I'm trying to slowly unify all of
3394 IPython's I/O operations to pass through Term.
3404 IPython's I/O operations to pass through Term.
3395
3405
3396 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3406 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3397 the secondary prompt to correctly match the length of the primary
3407 the secondary prompt to correctly match the length of the primary
3398 one for any prompt. Now multi-line code will properly line up
3408 one for any prompt. Now multi-line code will properly line up
3399 even for path dependent prompts, such as the new ones available
3409 even for path dependent prompts, such as the new ones available
3400 via the prompt_specials.
3410 via the prompt_specials.
3401
3411
3402 2004-06-06 Fernando Perez <fperez@colorado.edu>
3412 2004-06-06 Fernando Perez <fperez@colorado.edu>
3403
3413
3404 * IPython/Prompts.py (prompt_specials): Added the ability to have
3414 * IPython/Prompts.py (prompt_specials): Added the ability to have
3405 bash-like special sequences in the prompts, which get
3415 bash-like special sequences in the prompts, which get
3406 automatically expanded. Things like hostname, current working
3416 automatically expanded. Things like hostname, current working
3407 directory and username are implemented already, but it's easy to
3417 directory and username are implemented already, but it's easy to
3408 add more in the future. Thanks to a patch by W.J. van der Laan
3418 add more in the future. Thanks to a patch by W.J. van der Laan
3409 <gnufnork-AT-hetdigitalegat.nl>
3419 <gnufnork-AT-hetdigitalegat.nl>
3410 (prompt_specials): Added color support for prompt strings, so
3420 (prompt_specials): Added color support for prompt strings, so
3411 users can define arbitrary color setups for their prompts.
3421 users can define arbitrary color setups for their prompts.
3412
3422
3413 2004-06-05 Fernando Perez <fperez@colorado.edu>
3423 2004-06-05 Fernando Perez <fperez@colorado.edu>
3414
3424
3415 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3425 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3416 code to load Gary Bishop's readline and configure it
3426 code to load Gary Bishop's readline and configure it
3417 automatically. Thanks to Gary for help on this.
3427 automatically. Thanks to Gary for help on this.
3418
3428
3419 2004-06-01 Fernando Perez <fperez@colorado.edu>
3429 2004-06-01 Fernando Perez <fperez@colorado.edu>
3420
3430
3421 * IPython/Logger.py (Logger.create_log): fix bug for logging
3431 * IPython/Logger.py (Logger.create_log): fix bug for logging
3422 with no filename (previous fix was incomplete).
3432 with no filename (previous fix was incomplete).
3423
3433
3424 2004-05-25 Fernando Perez <fperez@colorado.edu>
3434 2004-05-25 Fernando Perez <fperez@colorado.edu>
3425
3435
3426 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3436 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3427 parens would get passed to the shell.
3437 parens would get passed to the shell.
3428
3438
3429 2004-05-20 Fernando Perez <fperez@colorado.edu>
3439 2004-05-20 Fernando Perez <fperez@colorado.edu>
3430
3440
3431 * IPython/Magic.py (Magic.magic_prun): changed default profile
3441 * IPython/Magic.py (Magic.magic_prun): changed default profile
3432 sort order to 'time' (the more common profiling need).
3442 sort order to 'time' (the more common profiling need).
3433
3443
3434 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3444 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3435 so that source code shown is guaranteed in sync with the file on
3445 so that source code shown is guaranteed in sync with the file on
3436 disk (also changed in psource). Similar fix to the one for
3446 disk (also changed in psource). Similar fix to the one for
3437 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3447 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3438 <yann.ledu-AT-noos.fr>.
3448 <yann.ledu-AT-noos.fr>.
3439
3449
3440 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3450 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3441 with a single option would not be correctly parsed. Closes
3451 with a single option would not be correctly parsed. Closes
3442 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3452 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3443 introduced in 0.6.0 (on 2004-05-06).
3453 introduced in 0.6.0 (on 2004-05-06).
3444
3454
3445 2004-05-13 *** Released version 0.6.0
3455 2004-05-13 *** Released version 0.6.0
3446
3456
3447 2004-05-13 Fernando Perez <fperez@colorado.edu>
3457 2004-05-13 Fernando Perez <fperez@colorado.edu>
3448
3458
3449 * debian/: Added debian/ directory to CVS, so that debian support
3459 * debian/: Added debian/ directory to CVS, so that debian support
3450 is publicly accessible. The debian package is maintained by Jack
3460 is publicly accessible. The debian package is maintained by Jack
3451 Moffit <jack-AT-xiph.org>.
3461 Moffit <jack-AT-xiph.org>.
3452
3462
3453 * Documentation: included the notes about an ipython-based system
3463 * Documentation: included the notes about an ipython-based system
3454 shell (the hypothetical 'pysh') into the new_design.pdf document,
3464 shell (the hypothetical 'pysh') into the new_design.pdf document,
3455 so that these ideas get distributed to users along with the
3465 so that these ideas get distributed to users along with the
3456 official documentation.
3466 official documentation.
3457
3467
3458 2004-05-10 Fernando Perez <fperez@colorado.edu>
3468 2004-05-10 Fernando Perez <fperez@colorado.edu>
3459
3469
3460 * IPython/Logger.py (Logger.create_log): fix recently introduced
3470 * IPython/Logger.py (Logger.create_log): fix recently introduced
3461 bug (misindented line) where logstart would fail when not given an
3471 bug (misindented line) where logstart would fail when not given an
3462 explicit filename.
3472 explicit filename.
3463
3473
3464 2004-05-09 Fernando Perez <fperez@colorado.edu>
3474 2004-05-09 Fernando Perez <fperez@colorado.edu>
3465
3475
3466 * IPython/Magic.py (Magic.parse_options): skip system call when
3476 * IPython/Magic.py (Magic.parse_options): skip system call when
3467 there are no options to look for. Faster, cleaner for the common
3477 there are no options to look for. Faster, cleaner for the common
3468 case.
3478 case.
3469
3479
3470 * Documentation: many updates to the manual: describing Windows
3480 * Documentation: many updates to the manual: describing Windows
3471 support better, Gnuplot updates, credits, misc small stuff. Also
3481 support better, Gnuplot updates, credits, misc small stuff. Also
3472 updated the new_design doc a bit.
3482 updated the new_design doc a bit.
3473
3483
3474 2004-05-06 *** Released version 0.6.0.rc1
3484 2004-05-06 *** Released version 0.6.0.rc1
3475
3485
3476 2004-05-06 Fernando Perez <fperez@colorado.edu>
3486 2004-05-06 Fernando Perez <fperez@colorado.edu>
3477
3487
3478 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3488 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3479 operations to use the vastly more efficient list/''.join() method.
3489 operations to use the vastly more efficient list/''.join() method.
3480 (FormattedTB.text): Fix
3490 (FormattedTB.text): Fix
3481 http://www.scipy.net/roundup/ipython/issue12 - exception source
3491 http://www.scipy.net/roundup/ipython/issue12 - exception source
3482 extract not updated after reload. Thanks to Mike Salib
3492 extract not updated after reload. Thanks to Mike Salib
3483 <msalib-AT-mit.edu> for pinning the source of the problem.
3493 <msalib-AT-mit.edu> for pinning the source of the problem.
3484 Fortunately, the solution works inside ipython and doesn't require
3494 Fortunately, the solution works inside ipython and doesn't require
3485 any changes to python proper.
3495 any changes to python proper.
3486
3496
3487 * IPython/Magic.py (Magic.parse_options): Improved to process the
3497 * IPython/Magic.py (Magic.parse_options): Improved to process the
3488 argument list as a true shell would (by actually using the
3498 argument list as a true shell would (by actually using the
3489 underlying system shell). This way, all @magics automatically get
3499 underlying system shell). This way, all @magics automatically get
3490 shell expansion for variables. Thanks to a comment by Alex
3500 shell expansion for variables. Thanks to a comment by Alex
3491 Schmolck.
3501 Schmolck.
3492
3502
3493 2004-04-04 Fernando Perez <fperez@colorado.edu>
3503 2004-04-04 Fernando Perez <fperez@colorado.edu>
3494
3504
3495 * IPython/iplib.py (InteractiveShell.interact): Added a special
3505 * IPython/iplib.py (InteractiveShell.interact): Added a special
3496 trap for a debugger quit exception, which is basically impossible
3506 trap for a debugger quit exception, which is basically impossible
3497 to handle by normal mechanisms, given what pdb does to the stack.
3507 to handle by normal mechanisms, given what pdb does to the stack.
3498 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3508 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3499
3509
3500 2004-04-03 Fernando Perez <fperez@colorado.edu>
3510 2004-04-03 Fernando Perez <fperez@colorado.edu>
3501
3511
3502 * IPython/genutils.py (Term): Standardized the names of the Term
3512 * IPython/genutils.py (Term): Standardized the names of the Term
3503 class streams to cin/cout/cerr, following C++ naming conventions
3513 class streams to cin/cout/cerr, following C++ naming conventions
3504 (I can't use in/out/err because 'in' is not a valid attribute
3514 (I can't use in/out/err because 'in' is not a valid attribute
3505 name).
3515 name).
3506
3516
3507 * IPython/iplib.py (InteractiveShell.interact): don't increment
3517 * IPython/iplib.py (InteractiveShell.interact): don't increment
3508 the prompt if there's no user input. By Daniel 'Dang' Griffith
3518 the prompt if there's no user input. By Daniel 'Dang' Griffith
3509 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3519 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3510 Francois Pinard.
3520 Francois Pinard.
3511
3521
3512 2004-04-02 Fernando Perez <fperez@colorado.edu>
3522 2004-04-02 Fernando Perez <fperez@colorado.edu>
3513
3523
3514 * IPython/genutils.py (Stream.__init__): Modified to survive at
3524 * IPython/genutils.py (Stream.__init__): Modified to survive at
3515 least importing in contexts where stdin/out/err aren't true file
3525 least importing in contexts where stdin/out/err aren't true file
3516 objects, such as PyCrust (they lack fileno() and mode). However,
3526 objects, such as PyCrust (they lack fileno() and mode). However,
3517 the recovery facilities which rely on these things existing will
3527 the recovery facilities which rely on these things existing will
3518 not work.
3528 not work.
3519
3529
3520 2004-04-01 Fernando Perez <fperez@colorado.edu>
3530 2004-04-01 Fernando Perez <fperez@colorado.edu>
3521
3531
3522 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3532 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3523 use the new getoutputerror() function, so it properly
3533 use the new getoutputerror() function, so it properly
3524 distinguishes stdout/err.
3534 distinguishes stdout/err.
3525
3535
3526 * IPython/genutils.py (getoutputerror): added a function to
3536 * IPython/genutils.py (getoutputerror): added a function to
3527 capture separately the standard output and error of a command.
3537 capture separately the standard output and error of a command.
3528 After a comment from dang on the mailing lists. This code is
3538 After a comment from dang on the mailing lists. This code is
3529 basically a modified version of commands.getstatusoutput(), from
3539 basically a modified version of commands.getstatusoutput(), from
3530 the standard library.
3540 the standard library.
3531
3541
3532 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3542 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3533 '!!' as a special syntax (shorthand) to access @sx.
3543 '!!' as a special syntax (shorthand) to access @sx.
3534
3544
3535 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3545 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3536 command and return its output as a list split on '\n'.
3546 command and return its output as a list split on '\n'.
3537
3547
3538 2004-03-31 Fernando Perez <fperez@colorado.edu>
3548 2004-03-31 Fernando Perez <fperez@colorado.edu>
3539
3549
3540 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3550 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3541 method to dictionaries used as FakeModule instances if they lack
3551 method to dictionaries used as FakeModule instances if they lack
3542 it. At least pydoc in python2.3 breaks for runtime-defined
3552 it. At least pydoc in python2.3 breaks for runtime-defined
3543 functions without this hack. At some point I need to _really_
3553 functions without this hack. At some point I need to _really_
3544 understand what FakeModule is doing, because it's a gross hack.
3554 understand what FakeModule is doing, because it's a gross hack.
3545 But it solves Arnd's problem for now...
3555 But it solves Arnd's problem for now...
3546
3556
3547 2004-02-27 Fernando Perez <fperez@colorado.edu>
3557 2004-02-27 Fernando Perez <fperez@colorado.edu>
3548
3558
3549 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3559 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3550 mode would behave erratically. Also increased the number of
3560 mode would behave erratically. Also increased the number of
3551 possible logs in rotate mod to 999. Thanks to Rod Holland
3561 possible logs in rotate mod to 999. Thanks to Rod Holland
3552 <rhh@StructureLABS.com> for the report and fixes.
3562 <rhh@StructureLABS.com> for the report and fixes.
3553
3563
3554 2004-02-26 Fernando Perez <fperez@colorado.edu>
3564 2004-02-26 Fernando Perez <fperez@colorado.edu>
3555
3565
3556 * IPython/genutils.py (page): Check that the curses module really
3566 * IPython/genutils.py (page): Check that the curses module really
3557 has the initscr attribute before trying to use it. For some
3567 has the initscr attribute before trying to use it. For some
3558 reason, the Solaris curses module is missing this. I think this
3568 reason, the Solaris curses module is missing this. I think this
3559 should be considered a Solaris python bug, but I'm not sure.
3569 should be considered a Solaris python bug, but I'm not sure.
3560
3570
3561 2004-01-17 Fernando Perez <fperez@colorado.edu>
3571 2004-01-17 Fernando Perez <fperez@colorado.edu>
3562
3572
3563 * IPython/genutils.py (Stream.__init__): Changes to try to make
3573 * IPython/genutils.py (Stream.__init__): Changes to try to make
3564 ipython robust against stdin/out/err being closed by the user.
3574 ipython robust against stdin/out/err being closed by the user.
3565 This is 'user error' (and blocks a normal python session, at least
3575 This is 'user error' (and blocks a normal python session, at least
3566 the stdout case). However, Ipython should be able to survive such
3576 the stdout case). However, Ipython should be able to survive such
3567 instances of abuse as gracefully as possible. To simplify the
3577 instances of abuse as gracefully as possible. To simplify the
3568 coding and maintain compatibility with Gary Bishop's Term
3578 coding and maintain compatibility with Gary Bishop's Term
3569 contributions, I've made use of classmethods for this. I think
3579 contributions, I've made use of classmethods for this. I think
3570 this introduces a dependency on python 2.2.
3580 this introduces a dependency on python 2.2.
3571
3581
3572 2004-01-13 Fernando Perez <fperez@colorado.edu>
3582 2004-01-13 Fernando Perez <fperez@colorado.edu>
3573
3583
3574 * IPython/numutils.py (exp_safe): simplified the code a bit and
3584 * IPython/numutils.py (exp_safe): simplified the code a bit and
3575 removed the need for importing the kinds module altogether.
3585 removed the need for importing the kinds module altogether.
3576
3586
3577 2004-01-06 Fernando Perez <fperez@colorado.edu>
3587 2004-01-06 Fernando Perez <fperez@colorado.edu>
3578
3588
3579 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3589 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3580 a magic function instead, after some community feedback. No
3590 a magic function instead, after some community feedback. No
3581 special syntax will exist for it, but its name is deliberately
3591 special syntax will exist for it, but its name is deliberately
3582 very short.
3592 very short.
3583
3593
3584 2003-12-20 Fernando Perez <fperez@colorado.edu>
3594 2003-12-20 Fernando Perez <fperez@colorado.edu>
3585
3595
3586 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3596 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3587 new functionality, to automagically assign the result of a shell
3597 new functionality, to automagically assign the result of a shell
3588 command to a variable. I'll solicit some community feedback on
3598 command to a variable. I'll solicit some community feedback on
3589 this before making it permanent.
3599 this before making it permanent.
3590
3600
3591 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3601 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3592 requested about callables for which inspect couldn't obtain a
3602 requested about callables for which inspect couldn't obtain a
3593 proper argspec. Thanks to a crash report sent by Etienne
3603 proper argspec. Thanks to a crash report sent by Etienne
3594 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3604 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3595
3605
3596 2003-12-09 Fernando Perez <fperez@colorado.edu>
3606 2003-12-09 Fernando Perez <fperez@colorado.edu>
3597
3607
3598 * IPython/genutils.py (page): patch for the pager to work across
3608 * IPython/genutils.py (page): patch for the pager to work across
3599 various versions of Windows. By Gary Bishop.
3609 various versions of Windows. By Gary Bishop.
3600
3610
3601 2003-12-04 Fernando Perez <fperez@colorado.edu>
3611 2003-12-04 Fernando Perez <fperez@colorado.edu>
3602
3612
3603 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3613 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3604 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3614 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3605 While I tested this and it looks ok, there may still be corner
3615 While I tested this and it looks ok, there may still be corner
3606 cases I've missed.
3616 cases I've missed.
3607
3617
3608 2003-12-01 Fernando Perez <fperez@colorado.edu>
3618 2003-12-01 Fernando Perez <fperez@colorado.edu>
3609
3619
3610 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3620 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3611 where a line like 'p,q=1,2' would fail because the automagic
3621 where a line like 'p,q=1,2' would fail because the automagic
3612 system would be triggered for @p.
3622 system would be triggered for @p.
3613
3623
3614 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3624 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3615 cleanups, code unmodified.
3625 cleanups, code unmodified.
3616
3626
3617 * IPython/genutils.py (Term): added a class for IPython to handle
3627 * IPython/genutils.py (Term): added a class for IPython to handle
3618 output. In most cases it will just be a proxy for stdout/err, but
3628 output. In most cases it will just be a proxy for stdout/err, but
3619 having this allows modifications to be made for some platforms,
3629 having this allows modifications to be made for some platforms,
3620 such as handling color escapes under Windows. All of this code
3630 such as handling color escapes under Windows. All of this code
3621 was contributed by Gary Bishop, with minor modifications by me.
3631 was contributed by Gary Bishop, with minor modifications by me.
3622 The actual changes affect many files.
3632 The actual changes affect many files.
3623
3633
3624 2003-11-30 Fernando Perez <fperez@colorado.edu>
3634 2003-11-30 Fernando Perez <fperez@colorado.edu>
3625
3635
3626 * IPython/iplib.py (file_matches): new completion code, courtesy
3636 * IPython/iplib.py (file_matches): new completion code, courtesy
3627 of Jeff Collins. This enables filename completion again under
3637 of Jeff Collins. This enables filename completion again under
3628 python 2.3, which disabled it at the C level.
3638 python 2.3, which disabled it at the C level.
3629
3639
3630 2003-11-11 Fernando Perez <fperez@colorado.edu>
3640 2003-11-11 Fernando Perez <fperez@colorado.edu>
3631
3641
3632 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3642 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3633 for Numeric.array(map(...)), but often convenient.
3643 for Numeric.array(map(...)), but often convenient.
3634
3644
3635 2003-11-05 Fernando Perez <fperez@colorado.edu>
3645 2003-11-05 Fernando Perez <fperez@colorado.edu>
3636
3646
3637 * IPython/numutils.py (frange): Changed a call from int() to
3647 * IPython/numutils.py (frange): Changed a call from int() to
3638 int(round()) to prevent a problem reported with arange() in the
3648 int(round()) to prevent a problem reported with arange() in the
3639 numpy list.
3649 numpy list.
3640
3650
3641 2003-10-06 Fernando Perez <fperez@colorado.edu>
3651 2003-10-06 Fernando Perez <fperez@colorado.edu>
3642
3652
3643 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3653 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3644 prevent crashes if sys lacks an argv attribute (it happens with
3654 prevent crashes if sys lacks an argv attribute (it happens with
3645 embedded interpreters which build a bare-bones sys module).
3655 embedded interpreters which build a bare-bones sys module).
3646 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3656 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3647
3657
3648 2003-09-24 Fernando Perez <fperez@colorado.edu>
3658 2003-09-24 Fernando Perez <fperez@colorado.edu>
3649
3659
3650 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3660 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3651 to protect against poorly written user objects where __getattr__
3661 to protect against poorly written user objects where __getattr__
3652 raises exceptions other than AttributeError. Thanks to a bug
3662 raises exceptions other than AttributeError. Thanks to a bug
3653 report by Oliver Sander <osander-AT-gmx.de>.
3663 report by Oliver Sander <osander-AT-gmx.de>.
3654
3664
3655 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3665 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3656 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3666 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3657
3667
3658 2003-09-09 Fernando Perez <fperez@colorado.edu>
3668 2003-09-09 Fernando Perez <fperez@colorado.edu>
3659
3669
3660 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3670 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3661 unpacking a list whith a callable as first element would
3671 unpacking a list whith a callable as first element would
3662 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3672 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3663 Collins.
3673 Collins.
3664
3674
3665 2003-08-25 *** Released version 0.5.0
3675 2003-08-25 *** Released version 0.5.0
3666
3676
3667 2003-08-22 Fernando Perez <fperez@colorado.edu>
3677 2003-08-22 Fernando Perez <fperez@colorado.edu>
3668
3678
3669 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3679 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3670 improperly defined user exceptions. Thanks to feedback from Mark
3680 improperly defined user exceptions. Thanks to feedback from Mark
3671 Russell <mrussell-AT-verio.net>.
3681 Russell <mrussell-AT-verio.net>.
3672
3682
3673 2003-08-20 Fernando Perez <fperez@colorado.edu>
3683 2003-08-20 Fernando Perez <fperez@colorado.edu>
3674
3684
3675 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3685 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3676 printing so that it would print multi-line string forms starting
3686 printing so that it would print multi-line string forms starting
3677 with a new line. This way the formatting is better respected for
3687 with a new line. This way the formatting is better respected for
3678 objects which work hard to make nice string forms.
3688 objects which work hard to make nice string forms.
3679
3689
3680 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3690 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3681 autocall would overtake data access for objects with both
3691 autocall would overtake data access for objects with both
3682 __getitem__ and __call__.
3692 __getitem__ and __call__.
3683
3693
3684 2003-08-19 *** Released version 0.5.0-rc1
3694 2003-08-19 *** Released version 0.5.0-rc1
3685
3695
3686 2003-08-19 Fernando Perez <fperez@colorado.edu>
3696 2003-08-19 Fernando Perez <fperez@colorado.edu>
3687
3697
3688 * IPython/deep_reload.py (load_tail): single tiny change here
3698 * IPython/deep_reload.py (load_tail): single tiny change here
3689 seems to fix the long-standing bug of dreload() failing to work
3699 seems to fix the long-standing bug of dreload() failing to work
3690 for dotted names. But this module is pretty tricky, so I may have
3700 for dotted names. But this module is pretty tricky, so I may have
3691 missed some subtlety. Needs more testing!.
3701 missed some subtlety. Needs more testing!.
3692
3702
3693 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3703 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3694 exceptions which have badly implemented __str__ methods.
3704 exceptions which have badly implemented __str__ methods.
3695 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3705 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3696 which I've been getting reports about from Python 2.3 users. I
3706 which I've been getting reports about from Python 2.3 users. I
3697 wish I had a simple test case to reproduce the problem, so I could
3707 wish I had a simple test case to reproduce the problem, so I could
3698 either write a cleaner workaround or file a bug report if
3708 either write a cleaner workaround or file a bug report if
3699 necessary.
3709 necessary.
3700
3710
3701 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3711 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3702 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3712 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3703 a bug report by Tjabo Kloppenburg.
3713 a bug report by Tjabo Kloppenburg.
3704
3714
3705 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3715 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3706 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3716 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3707 seems rather unstable. Thanks to a bug report by Tjabo
3717 seems rather unstable. Thanks to a bug report by Tjabo
3708 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3718 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3709
3719
3710 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3720 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3711 this out soon because of the critical fixes in the inner loop for
3721 this out soon because of the critical fixes in the inner loop for
3712 generators.
3722 generators.
3713
3723
3714 * IPython/Magic.py (Magic.getargspec): removed. This (and
3724 * IPython/Magic.py (Magic.getargspec): removed. This (and
3715 _get_def) have been obsoleted by OInspect for a long time, I
3725 _get_def) have been obsoleted by OInspect for a long time, I
3716 hadn't noticed that they were dead code.
3726 hadn't noticed that they were dead code.
3717 (Magic._ofind): restored _ofind functionality for a few literals
3727 (Magic._ofind): restored _ofind functionality for a few literals
3718 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3728 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3719 for things like "hello".capitalize?, since that would require a
3729 for things like "hello".capitalize?, since that would require a
3720 potentially dangerous eval() again.
3730 potentially dangerous eval() again.
3721
3731
3722 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3732 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3723 logic a bit more to clean up the escapes handling and minimize the
3733 logic a bit more to clean up the escapes handling and minimize the
3724 use of _ofind to only necessary cases. The interactive 'feel' of
3734 use of _ofind to only necessary cases. The interactive 'feel' of
3725 IPython should have improved quite a bit with the changes in
3735 IPython should have improved quite a bit with the changes in
3726 _prefilter and _ofind (besides being far safer than before).
3736 _prefilter and _ofind (besides being far safer than before).
3727
3737
3728 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3738 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3729 obscure, never reported). Edit would fail to find the object to
3739 obscure, never reported). Edit would fail to find the object to
3730 edit under some circumstances.
3740 edit under some circumstances.
3731 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3741 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3732 which were causing double-calling of generators. Those eval calls
3742 which were causing double-calling of generators. Those eval calls
3733 were _very_ dangerous, since code with side effects could be
3743 were _very_ dangerous, since code with side effects could be
3734 triggered. As they say, 'eval is evil'... These were the
3744 triggered. As they say, 'eval is evil'... These were the
3735 nastiest evals in IPython. Besides, _ofind is now far simpler,
3745 nastiest evals in IPython. Besides, _ofind is now far simpler,
3736 and it should also be quite a bit faster. Its use of inspect is
3746 and it should also be quite a bit faster. Its use of inspect is
3737 also safer, so perhaps some of the inspect-related crashes I've
3747 also safer, so perhaps some of the inspect-related crashes I've
3738 seen lately with Python 2.3 might be taken care of. That will
3748 seen lately with Python 2.3 might be taken care of. That will
3739 need more testing.
3749 need more testing.
3740
3750
3741 2003-08-17 Fernando Perez <fperez@colorado.edu>
3751 2003-08-17 Fernando Perez <fperez@colorado.edu>
3742
3752
3743 * IPython/iplib.py (InteractiveShell._prefilter): significant
3753 * IPython/iplib.py (InteractiveShell._prefilter): significant
3744 simplifications to the logic for handling user escapes. Faster
3754 simplifications to the logic for handling user escapes. Faster
3745 and simpler code.
3755 and simpler code.
3746
3756
3747 2003-08-14 Fernando Perez <fperez@colorado.edu>
3757 2003-08-14 Fernando Perez <fperez@colorado.edu>
3748
3758
3749 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3759 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3750 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3760 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3751 but it should be quite a bit faster. And the recursive version
3761 but it should be quite a bit faster. And the recursive version
3752 generated O(log N) intermediate storage for all rank>1 arrays,
3762 generated O(log N) intermediate storage for all rank>1 arrays,
3753 even if they were contiguous.
3763 even if they were contiguous.
3754 (l1norm): Added this function.
3764 (l1norm): Added this function.
3755 (norm): Added this function for arbitrary norms (including
3765 (norm): Added this function for arbitrary norms (including
3756 l-infinity). l1 and l2 are still special cases for convenience
3766 l-infinity). l1 and l2 are still special cases for convenience
3757 and speed.
3767 and speed.
3758
3768
3759 2003-08-03 Fernando Perez <fperez@colorado.edu>
3769 2003-08-03 Fernando Perez <fperez@colorado.edu>
3760
3770
3761 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3771 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3762 exceptions, which now raise PendingDeprecationWarnings in Python
3772 exceptions, which now raise PendingDeprecationWarnings in Python
3763 2.3. There were some in Magic and some in Gnuplot2.
3773 2.3. There were some in Magic and some in Gnuplot2.
3764
3774
3765 2003-06-30 Fernando Perez <fperez@colorado.edu>
3775 2003-06-30 Fernando Perez <fperez@colorado.edu>
3766
3776
3767 * IPython/genutils.py (page): modified to call curses only for
3777 * IPython/genutils.py (page): modified to call curses only for
3768 terminals where TERM=='xterm'. After problems under many other
3778 terminals where TERM=='xterm'. After problems under many other
3769 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3779 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3770
3780
3771 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3781 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3772 would be triggered when readline was absent. This was just an old
3782 would be triggered when readline was absent. This was just an old
3773 debugging statement I'd forgotten to take out.
3783 debugging statement I'd forgotten to take out.
3774
3784
3775 2003-06-20 Fernando Perez <fperez@colorado.edu>
3785 2003-06-20 Fernando Perez <fperez@colorado.edu>
3776
3786
3777 * IPython/genutils.py (clock): modified to return only user time
3787 * IPython/genutils.py (clock): modified to return only user time
3778 (not counting system time), after a discussion on scipy. While
3788 (not counting system time), after a discussion on scipy. While
3779 system time may be a useful quantity occasionally, it may much
3789 system time may be a useful quantity occasionally, it may much
3780 more easily be skewed by occasional swapping or other similar
3790 more easily be skewed by occasional swapping or other similar
3781 activity.
3791 activity.
3782
3792
3783 2003-06-05 Fernando Perez <fperez@colorado.edu>
3793 2003-06-05 Fernando Perez <fperez@colorado.edu>
3784
3794
3785 * IPython/numutils.py (identity): new function, for building
3795 * IPython/numutils.py (identity): new function, for building
3786 arbitrary rank Kronecker deltas (mostly backwards compatible with
3796 arbitrary rank Kronecker deltas (mostly backwards compatible with
3787 Numeric.identity)
3797 Numeric.identity)
3788
3798
3789 2003-06-03 Fernando Perez <fperez@colorado.edu>
3799 2003-06-03 Fernando Perez <fperez@colorado.edu>
3790
3800
3791 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3801 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3792 arguments passed to magics with spaces, to allow trailing '\' to
3802 arguments passed to magics with spaces, to allow trailing '\' to
3793 work normally (mainly for Windows users).
3803 work normally (mainly for Windows users).
3794
3804
3795 2003-05-29 Fernando Perez <fperez@colorado.edu>
3805 2003-05-29 Fernando Perez <fperez@colorado.edu>
3796
3806
3797 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3807 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3798 instead of pydoc.help. This fixes a bizarre behavior where
3808 instead of pydoc.help. This fixes a bizarre behavior where
3799 printing '%s' % locals() would trigger the help system. Now
3809 printing '%s' % locals() would trigger the help system. Now
3800 ipython behaves like normal python does.
3810 ipython behaves like normal python does.
3801
3811
3802 Note that if one does 'from pydoc import help', the bizarre
3812 Note that if one does 'from pydoc import help', the bizarre
3803 behavior returns, but this will also happen in normal python, so
3813 behavior returns, but this will also happen in normal python, so
3804 it's not an ipython bug anymore (it has to do with how pydoc.help
3814 it's not an ipython bug anymore (it has to do with how pydoc.help
3805 is implemented).
3815 is implemented).
3806
3816
3807 2003-05-22 Fernando Perez <fperez@colorado.edu>
3817 2003-05-22 Fernando Perez <fperez@colorado.edu>
3808
3818
3809 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3819 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3810 return [] instead of None when nothing matches, also match to end
3820 return [] instead of None when nothing matches, also match to end
3811 of line. Patch by Gary Bishop.
3821 of line. Patch by Gary Bishop.
3812
3822
3813 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3823 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3814 protection as before, for files passed on the command line. This
3824 protection as before, for files passed on the command line. This
3815 prevents the CrashHandler from kicking in if user files call into
3825 prevents the CrashHandler from kicking in if user files call into
3816 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3826 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3817 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3827 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3818
3828
3819 2003-05-20 *** Released version 0.4.0
3829 2003-05-20 *** Released version 0.4.0
3820
3830
3821 2003-05-20 Fernando Perez <fperez@colorado.edu>
3831 2003-05-20 Fernando Perez <fperez@colorado.edu>
3822
3832
3823 * setup.py: added support for manpages. It's a bit hackish b/c of
3833 * setup.py: added support for manpages. It's a bit hackish b/c of
3824 a bug in the way the bdist_rpm distutils target handles gzipped
3834 a bug in the way the bdist_rpm distutils target handles gzipped
3825 manpages, but it works. After a patch by Jack.
3835 manpages, but it works. After a patch by Jack.
3826
3836
3827 2003-05-19 Fernando Perez <fperez@colorado.edu>
3837 2003-05-19 Fernando Perez <fperez@colorado.edu>
3828
3838
3829 * IPython/numutils.py: added a mockup of the kinds module, since
3839 * IPython/numutils.py: added a mockup of the kinds module, since
3830 it was recently removed from Numeric. This way, numutils will
3840 it was recently removed from Numeric. This way, numutils will
3831 work for all users even if they are missing kinds.
3841 work for all users even if they are missing kinds.
3832
3842
3833 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3843 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3834 failure, which can occur with SWIG-wrapped extensions. After a
3844 failure, which can occur with SWIG-wrapped extensions. After a
3835 crash report from Prabhu.
3845 crash report from Prabhu.
3836
3846
3837 2003-05-16 Fernando Perez <fperez@colorado.edu>
3847 2003-05-16 Fernando Perez <fperez@colorado.edu>
3838
3848
3839 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3849 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3840 protect ipython from user code which may call directly
3850 protect ipython from user code which may call directly
3841 sys.excepthook (this looks like an ipython crash to the user, even
3851 sys.excepthook (this looks like an ipython crash to the user, even
3842 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3852 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3843 This is especially important to help users of WxWindows, but may
3853 This is especially important to help users of WxWindows, but may
3844 also be useful in other cases.
3854 also be useful in other cases.
3845
3855
3846 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3856 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3847 an optional tb_offset to be specified, and to preserve exception
3857 an optional tb_offset to be specified, and to preserve exception
3848 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3858 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3849
3859
3850 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3860 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3851
3861
3852 2003-05-15 Fernando Perez <fperez@colorado.edu>
3862 2003-05-15 Fernando Perez <fperez@colorado.edu>
3853
3863
3854 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3864 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3855 installing for a new user under Windows.
3865 installing for a new user under Windows.
3856
3866
3857 2003-05-12 Fernando Perez <fperez@colorado.edu>
3867 2003-05-12 Fernando Perez <fperez@colorado.edu>
3858
3868
3859 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3869 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3860 handler for Emacs comint-based lines. Currently it doesn't do
3870 handler for Emacs comint-based lines. Currently it doesn't do
3861 much (but importantly, it doesn't update the history cache). In
3871 much (but importantly, it doesn't update the history cache). In
3862 the future it may be expanded if Alex needs more functionality
3872 the future it may be expanded if Alex needs more functionality
3863 there.
3873 there.
3864
3874
3865 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3875 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3866 info to crash reports.
3876 info to crash reports.
3867
3877
3868 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3878 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3869 just like Python's -c. Also fixed crash with invalid -color
3879 just like Python's -c. Also fixed crash with invalid -color
3870 option value at startup. Thanks to Will French
3880 option value at startup. Thanks to Will French
3871 <wfrench-AT-bestweb.net> for the bug report.
3881 <wfrench-AT-bestweb.net> for the bug report.
3872
3882
3873 2003-05-09 Fernando Perez <fperez@colorado.edu>
3883 2003-05-09 Fernando Perez <fperez@colorado.edu>
3874
3884
3875 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3885 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3876 to EvalDict (it's a mapping, after all) and simplified its code
3886 to EvalDict (it's a mapping, after all) and simplified its code
3877 quite a bit, after a nice discussion on c.l.py where Gustavo
3887 quite a bit, after a nice discussion on c.l.py where Gustavo
3878 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3888 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3879
3889
3880 2003-04-30 Fernando Perez <fperez@colorado.edu>
3890 2003-04-30 Fernando Perez <fperez@colorado.edu>
3881
3891
3882 * IPython/genutils.py (timings_out): modified it to reduce its
3892 * IPython/genutils.py (timings_out): modified it to reduce its
3883 overhead in the common reps==1 case.
3893 overhead in the common reps==1 case.
3884
3894
3885 2003-04-29 Fernando Perez <fperez@colorado.edu>
3895 2003-04-29 Fernando Perez <fperez@colorado.edu>
3886
3896
3887 * IPython/genutils.py (timings_out): Modified to use the resource
3897 * IPython/genutils.py (timings_out): Modified to use the resource
3888 module, which avoids the wraparound problems of time.clock().
3898 module, which avoids the wraparound problems of time.clock().
3889
3899
3890 2003-04-17 *** Released version 0.2.15pre4
3900 2003-04-17 *** Released version 0.2.15pre4
3891
3901
3892 2003-04-17 Fernando Perez <fperez@colorado.edu>
3902 2003-04-17 Fernando Perez <fperez@colorado.edu>
3893
3903
3894 * setup.py (scriptfiles): Split windows-specific stuff over to a
3904 * setup.py (scriptfiles): Split windows-specific stuff over to a
3895 separate file, in an attempt to have a Windows GUI installer.
3905 separate file, in an attempt to have a Windows GUI installer.
3896 That didn't work, but part of the groundwork is done.
3906 That didn't work, but part of the groundwork is done.
3897
3907
3898 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3908 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3899 indent/unindent with 4 spaces. Particularly useful in combination
3909 indent/unindent with 4 spaces. Particularly useful in combination
3900 with the new auto-indent option.
3910 with the new auto-indent option.
3901
3911
3902 2003-04-16 Fernando Perez <fperez@colorado.edu>
3912 2003-04-16 Fernando Perez <fperez@colorado.edu>
3903
3913
3904 * IPython/Magic.py: various replacements of self.rc for
3914 * IPython/Magic.py: various replacements of self.rc for
3905 self.shell.rc. A lot more remains to be done to fully disentangle
3915 self.shell.rc. A lot more remains to be done to fully disentangle
3906 this class from the main Shell class.
3916 this class from the main Shell class.
3907
3917
3908 * IPython/GnuplotRuntime.py: added checks for mouse support so
3918 * IPython/GnuplotRuntime.py: added checks for mouse support so
3909 that we don't try to enable it if the current gnuplot doesn't
3919 that we don't try to enable it if the current gnuplot doesn't
3910 really support it. Also added checks so that we don't try to
3920 really support it. Also added checks so that we don't try to
3911 enable persist under Windows (where Gnuplot doesn't recognize the
3921 enable persist under Windows (where Gnuplot doesn't recognize the
3912 option).
3922 option).
3913
3923
3914 * IPython/iplib.py (InteractiveShell.interact): Added optional
3924 * IPython/iplib.py (InteractiveShell.interact): Added optional
3915 auto-indenting code, after a patch by King C. Shu
3925 auto-indenting code, after a patch by King C. Shu
3916 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3926 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3917 get along well with pasting indented code. If I ever figure out
3927 get along well with pasting indented code. If I ever figure out
3918 how to make that part go well, it will become on by default.
3928 how to make that part go well, it will become on by default.
3919
3929
3920 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3930 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3921 crash ipython if there was an unmatched '%' in the user's prompt
3931 crash ipython if there was an unmatched '%' in the user's prompt
3922 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3932 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3923
3933
3924 * IPython/iplib.py (InteractiveShell.interact): removed the
3934 * IPython/iplib.py (InteractiveShell.interact): removed the
3925 ability to ask the user whether he wants to crash or not at the
3935 ability to ask the user whether he wants to crash or not at the
3926 'last line' exception handler. Calling functions at that point
3936 'last line' exception handler. Calling functions at that point
3927 changes the stack, and the error reports would have incorrect
3937 changes the stack, and the error reports would have incorrect
3928 tracebacks.
3938 tracebacks.
3929
3939
3930 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3940 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3931 pass through a peger a pretty-printed form of any object. After a
3941 pass through a peger a pretty-printed form of any object. After a
3932 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3942 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3933
3943
3934 2003-04-14 Fernando Perez <fperez@colorado.edu>
3944 2003-04-14 Fernando Perez <fperez@colorado.edu>
3935
3945
3936 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3946 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3937 all files in ~ would be modified at first install (instead of
3947 all files in ~ would be modified at first install (instead of
3938 ~/.ipython). This could be potentially disastrous, as the
3948 ~/.ipython). This could be potentially disastrous, as the
3939 modification (make line-endings native) could damage binary files.
3949 modification (make line-endings native) could damage binary files.
3940
3950
3941 2003-04-10 Fernando Perez <fperez@colorado.edu>
3951 2003-04-10 Fernando Perez <fperez@colorado.edu>
3942
3952
3943 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3953 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3944 handle only lines which are invalid python. This now means that
3954 handle only lines which are invalid python. This now means that
3945 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3955 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3946 for the bug report.
3956 for the bug report.
3947
3957
3948 2003-04-01 Fernando Perez <fperez@colorado.edu>
3958 2003-04-01 Fernando Perez <fperez@colorado.edu>
3949
3959
3950 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3960 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3951 where failing to set sys.last_traceback would crash pdb.pm().
3961 where failing to set sys.last_traceback would crash pdb.pm().
3952 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3962 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3953 report.
3963 report.
3954
3964
3955 2003-03-25 Fernando Perez <fperez@colorado.edu>
3965 2003-03-25 Fernando Perez <fperez@colorado.edu>
3956
3966
3957 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3967 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3958 before printing it (it had a lot of spurious blank lines at the
3968 before printing it (it had a lot of spurious blank lines at the
3959 end).
3969 end).
3960
3970
3961 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3971 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3962 output would be sent 21 times! Obviously people don't use this
3972 output would be sent 21 times! Obviously people don't use this
3963 too often, or I would have heard about it.
3973 too often, or I would have heard about it.
3964
3974
3965 2003-03-24 Fernando Perez <fperez@colorado.edu>
3975 2003-03-24 Fernando Perez <fperez@colorado.edu>
3966
3976
3967 * setup.py (scriptfiles): renamed the data_files parameter from
3977 * setup.py (scriptfiles): renamed the data_files parameter from
3968 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3978 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3969 for the patch.
3979 for the patch.
3970
3980
3971 2003-03-20 Fernando Perez <fperez@colorado.edu>
3981 2003-03-20 Fernando Perez <fperez@colorado.edu>
3972
3982
3973 * IPython/genutils.py (error): added error() and fatal()
3983 * IPython/genutils.py (error): added error() and fatal()
3974 functions.
3984 functions.
3975
3985
3976 2003-03-18 *** Released version 0.2.15pre3
3986 2003-03-18 *** Released version 0.2.15pre3
3977
3987
3978 2003-03-18 Fernando Perez <fperez@colorado.edu>
3988 2003-03-18 Fernando Perez <fperez@colorado.edu>
3979
3989
3980 * setupext/install_data_ext.py
3990 * setupext/install_data_ext.py
3981 (install_data_ext.initialize_options): Class contributed by Jack
3991 (install_data_ext.initialize_options): Class contributed by Jack
3982 Moffit for fixing the old distutils hack. He is sending this to
3992 Moffit for fixing the old distutils hack. He is sending this to
3983 the distutils folks so in the future we may not need it as a
3993 the distutils folks so in the future we may not need it as a
3984 private fix.
3994 private fix.
3985
3995
3986 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3996 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3987 changes for Debian packaging. See his patch for full details.
3997 changes for Debian packaging. See his patch for full details.
3988 The old distutils hack of making the ipythonrc* files carry a
3998 The old distutils hack of making the ipythonrc* files carry a
3989 bogus .py extension is gone, at last. Examples were moved to a
3999 bogus .py extension is gone, at last. Examples were moved to a
3990 separate subdir under doc/, and the separate executable scripts
4000 separate subdir under doc/, and the separate executable scripts
3991 now live in their own directory. Overall a great cleanup. The
4001 now live in their own directory. Overall a great cleanup. The
3992 manual was updated to use the new files, and setup.py has been
4002 manual was updated to use the new files, and setup.py has been
3993 fixed for this setup.
4003 fixed for this setup.
3994
4004
3995 * IPython/PyColorize.py (Parser.usage): made non-executable and
4005 * IPython/PyColorize.py (Parser.usage): made non-executable and
3996 created a pycolor wrapper around it to be included as a script.
4006 created a pycolor wrapper around it to be included as a script.
3997
4007
3998 2003-03-12 *** Released version 0.2.15pre2
4008 2003-03-12 *** Released version 0.2.15pre2
3999
4009
4000 2003-03-12 Fernando Perez <fperez@colorado.edu>
4010 2003-03-12 Fernando Perez <fperez@colorado.edu>
4001
4011
4002 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4012 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4003 long-standing problem with garbage characters in some terminals.
4013 long-standing problem with garbage characters in some terminals.
4004 The issue was really that the \001 and \002 escapes must _only_ be
4014 The issue was really that the \001 and \002 escapes must _only_ be
4005 passed to input prompts (which call readline), but _never_ to
4015 passed to input prompts (which call readline), but _never_ to
4006 normal text to be printed on screen. I changed ColorANSI to have
4016 normal text to be printed on screen. I changed ColorANSI to have
4007 two classes: TermColors and InputTermColors, each with the
4017 two classes: TermColors and InputTermColors, each with the
4008 appropriate escapes for input prompts or normal text. The code in
4018 appropriate escapes for input prompts or normal text. The code in
4009 Prompts.py got slightly more complicated, but this very old and
4019 Prompts.py got slightly more complicated, but this very old and
4010 annoying bug is finally fixed.
4020 annoying bug is finally fixed.
4011
4021
4012 All the credit for nailing down the real origin of this problem
4022 All the credit for nailing down the real origin of this problem
4013 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4023 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4014 *Many* thanks to him for spending quite a bit of effort on this.
4024 *Many* thanks to him for spending quite a bit of effort on this.
4015
4025
4016 2003-03-05 *** Released version 0.2.15pre1
4026 2003-03-05 *** Released version 0.2.15pre1
4017
4027
4018 2003-03-03 Fernando Perez <fperez@colorado.edu>
4028 2003-03-03 Fernando Perez <fperez@colorado.edu>
4019
4029
4020 * IPython/FakeModule.py: Moved the former _FakeModule to a
4030 * IPython/FakeModule.py: Moved the former _FakeModule to a
4021 separate file, because it's also needed by Magic (to fix a similar
4031 separate file, because it's also needed by Magic (to fix a similar
4022 pickle-related issue in @run).
4032 pickle-related issue in @run).
4023
4033
4024 2003-03-02 Fernando Perez <fperez@colorado.edu>
4034 2003-03-02 Fernando Perez <fperez@colorado.edu>
4025
4035
4026 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4036 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4027 the autocall option at runtime.
4037 the autocall option at runtime.
4028 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4038 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4029 across Magic.py to start separating Magic from InteractiveShell.
4039 across Magic.py to start separating Magic from InteractiveShell.
4030 (Magic._ofind): Fixed to return proper namespace for dotted
4040 (Magic._ofind): Fixed to return proper namespace for dotted
4031 names. Before, a dotted name would always return 'not currently
4041 names. Before, a dotted name would always return 'not currently
4032 defined', because it would find the 'parent'. s.x would be found,
4042 defined', because it would find the 'parent'. s.x would be found,
4033 but since 'x' isn't defined by itself, it would get confused.
4043 but since 'x' isn't defined by itself, it would get confused.
4034 (Magic.magic_run): Fixed pickling problems reported by Ralf
4044 (Magic.magic_run): Fixed pickling problems reported by Ralf
4035 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4045 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4036 that I'd used when Mike Heeter reported similar issues at the
4046 that I'd used when Mike Heeter reported similar issues at the
4037 top-level, but now for @run. It boils down to injecting the
4047 top-level, but now for @run. It boils down to injecting the
4038 namespace where code is being executed with something that looks
4048 namespace where code is being executed with something that looks
4039 enough like a module to fool pickle.dump(). Since a pickle stores
4049 enough like a module to fool pickle.dump(). Since a pickle stores
4040 a named reference to the importing module, we need this for
4050 a named reference to the importing module, we need this for
4041 pickles to save something sensible.
4051 pickles to save something sensible.
4042
4052
4043 * IPython/ipmaker.py (make_IPython): added an autocall option.
4053 * IPython/ipmaker.py (make_IPython): added an autocall option.
4044
4054
4045 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4055 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4046 the auto-eval code. Now autocalling is an option, and the code is
4056 the auto-eval code. Now autocalling is an option, and the code is
4047 also vastly safer. There is no more eval() involved at all.
4057 also vastly safer. There is no more eval() involved at all.
4048
4058
4049 2003-03-01 Fernando Perez <fperez@colorado.edu>
4059 2003-03-01 Fernando Perez <fperez@colorado.edu>
4050
4060
4051 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4061 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4052 dict with named keys instead of a tuple.
4062 dict with named keys instead of a tuple.
4053
4063
4054 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4064 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4055
4065
4056 * setup.py (make_shortcut): Fixed message about directories
4066 * setup.py (make_shortcut): Fixed message about directories
4057 created during Windows installation (the directories were ok, just
4067 created during Windows installation (the directories were ok, just
4058 the printed message was misleading). Thanks to Chris Liechti
4068 the printed message was misleading). Thanks to Chris Liechti
4059 <cliechti-AT-gmx.net> for the heads up.
4069 <cliechti-AT-gmx.net> for the heads up.
4060
4070
4061 2003-02-21 Fernando Perez <fperez@colorado.edu>
4071 2003-02-21 Fernando Perez <fperez@colorado.edu>
4062
4072
4063 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4073 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4064 of ValueError exception when checking for auto-execution. This
4074 of ValueError exception when checking for auto-execution. This
4065 one is raised by things like Numeric arrays arr.flat when the
4075 one is raised by things like Numeric arrays arr.flat when the
4066 array is non-contiguous.
4076 array is non-contiguous.
4067
4077
4068 2003-01-31 Fernando Perez <fperez@colorado.edu>
4078 2003-01-31 Fernando Perez <fperez@colorado.edu>
4069
4079
4070 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4080 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4071 not return any value at all (even though the command would get
4081 not return any value at all (even though the command would get
4072 executed).
4082 executed).
4073 (xsys): Flush stdout right after printing the command to ensure
4083 (xsys): Flush stdout right after printing the command to ensure
4074 proper ordering of commands and command output in the total
4084 proper ordering of commands and command output in the total
4075 output.
4085 output.
4076 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4086 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4077 system/getoutput as defaults. The old ones are kept for
4087 system/getoutput as defaults. The old ones are kept for
4078 compatibility reasons, so no code which uses this library needs
4088 compatibility reasons, so no code which uses this library needs
4079 changing.
4089 changing.
4080
4090
4081 2003-01-27 *** Released version 0.2.14
4091 2003-01-27 *** Released version 0.2.14
4082
4092
4083 2003-01-25 Fernando Perez <fperez@colorado.edu>
4093 2003-01-25 Fernando Perez <fperez@colorado.edu>
4084
4094
4085 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4095 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4086 functions defined in previous edit sessions could not be re-edited
4096 functions defined in previous edit sessions could not be re-edited
4087 (because the temp files were immediately removed). Now temp files
4097 (because the temp files were immediately removed). Now temp files
4088 are removed only at IPython's exit.
4098 are removed only at IPython's exit.
4089 (Magic.magic_run): Improved @run to perform shell-like expansions
4099 (Magic.magic_run): Improved @run to perform shell-like expansions
4090 on its arguments (~users and $VARS). With this, @run becomes more
4100 on its arguments (~users and $VARS). With this, @run becomes more
4091 like a normal command-line.
4101 like a normal command-line.
4092
4102
4093 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4103 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4094 bugs related to embedding and cleaned up that code. A fairly
4104 bugs related to embedding and cleaned up that code. A fairly
4095 important one was the impossibility to access the global namespace
4105 important one was the impossibility to access the global namespace
4096 through the embedded IPython (only local variables were visible).
4106 through the embedded IPython (only local variables were visible).
4097
4107
4098 2003-01-14 Fernando Perez <fperez@colorado.edu>
4108 2003-01-14 Fernando Perez <fperez@colorado.edu>
4099
4109
4100 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4110 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4101 auto-calling to be a bit more conservative. Now it doesn't get
4111 auto-calling to be a bit more conservative. Now it doesn't get
4102 triggered if any of '!=()<>' are in the rest of the input line, to
4112 triggered if any of '!=()<>' are in the rest of the input line, to
4103 allow comparing callables. Thanks to Alex for the heads up.
4113 allow comparing callables. Thanks to Alex for the heads up.
4104
4114
4105 2003-01-07 Fernando Perez <fperez@colorado.edu>
4115 2003-01-07 Fernando Perez <fperez@colorado.edu>
4106
4116
4107 * IPython/genutils.py (page): fixed estimation of the number of
4117 * IPython/genutils.py (page): fixed estimation of the number of
4108 lines in a string to be paged to simply count newlines. This
4118 lines in a string to be paged to simply count newlines. This
4109 prevents over-guessing due to embedded escape sequences. A better
4119 prevents over-guessing due to embedded escape sequences. A better
4110 long-term solution would involve stripping out the control chars
4120 long-term solution would involve stripping out the control chars
4111 for the count, but it's potentially so expensive I just don't
4121 for the count, but it's potentially so expensive I just don't
4112 think it's worth doing.
4122 think it's worth doing.
4113
4123
4114 2002-12-19 *** Released version 0.2.14pre50
4124 2002-12-19 *** Released version 0.2.14pre50
4115
4125
4116 2002-12-19 Fernando Perez <fperez@colorado.edu>
4126 2002-12-19 Fernando Perez <fperez@colorado.edu>
4117
4127
4118 * tools/release (version): Changed release scripts to inform
4128 * tools/release (version): Changed release scripts to inform
4119 Andrea and build a NEWS file with a list of recent changes.
4129 Andrea and build a NEWS file with a list of recent changes.
4120
4130
4121 * IPython/ColorANSI.py (__all__): changed terminal detection
4131 * IPython/ColorANSI.py (__all__): changed terminal detection
4122 code. Seems to work better for xterms without breaking
4132 code. Seems to work better for xterms without breaking
4123 konsole. Will need more testing to determine if WinXP and Mac OSX
4133 konsole. Will need more testing to determine if WinXP and Mac OSX
4124 also work ok.
4134 also work ok.
4125
4135
4126 2002-12-18 *** Released version 0.2.14pre49
4136 2002-12-18 *** Released version 0.2.14pre49
4127
4137
4128 2002-12-18 Fernando Perez <fperez@colorado.edu>
4138 2002-12-18 Fernando Perez <fperez@colorado.edu>
4129
4139
4130 * Docs: added new info about Mac OSX, from Andrea.
4140 * Docs: added new info about Mac OSX, from Andrea.
4131
4141
4132 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4142 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4133 allow direct plotting of python strings whose format is the same
4143 allow direct plotting of python strings whose format is the same
4134 of gnuplot data files.
4144 of gnuplot data files.
4135
4145
4136 2002-12-16 Fernando Perez <fperez@colorado.edu>
4146 2002-12-16 Fernando Perez <fperez@colorado.edu>
4137
4147
4138 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4148 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4139 value of exit question to be acknowledged.
4149 value of exit question to be acknowledged.
4140
4150
4141 2002-12-03 Fernando Perez <fperez@colorado.edu>
4151 2002-12-03 Fernando Perez <fperez@colorado.edu>
4142
4152
4143 * IPython/ipmaker.py: removed generators, which had been added
4153 * IPython/ipmaker.py: removed generators, which had been added
4144 by mistake in an earlier debugging run. This was causing trouble
4154 by mistake in an earlier debugging run. This was causing trouble
4145 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4155 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4146 for pointing this out.
4156 for pointing this out.
4147
4157
4148 2002-11-17 Fernando Perez <fperez@colorado.edu>
4158 2002-11-17 Fernando Perez <fperez@colorado.edu>
4149
4159
4150 * Manual: updated the Gnuplot section.
4160 * Manual: updated the Gnuplot section.
4151
4161
4152 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4162 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4153 a much better split of what goes in Runtime and what goes in
4163 a much better split of what goes in Runtime and what goes in
4154 Interactive.
4164 Interactive.
4155
4165
4156 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4166 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4157 being imported from iplib.
4167 being imported from iplib.
4158
4168
4159 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4169 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4160 for command-passing. Now the global Gnuplot instance is called
4170 for command-passing. Now the global Gnuplot instance is called
4161 'gp' instead of 'g', which was really a far too fragile and
4171 'gp' instead of 'g', which was really a far too fragile and
4162 common name.
4172 common name.
4163
4173
4164 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4174 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4165 bounding boxes generated by Gnuplot for square plots.
4175 bounding boxes generated by Gnuplot for square plots.
4166
4176
4167 * IPython/genutils.py (popkey): new function added. I should
4177 * IPython/genutils.py (popkey): new function added. I should
4168 suggest this on c.l.py as a dict method, it seems useful.
4178 suggest this on c.l.py as a dict method, it seems useful.
4169
4179
4170 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4180 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4171 to transparently handle PostScript generation. MUCH better than
4181 to transparently handle PostScript generation. MUCH better than
4172 the previous plot_eps/replot_eps (which I removed now). The code
4182 the previous plot_eps/replot_eps (which I removed now). The code
4173 is also fairly clean and well documented now (including
4183 is also fairly clean and well documented now (including
4174 docstrings).
4184 docstrings).
4175
4185
4176 2002-11-13 Fernando Perez <fperez@colorado.edu>
4186 2002-11-13 Fernando Perez <fperez@colorado.edu>
4177
4187
4178 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4188 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4179 (inconsistent with options).
4189 (inconsistent with options).
4180
4190
4181 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4191 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4182 manually disabled, I don't know why. Fixed it.
4192 manually disabled, I don't know why. Fixed it.
4183 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4193 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4184 eps output.
4194 eps output.
4185
4195
4186 2002-11-12 Fernando Perez <fperez@colorado.edu>
4196 2002-11-12 Fernando Perez <fperez@colorado.edu>
4187
4197
4188 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4198 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4189 don't propagate up to caller. Fixes crash reported by François
4199 don't propagate up to caller. Fixes crash reported by François
4190 Pinard.
4200 Pinard.
4191
4201
4192 2002-11-09 Fernando Perez <fperez@colorado.edu>
4202 2002-11-09 Fernando Perez <fperez@colorado.edu>
4193
4203
4194 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4204 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4195 history file for new users.
4205 history file for new users.
4196 (make_IPython): fixed bug where initial install would leave the
4206 (make_IPython): fixed bug where initial install would leave the
4197 user running in the .ipython dir.
4207 user running in the .ipython dir.
4198 (make_IPython): fixed bug where config dir .ipython would be
4208 (make_IPython): fixed bug where config dir .ipython would be
4199 created regardless of the given -ipythondir option. Thanks to Cory
4209 created regardless of the given -ipythondir option. Thanks to Cory
4200 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4210 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4201
4211
4202 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4212 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4203 type confirmations. Will need to use it in all of IPython's code
4213 type confirmations. Will need to use it in all of IPython's code
4204 consistently.
4214 consistently.
4205
4215
4206 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4216 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4207 context to print 31 lines instead of the default 5. This will make
4217 context to print 31 lines instead of the default 5. This will make
4208 the crash reports extremely detailed in case the problem is in
4218 the crash reports extremely detailed in case the problem is in
4209 libraries I don't have access to.
4219 libraries I don't have access to.
4210
4220
4211 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4221 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4212 line of defense' code to still crash, but giving users fair
4222 line of defense' code to still crash, but giving users fair
4213 warning. I don't want internal errors to go unreported: if there's
4223 warning. I don't want internal errors to go unreported: if there's
4214 an internal problem, IPython should crash and generate a full
4224 an internal problem, IPython should crash and generate a full
4215 report.
4225 report.
4216
4226
4217 2002-11-08 Fernando Perez <fperez@colorado.edu>
4227 2002-11-08 Fernando Perez <fperez@colorado.edu>
4218
4228
4219 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4229 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4220 otherwise uncaught exceptions which can appear if people set
4230 otherwise uncaught exceptions which can appear if people set
4221 sys.stdout to something badly broken. Thanks to a crash report
4231 sys.stdout to something badly broken. Thanks to a crash report
4222 from henni-AT-mail.brainbot.com.
4232 from henni-AT-mail.brainbot.com.
4223
4233
4224 2002-11-04 Fernando Perez <fperez@colorado.edu>
4234 2002-11-04 Fernando Perez <fperez@colorado.edu>
4225
4235
4226 * IPython/iplib.py (InteractiveShell.interact): added
4236 * IPython/iplib.py (InteractiveShell.interact): added
4227 __IPYTHON__active to the builtins. It's a flag which goes on when
4237 __IPYTHON__active to the builtins. It's a flag which goes on when
4228 the interaction starts and goes off again when it stops. This
4238 the interaction starts and goes off again when it stops. This
4229 allows embedding code to detect being inside IPython. Before this
4239 allows embedding code to detect being inside IPython. Before this
4230 was done via __IPYTHON__, but that only shows that an IPython
4240 was done via __IPYTHON__, but that only shows that an IPython
4231 instance has been created.
4241 instance has been created.
4232
4242
4233 * IPython/Magic.py (Magic.magic_env): I realized that in a
4243 * IPython/Magic.py (Magic.magic_env): I realized that in a
4234 UserDict, instance.data holds the data as a normal dict. So I
4244 UserDict, instance.data holds the data as a normal dict. So I
4235 modified @env to return os.environ.data instead of rebuilding a
4245 modified @env to return os.environ.data instead of rebuilding a
4236 dict by hand.
4246 dict by hand.
4237
4247
4238 2002-11-02 Fernando Perez <fperez@colorado.edu>
4248 2002-11-02 Fernando Perez <fperez@colorado.edu>
4239
4249
4240 * IPython/genutils.py (warn): changed so that level 1 prints no
4250 * IPython/genutils.py (warn): changed so that level 1 prints no
4241 header. Level 2 is now the default (with 'WARNING' header, as
4251 header. Level 2 is now the default (with 'WARNING' header, as
4242 before). I think I tracked all places where changes were needed in
4252 before). I think I tracked all places where changes were needed in
4243 IPython, but outside code using the old level numbering may have
4253 IPython, but outside code using the old level numbering may have
4244 broken.
4254 broken.
4245
4255
4246 * IPython/iplib.py (InteractiveShell.runcode): added this to
4256 * IPython/iplib.py (InteractiveShell.runcode): added this to
4247 handle the tracebacks in SystemExit traps correctly. The previous
4257 handle the tracebacks in SystemExit traps correctly. The previous
4248 code (through interact) was printing more of the stack than
4258 code (through interact) was printing more of the stack than
4249 necessary, showing IPython internal code to the user.
4259 necessary, showing IPython internal code to the user.
4250
4260
4251 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4261 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4252 default. Now that the default at the confirmation prompt is yes,
4262 default. Now that the default at the confirmation prompt is yes,
4253 it's not so intrusive. François' argument that ipython sessions
4263 it's not so intrusive. François' argument that ipython sessions
4254 tend to be complex enough not to lose them from an accidental C-d,
4264 tend to be complex enough not to lose them from an accidental C-d,
4255 is a valid one.
4265 is a valid one.
4256
4266
4257 * IPython/iplib.py (InteractiveShell.interact): added a
4267 * IPython/iplib.py (InteractiveShell.interact): added a
4258 showtraceback() call to the SystemExit trap, and modified the exit
4268 showtraceback() call to the SystemExit trap, and modified the exit
4259 confirmation to have yes as the default.
4269 confirmation to have yes as the default.
4260
4270
4261 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4271 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4262 this file. It's been gone from the code for a long time, this was
4272 this file. It's been gone from the code for a long time, this was
4263 simply leftover junk.
4273 simply leftover junk.
4264
4274
4265 2002-11-01 Fernando Perez <fperez@colorado.edu>
4275 2002-11-01 Fernando Perez <fperez@colorado.edu>
4266
4276
4267 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4277 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4268 added. If set, IPython now traps EOF and asks for
4278 added. If set, IPython now traps EOF and asks for
4269 confirmation. After a request by François Pinard.
4279 confirmation. After a request by François Pinard.
4270
4280
4271 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4281 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4272 of @abort, and with a new (better) mechanism for handling the
4282 of @abort, and with a new (better) mechanism for handling the
4273 exceptions.
4283 exceptions.
4274
4284
4275 2002-10-27 Fernando Perez <fperez@colorado.edu>
4285 2002-10-27 Fernando Perez <fperez@colorado.edu>
4276
4286
4277 * IPython/usage.py (__doc__): updated the --help information and
4287 * IPython/usage.py (__doc__): updated the --help information and
4278 the ipythonrc file to indicate that -log generates
4288 the ipythonrc file to indicate that -log generates
4279 ./ipython.log. Also fixed the corresponding info in @logstart.
4289 ./ipython.log. Also fixed the corresponding info in @logstart.
4280 This and several other fixes in the manuals thanks to reports by
4290 This and several other fixes in the manuals thanks to reports by
4281 François Pinard <pinard-AT-iro.umontreal.ca>.
4291 François Pinard <pinard-AT-iro.umontreal.ca>.
4282
4292
4283 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4293 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4284 refer to @logstart (instead of @log, which doesn't exist).
4294 refer to @logstart (instead of @log, which doesn't exist).
4285
4295
4286 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4296 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4287 AttributeError crash. Thanks to Christopher Armstrong
4297 AttributeError crash. Thanks to Christopher Armstrong
4288 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4298 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4289 introduced recently (in 0.2.14pre37) with the fix to the eval
4299 introduced recently (in 0.2.14pre37) with the fix to the eval
4290 problem mentioned below.
4300 problem mentioned below.
4291
4301
4292 2002-10-17 Fernando Perez <fperez@colorado.edu>
4302 2002-10-17 Fernando Perez <fperez@colorado.edu>
4293
4303
4294 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4304 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4295 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4305 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4296
4306
4297 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4307 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4298 this function to fix a problem reported by Alex Schmolck. He saw
4308 this function to fix a problem reported by Alex Schmolck. He saw
4299 it with list comprehensions and generators, which were getting
4309 it with list comprehensions and generators, which were getting
4300 called twice. The real problem was an 'eval' call in testing for
4310 called twice. The real problem was an 'eval' call in testing for
4301 automagic which was evaluating the input line silently.
4311 automagic which was evaluating the input line silently.
4302
4312
4303 This is a potentially very nasty bug, if the input has side
4313 This is a potentially very nasty bug, if the input has side
4304 effects which must not be repeated. The code is much cleaner now,
4314 effects which must not be repeated. The code is much cleaner now,
4305 without any blanket 'except' left and with a regexp test for
4315 without any blanket 'except' left and with a regexp test for
4306 actual function names.
4316 actual function names.
4307
4317
4308 But an eval remains, which I'm not fully comfortable with. I just
4318 But an eval remains, which I'm not fully comfortable with. I just
4309 don't know how to find out if an expression could be a callable in
4319 don't know how to find out if an expression could be a callable in
4310 the user's namespace without doing an eval on the string. However
4320 the user's namespace without doing an eval on the string. However
4311 that string is now much more strictly checked so that no code
4321 that string is now much more strictly checked so that no code
4312 slips by, so the eval should only happen for things that can
4322 slips by, so the eval should only happen for things that can
4313 really be only function/method names.
4323 really be only function/method names.
4314
4324
4315 2002-10-15 Fernando Perez <fperez@colorado.edu>
4325 2002-10-15 Fernando Perez <fperez@colorado.edu>
4316
4326
4317 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4327 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4318 OSX information to main manual, removed README_Mac_OSX file from
4328 OSX information to main manual, removed README_Mac_OSX file from
4319 distribution. Also updated credits for recent additions.
4329 distribution. Also updated credits for recent additions.
4320
4330
4321 2002-10-10 Fernando Perez <fperez@colorado.edu>
4331 2002-10-10 Fernando Perez <fperez@colorado.edu>
4322
4332
4323 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4333 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4324 terminal-related issues. Many thanks to Andrea Riciputi
4334 terminal-related issues. Many thanks to Andrea Riciputi
4325 <andrea.riciputi-AT-libero.it> for writing it.
4335 <andrea.riciputi-AT-libero.it> for writing it.
4326
4336
4327 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4337 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4328 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4338 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4329
4339
4330 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4340 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4331 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4341 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4332 <syver-en-AT-online.no> who both submitted patches for this problem.
4342 <syver-en-AT-online.no> who both submitted patches for this problem.
4333
4343
4334 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4344 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4335 global embedding to make sure that things don't overwrite user
4345 global embedding to make sure that things don't overwrite user
4336 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4346 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4337
4347
4338 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4348 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4339 compatibility. Thanks to Hayden Callow
4349 compatibility. Thanks to Hayden Callow
4340 <h.callow-AT-elec.canterbury.ac.nz>
4350 <h.callow-AT-elec.canterbury.ac.nz>
4341
4351
4342 2002-10-04 Fernando Perez <fperez@colorado.edu>
4352 2002-10-04 Fernando Perez <fperez@colorado.edu>
4343
4353
4344 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4354 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4345 Gnuplot.File objects.
4355 Gnuplot.File objects.
4346
4356
4347 2002-07-23 Fernando Perez <fperez@colorado.edu>
4357 2002-07-23 Fernando Perez <fperez@colorado.edu>
4348
4358
4349 * IPython/genutils.py (timing): Added timings() and timing() for
4359 * IPython/genutils.py (timing): Added timings() and timing() for
4350 quick access to the most commonly needed data, the execution
4360 quick access to the most commonly needed data, the execution
4351 times. Old timing() renamed to timings_out().
4361 times. Old timing() renamed to timings_out().
4352
4362
4353 2002-07-18 Fernando Perez <fperez@colorado.edu>
4363 2002-07-18 Fernando Perez <fperez@colorado.edu>
4354
4364
4355 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4365 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4356 bug with nested instances disrupting the parent's tab completion.
4366 bug with nested instances disrupting the parent's tab completion.
4357
4367
4358 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4368 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4359 all_completions code to begin the emacs integration.
4369 all_completions code to begin the emacs integration.
4360
4370
4361 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4371 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4362 argument to allow titling individual arrays when plotting.
4372 argument to allow titling individual arrays when plotting.
4363
4373
4364 2002-07-15 Fernando Perez <fperez@colorado.edu>
4374 2002-07-15 Fernando Perez <fperez@colorado.edu>
4365
4375
4366 * setup.py (make_shortcut): changed to retrieve the value of
4376 * setup.py (make_shortcut): changed to retrieve the value of
4367 'Program Files' directory from the registry (this value changes in
4377 'Program Files' directory from the registry (this value changes in
4368 non-english versions of Windows). Thanks to Thomas Fanslau
4378 non-english versions of Windows). Thanks to Thomas Fanslau
4369 <tfanslau-AT-gmx.de> for the report.
4379 <tfanslau-AT-gmx.de> for the report.
4370
4380
4371 2002-07-10 Fernando Perez <fperez@colorado.edu>
4381 2002-07-10 Fernando Perez <fperez@colorado.edu>
4372
4382
4373 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4383 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4374 a bug in pdb, which crashes if a line with only whitespace is
4384 a bug in pdb, which crashes if a line with only whitespace is
4375 entered. Bug report submitted to sourceforge.
4385 entered. Bug report submitted to sourceforge.
4376
4386
4377 2002-07-09 Fernando Perez <fperez@colorado.edu>
4387 2002-07-09 Fernando Perez <fperez@colorado.edu>
4378
4388
4379 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4389 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4380 reporting exceptions (it's a bug in inspect.py, I just set a
4390 reporting exceptions (it's a bug in inspect.py, I just set a
4381 workaround).
4391 workaround).
4382
4392
4383 2002-07-08 Fernando Perez <fperez@colorado.edu>
4393 2002-07-08 Fernando Perez <fperez@colorado.edu>
4384
4394
4385 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4395 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4386 __IPYTHON__ in __builtins__ to show up in user_ns.
4396 __IPYTHON__ in __builtins__ to show up in user_ns.
4387
4397
4388 2002-07-03 Fernando Perez <fperez@colorado.edu>
4398 2002-07-03 Fernando Perez <fperez@colorado.edu>
4389
4399
4390 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4400 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4391 name from @gp_set_instance to @gp_set_default.
4401 name from @gp_set_instance to @gp_set_default.
4392
4402
4393 * IPython/ipmaker.py (make_IPython): default editor value set to
4403 * IPython/ipmaker.py (make_IPython): default editor value set to
4394 '0' (a string), to match the rc file. Otherwise will crash when
4404 '0' (a string), to match the rc file. Otherwise will crash when
4395 .strip() is called on it.
4405 .strip() is called on it.
4396
4406
4397
4407
4398 2002-06-28 Fernando Perez <fperez@colorado.edu>
4408 2002-06-28 Fernando Perez <fperez@colorado.edu>
4399
4409
4400 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4410 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4401 of files in current directory when a file is executed via
4411 of files in current directory when a file is executed via
4402 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4412 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4403
4413
4404 * setup.py (manfiles): fix for rpm builds, submitted by RA
4414 * setup.py (manfiles): fix for rpm builds, submitted by RA
4405 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4415 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4406
4416
4407 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4417 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4408 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4418 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4409 string!). A. Schmolck caught this one.
4419 string!). A. Schmolck caught this one.
4410
4420
4411 2002-06-27 Fernando Perez <fperez@colorado.edu>
4421 2002-06-27 Fernando Perez <fperez@colorado.edu>
4412
4422
4413 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4423 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4414 defined files at the cmd line. __name__ wasn't being set to
4424 defined files at the cmd line. __name__ wasn't being set to
4415 __main__.
4425 __main__.
4416
4426
4417 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4427 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4418 regular lists and tuples besides Numeric arrays.
4428 regular lists and tuples besides Numeric arrays.
4419
4429
4420 * IPython/Prompts.py (CachedOutput.__call__): Added output
4430 * IPython/Prompts.py (CachedOutput.__call__): Added output
4421 supression for input ending with ';'. Similar to Mathematica and
4431 supression for input ending with ';'. Similar to Mathematica and
4422 Matlab. The _* vars and Out[] list are still updated, just like
4432 Matlab. The _* vars and Out[] list are still updated, just like
4423 Mathematica behaves.
4433 Mathematica behaves.
4424
4434
4425 2002-06-25 Fernando Perez <fperez@colorado.edu>
4435 2002-06-25 Fernando Perez <fperez@colorado.edu>
4426
4436
4427 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4437 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4428 .ini extensions for profiels under Windows.
4438 .ini extensions for profiels under Windows.
4429
4439
4430 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4440 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4431 string form. Fix contributed by Alexander Schmolck
4441 string form. Fix contributed by Alexander Schmolck
4432 <a.schmolck-AT-gmx.net>
4442 <a.schmolck-AT-gmx.net>
4433
4443
4434 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4444 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4435 pre-configured Gnuplot instance.
4445 pre-configured Gnuplot instance.
4436
4446
4437 2002-06-21 Fernando Perez <fperez@colorado.edu>
4447 2002-06-21 Fernando Perez <fperez@colorado.edu>
4438
4448
4439 * IPython/numutils.py (exp_safe): new function, works around the
4449 * IPython/numutils.py (exp_safe): new function, works around the
4440 underflow problems in Numeric.
4450 underflow problems in Numeric.
4441 (log2): New fn. Safe log in base 2: returns exact integer answer
4451 (log2): New fn. Safe log in base 2: returns exact integer answer
4442 for exact integer powers of 2.
4452 for exact integer powers of 2.
4443
4453
4444 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4454 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4445 properly.
4455 properly.
4446
4456
4447 2002-06-20 Fernando Perez <fperez@colorado.edu>
4457 2002-06-20 Fernando Perez <fperez@colorado.edu>
4448
4458
4449 * IPython/genutils.py (timing): new function like
4459 * IPython/genutils.py (timing): new function like
4450 Mathematica's. Similar to time_test, but returns more info.
4460 Mathematica's. Similar to time_test, but returns more info.
4451
4461
4452 2002-06-18 Fernando Perez <fperez@colorado.edu>
4462 2002-06-18 Fernando Perez <fperez@colorado.edu>
4453
4463
4454 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4464 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4455 according to Mike Heeter's suggestions.
4465 according to Mike Heeter's suggestions.
4456
4466
4457 2002-06-16 Fernando Perez <fperez@colorado.edu>
4467 2002-06-16 Fernando Perez <fperez@colorado.edu>
4458
4468
4459 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4469 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4460 system. GnuplotMagic is gone as a user-directory option. New files
4470 system. GnuplotMagic is gone as a user-directory option. New files
4461 make it easier to use all the gnuplot stuff both from external
4471 make it easier to use all the gnuplot stuff both from external
4462 programs as well as from IPython. Had to rewrite part of
4472 programs as well as from IPython. Had to rewrite part of
4463 hardcopy() b/c of a strange bug: often the ps files simply don't
4473 hardcopy() b/c of a strange bug: often the ps files simply don't
4464 get created, and require a repeat of the command (often several
4474 get created, and require a repeat of the command (often several
4465 times).
4475 times).
4466
4476
4467 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4477 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4468 resolve output channel at call time, so that if sys.stderr has
4478 resolve output channel at call time, so that if sys.stderr has
4469 been redirected by user this gets honored.
4479 been redirected by user this gets honored.
4470
4480
4471 2002-06-13 Fernando Perez <fperez@colorado.edu>
4481 2002-06-13 Fernando Perez <fperez@colorado.edu>
4472
4482
4473 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4483 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4474 IPShell. Kept a copy with the old names to avoid breaking people's
4484 IPShell. Kept a copy with the old names to avoid breaking people's
4475 embedded code.
4485 embedded code.
4476
4486
4477 * IPython/ipython: simplified it to the bare minimum after
4487 * IPython/ipython: simplified it to the bare minimum after
4478 Holger's suggestions. Added info about how to use it in
4488 Holger's suggestions. Added info about how to use it in
4479 PYTHONSTARTUP.
4489 PYTHONSTARTUP.
4480
4490
4481 * IPython/Shell.py (IPythonShell): changed the options passing
4491 * IPython/Shell.py (IPythonShell): changed the options passing
4482 from a string with funky %s replacements to a straight list. Maybe
4492 from a string with funky %s replacements to a straight list. Maybe
4483 a bit more typing, but it follows sys.argv conventions, so there's
4493 a bit more typing, but it follows sys.argv conventions, so there's
4484 less special-casing to remember.
4494 less special-casing to remember.
4485
4495
4486 2002-06-12 Fernando Perez <fperez@colorado.edu>
4496 2002-06-12 Fernando Perez <fperez@colorado.edu>
4487
4497
4488 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4498 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4489 command. Thanks to a suggestion by Mike Heeter.
4499 command. Thanks to a suggestion by Mike Heeter.
4490 (Magic.magic_pfile): added behavior to look at filenames if given
4500 (Magic.magic_pfile): added behavior to look at filenames if given
4491 arg is not a defined object.
4501 arg is not a defined object.
4492 (Magic.magic_save): New @save function to save code snippets. Also
4502 (Magic.magic_save): New @save function to save code snippets. Also
4493 a Mike Heeter idea.
4503 a Mike Heeter idea.
4494
4504
4495 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4505 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4496 plot() and replot(). Much more convenient now, especially for
4506 plot() and replot(). Much more convenient now, especially for
4497 interactive use.
4507 interactive use.
4498
4508
4499 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4509 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4500 filenames.
4510 filenames.
4501
4511
4502 2002-06-02 Fernando Perez <fperez@colorado.edu>
4512 2002-06-02 Fernando Perez <fperez@colorado.edu>
4503
4513
4504 * IPython/Struct.py (Struct.__init__): modified to admit
4514 * IPython/Struct.py (Struct.__init__): modified to admit
4505 initialization via another struct.
4515 initialization via another struct.
4506
4516
4507 * IPython/genutils.py (SystemExec.__init__): New stateful
4517 * IPython/genutils.py (SystemExec.__init__): New stateful
4508 interface to xsys and bq. Useful for writing system scripts.
4518 interface to xsys and bq. Useful for writing system scripts.
4509
4519
4510 2002-05-30 Fernando Perez <fperez@colorado.edu>
4520 2002-05-30 Fernando Perez <fperez@colorado.edu>
4511
4521
4512 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4522 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4513 documents. This will make the user download smaller (it's getting
4523 documents. This will make the user download smaller (it's getting
4514 too big).
4524 too big).
4515
4525
4516 2002-05-29 Fernando Perez <fperez@colorado.edu>
4526 2002-05-29 Fernando Perez <fperez@colorado.edu>
4517
4527
4518 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4528 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4519 fix problems with shelve and pickle. Seems to work, but I don't
4529 fix problems with shelve and pickle. Seems to work, but I don't
4520 know if corner cases break it. Thanks to Mike Heeter
4530 know if corner cases break it. Thanks to Mike Heeter
4521 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4531 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4522
4532
4523 2002-05-24 Fernando Perez <fperez@colorado.edu>
4533 2002-05-24 Fernando Perez <fperez@colorado.edu>
4524
4534
4525 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4535 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4526 macros having broken.
4536 macros having broken.
4527
4537
4528 2002-05-21 Fernando Perez <fperez@colorado.edu>
4538 2002-05-21 Fernando Perez <fperez@colorado.edu>
4529
4539
4530 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4540 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4531 introduced logging bug: all history before logging started was
4541 introduced logging bug: all history before logging started was
4532 being written one character per line! This came from the redesign
4542 being written one character per line! This came from the redesign
4533 of the input history as a special list which slices to strings,
4543 of the input history as a special list which slices to strings,
4534 not to lists.
4544 not to lists.
4535
4545
4536 2002-05-20 Fernando Perez <fperez@colorado.edu>
4546 2002-05-20 Fernando Perez <fperez@colorado.edu>
4537
4547
4538 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4548 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4539 be an attribute of all classes in this module. The design of these
4549 be an attribute of all classes in this module. The design of these
4540 classes needs some serious overhauling.
4550 classes needs some serious overhauling.
4541
4551
4542 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4552 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4543 which was ignoring '_' in option names.
4553 which was ignoring '_' in option names.
4544
4554
4545 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4555 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4546 'Verbose_novars' to 'Context' and made it the new default. It's a
4556 'Verbose_novars' to 'Context' and made it the new default. It's a
4547 bit more readable and also safer than verbose.
4557 bit more readable and also safer than verbose.
4548
4558
4549 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4559 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4550 triple-quoted strings.
4560 triple-quoted strings.
4551
4561
4552 * IPython/OInspect.py (__all__): new module exposing the object
4562 * IPython/OInspect.py (__all__): new module exposing the object
4553 introspection facilities. Now the corresponding magics are dummy
4563 introspection facilities. Now the corresponding magics are dummy
4554 wrappers around this. Having this module will make it much easier
4564 wrappers around this. Having this module will make it much easier
4555 to put these functions into our modified pdb.
4565 to put these functions into our modified pdb.
4556 This new object inspector system uses the new colorizing module,
4566 This new object inspector system uses the new colorizing module,
4557 so source code and other things are nicely syntax highlighted.
4567 so source code and other things are nicely syntax highlighted.
4558
4568
4559 2002-05-18 Fernando Perez <fperez@colorado.edu>
4569 2002-05-18 Fernando Perez <fperez@colorado.edu>
4560
4570
4561 * IPython/ColorANSI.py: Split the coloring tools into a separate
4571 * IPython/ColorANSI.py: Split the coloring tools into a separate
4562 module so I can use them in other code easier (they were part of
4572 module so I can use them in other code easier (they were part of
4563 ultraTB).
4573 ultraTB).
4564
4574
4565 2002-05-17 Fernando Perez <fperez@colorado.edu>
4575 2002-05-17 Fernando Perez <fperez@colorado.edu>
4566
4576
4567 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4577 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4568 fixed it to set the global 'g' also to the called instance, as
4578 fixed it to set the global 'g' also to the called instance, as
4569 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4579 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4570 user's 'g' variables).
4580 user's 'g' variables).
4571
4581
4572 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4582 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4573 global variables (aliases to _ih,_oh) so that users which expect
4583 global variables (aliases to _ih,_oh) so that users which expect
4574 In[5] or Out[7] to work aren't unpleasantly surprised.
4584 In[5] or Out[7] to work aren't unpleasantly surprised.
4575 (InputList.__getslice__): new class to allow executing slices of
4585 (InputList.__getslice__): new class to allow executing slices of
4576 input history directly. Very simple class, complements the use of
4586 input history directly. Very simple class, complements the use of
4577 macros.
4587 macros.
4578
4588
4579 2002-05-16 Fernando Perez <fperez@colorado.edu>
4589 2002-05-16 Fernando Perez <fperez@colorado.edu>
4580
4590
4581 * setup.py (docdirbase): make doc directory be just doc/IPython
4591 * setup.py (docdirbase): make doc directory be just doc/IPython
4582 without version numbers, it will reduce clutter for users.
4592 without version numbers, it will reduce clutter for users.
4583
4593
4584 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4594 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4585 execfile call to prevent possible memory leak. See for details:
4595 execfile call to prevent possible memory leak. See for details:
4586 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4596 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4587
4597
4588 2002-05-15 Fernando Perez <fperez@colorado.edu>
4598 2002-05-15 Fernando Perez <fperez@colorado.edu>
4589
4599
4590 * IPython/Magic.py (Magic.magic_psource): made the object
4600 * IPython/Magic.py (Magic.magic_psource): made the object
4591 introspection names be more standard: pdoc, pdef, pfile and
4601 introspection names be more standard: pdoc, pdef, pfile and
4592 psource. They all print/page their output, and it makes
4602 psource. They all print/page their output, and it makes
4593 remembering them easier. Kept old names for compatibility as
4603 remembering them easier. Kept old names for compatibility as
4594 aliases.
4604 aliases.
4595
4605
4596 2002-05-14 Fernando Perez <fperez@colorado.edu>
4606 2002-05-14 Fernando Perez <fperez@colorado.edu>
4597
4607
4598 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4608 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4599 what the mouse problem was. The trick is to use gnuplot with temp
4609 what the mouse problem was. The trick is to use gnuplot with temp
4600 files and NOT with pipes (for data communication), because having
4610 files and NOT with pipes (for data communication), because having
4601 both pipes and the mouse on is bad news.
4611 both pipes and the mouse on is bad news.
4602
4612
4603 2002-05-13 Fernando Perez <fperez@colorado.edu>
4613 2002-05-13 Fernando Perez <fperez@colorado.edu>
4604
4614
4605 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4615 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4606 bug. Information would be reported about builtins even when
4616 bug. Information would be reported about builtins even when
4607 user-defined functions overrode them.
4617 user-defined functions overrode them.
4608
4618
4609 2002-05-11 Fernando Perez <fperez@colorado.edu>
4619 2002-05-11 Fernando Perez <fperez@colorado.edu>
4610
4620
4611 * IPython/__init__.py (__all__): removed FlexCompleter from
4621 * IPython/__init__.py (__all__): removed FlexCompleter from
4612 __all__ so that things don't fail in platforms without readline.
4622 __all__ so that things don't fail in platforms without readline.
4613
4623
4614 2002-05-10 Fernando Perez <fperez@colorado.edu>
4624 2002-05-10 Fernando Perez <fperez@colorado.edu>
4615
4625
4616 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4626 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4617 it requires Numeric, effectively making Numeric a dependency for
4627 it requires Numeric, effectively making Numeric a dependency for
4618 IPython.
4628 IPython.
4619
4629
4620 * Released 0.2.13
4630 * Released 0.2.13
4621
4631
4622 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4632 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4623 profiler interface. Now all the major options from the profiler
4633 profiler interface. Now all the major options from the profiler
4624 module are directly supported in IPython, both for single
4634 module are directly supported in IPython, both for single
4625 expressions (@prun) and for full programs (@run -p).
4635 expressions (@prun) and for full programs (@run -p).
4626
4636
4627 2002-05-09 Fernando Perez <fperez@colorado.edu>
4637 2002-05-09 Fernando Perez <fperez@colorado.edu>
4628
4638
4629 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4639 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4630 magic properly formatted for screen.
4640 magic properly formatted for screen.
4631
4641
4632 * setup.py (make_shortcut): Changed things to put pdf version in
4642 * setup.py (make_shortcut): Changed things to put pdf version in
4633 doc/ instead of doc/manual (had to change lyxport a bit).
4643 doc/ instead of doc/manual (had to change lyxport a bit).
4634
4644
4635 * IPython/Magic.py (Profile.string_stats): made profile runs go
4645 * IPython/Magic.py (Profile.string_stats): made profile runs go
4636 through pager (they are long and a pager allows searching, saving,
4646 through pager (they are long and a pager allows searching, saving,
4637 etc.)
4647 etc.)
4638
4648
4639 2002-05-08 Fernando Perez <fperez@colorado.edu>
4649 2002-05-08 Fernando Perez <fperez@colorado.edu>
4640
4650
4641 * Released 0.2.12
4651 * Released 0.2.12
4642
4652
4643 2002-05-06 Fernando Perez <fperez@colorado.edu>
4653 2002-05-06 Fernando Perez <fperez@colorado.edu>
4644
4654
4645 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4655 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4646 introduced); 'hist n1 n2' was broken.
4656 introduced); 'hist n1 n2' was broken.
4647 (Magic.magic_pdb): added optional on/off arguments to @pdb
4657 (Magic.magic_pdb): added optional on/off arguments to @pdb
4648 (Magic.magic_run): added option -i to @run, which executes code in
4658 (Magic.magic_run): added option -i to @run, which executes code in
4649 the IPython namespace instead of a clean one. Also added @irun as
4659 the IPython namespace instead of a clean one. Also added @irun as
4650 an alias to @run -i.
4660 an alias to @run -i.
4651
4661
4652 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4662 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4653 fixed (it didn't really do anything, the namespaces were wrong).
4663 fixed (it didn't really do anything, the namespaces were wrong).
4654
4664
4655 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4665 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4656
4666
4657 * IPython/__init__.py (__all__): Fixed package namespace, now
4667 * IPython/__init__.py (__all__): Fixed package namespace, now
4658 'import IPython' does give access to IPython.<all> as
4668 'import IPython' does give access to IPython.<all> as
4659 expected. Also renamed __release__ to Release.
4669 expected. Also renamed __release__ to Release.
4660
4670
4661 * IPython/Debugger.py (__license__): created new Pdb class which
4671 * IPython/Debugger.py (__license__): created new Pdb class which
4662 functions like a drop-in for the normal pdb.Pdb but does NOT
4672 functions like a drop-in for the normal pdb.Pdb but does NOT
4663 import readline by default. This way it doesn't muck up IPython's
4673 import readline by default. This way it doesn't muck up IPython's
4664 readline handling, and now tab-completion finally works in the
4674 readline handling, and now tab-completion finally works in the
4665 debugger -- sort of. It completes things globally visible, but the
4675 debugger -- sort of. It completes things globally visible, but the
4666 completer doesn't track the stack as pdb walks it. That's a bit
4676 completer doesn't track the stack as pdb walks it. That's a bit
4667 tricky, and I'll have to implement it later.
4677 tricky, and I'll have to implement it later.
4668
4678
4669 2002-05-05 Fernando Perez <fperez@colorado.edu>
4679 2002-05-05 Fernando Perez <fperez@colorado.edu>
4670
4680
4671 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4681 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4672 magic docstrings when printed via ? (explicit \'s were being
4682 magic docstrings when printed via ? (explicit \'s were being
4673 printed).
4683 printed).
4674
4684
4675 * IPython/ipmaker.py (make_IPython): fixed namespace
4685 * IPython/ipmaker.py (make_IPython): fixed namespace
4676 identification bug. Now variables loaded via logs or command-line
4686 identification bug. Now variables loaded via logs or command-line
4677 files are recognized in the interactive namespace by @who.
4687 files are recognized in the interactive namespace by @who.
4678
4688
4679 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4689 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4680 log replay system stemming from the string form of Structs.
4690 log replay system stemming from the string form of Structs.
4681
4691
4682 * IPython/Magic.py (Macro.__init__): improved macros to properly
4692 * IPython/Magic.py (Macro.__init__): improved macros to properly
4683 handle magic commands in them.
4693 handle magic commands in them.
4684 (Magic.magic_logstart): usernames are now expanded so 'logstart
4694 (Magic.magic_logstart): usernames are now expanded so 'logstart
4685 ~/mylog' now works.
4695 ~/mylog' now works.
4686
4696
4687 * IPython/iplib.py (complete): fixed bug where paths starting with
4697 * IPython/iplib.py (complete): fixed bug where paths starting with
4688 '/' would be completed as magic names.
4698 '/' would be completed as magic names.
4689
4699
4690 2002-05-04 Fernando Perez <fperez@colorado.edu>
4700 2002-05-04 Fernando Perez <fperez@colorado.edu>
4691
4701
4692 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4702 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4693 allow running full programs under the profiler's control.
4703 allow running full programs under the profiler's control.
4694
4704
4695 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4705 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4696 mode to report exceptions verbosely but without formatting
4706 mode to report exceptions verbosely but without formatting
4697 variables. This addresses the issue of ipython 'freezing' (it's
4707 variables. This addresses the issue of ipython 'freezing' (it's
4698 not frozen, but caught in an expensive formatting loop) when huge
4708 not frozen, but caught in an expensive formatting loop) when huge
4699 variables are in the context of an exception.
4709 variables are in the context of an exception.
4700 (VerboseTB.text): Added '--->' markers at line where exception was
4710 (VerboseTB.text): Added '--->' markers at line where exception was
4701 triggered. Much clearer to read, especially in NoColor modes.
4711 triggered. Much clearer to read, especially in NoColor modes.
4702
4712
4703 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4713 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4704 implemented in reverse when changing to the new parse_options().
4714 implemented in reverse when changing to the new parse_options().
4705
4715
4706 2002-05-03 Fernando Perez <fperez@colorado.edu>
4716 2002-05-03 Fernando Perez <fperez@colorado.edu>
4707
4717
4708 * IPython/Magic.py (Magic.parse_options): new function so that
4718 * IPython/Magic.py (Magic.parse_options): new function so that
4709 magics can parse options easier.
4719 magics can parse options easier.
4710 (Magic.magic_prun): new function similar to profile.run(),
4720 (Magic.magic_prun): new function similar to profile.run(),
4711 suggested by Chris Hart.
4721 suggested by Chris Hart.
4712 (Magic.magic_cd): fixed behavior so that it only changes if
4722 (Magic.magic_cd): fixed behavior so that it only changes if
4713 directory actually is in history.
4723 directory actually is in history.
4714
4724
4715 * IPython/usage.py (__doc__): added information about potential
4725 * IPython/usage.py (__doc__): added information about potential
4716 slowness of Verbose exception mode when there are huge data
4726 slowness of Verbose exception mode when there are huge data
4717 structures to be formatted (thanks to Archie Paulson).
4727 structures to be formatted (thanks to Archie Paulson).
4718
4728
4719 * IPython/ipmaker.py (make_IPython): Changed default logging
4729 * IPython/ipmaker.py (make_IPython): Changed default logging
4720 (when simply called with -log) to use curr_dir/ipython.log in
4730 (when simply called with -log) to use curr_dir/ipython.log in
4721 rotate mode. Fixed crash which was occuring with -log before
4731 rotate mode. Fixed crash which was occuring with -log before
4722 (thanks to Jim Boyle).
4732 (thanks to Jim Boyle).
4723
4733
4724 2002-05-01 Fernando Perez <fperez@colorado.edu>
4734 2002-05-01 Fernando Perez <fperez@colorado.edu>
4725
4735
4726 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4736 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4727 was nasty -- though somewhat of a corner case).
4737 was nasty -- though somewhat of a corner case).
4728
4738
4729 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4739 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4730 text (was a bug).
4740 text (was a bug).
4731
4741
4732 2002-04-30 Fernando Perez <fperez@colorado.edu>
4742 2002-04-30 Fernando Perez <fperez@colorado.edu>
4733
4743
4734 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4744 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4735 a print after ^D or ^C from the user so that the In[] prompt
4745 a print after ^D or ^C from the user so that the In[] prompt
4736 doesn't over-run the gnuplot one.
4746 doesn't over-run the gnuplot one.
4737
4747
4738 2002-04-29 Fernando Perez <fperez@colorado.edu>
4748 2002-04-29 Fernando Perez <fperez@colorado.edu>
4739
4749
4740 * Released 0.2.10
4750 * Released 0.2.10
4741
4751
4742 * IPython/__release__.py (version): get date dynamically.
4752 * IPython/__release__.py (version): get date dynamically.
4743
4753
4744 * Misc. documentation updates thanks to Arnd's comments. Also ran
4754 * Misc. documentation updates thanks to Arnd's comments. Also ran
4745 a full spellcheck on the manual (hadn't been done in a while).
4755 a full spellcheck on the manual (hadn't been done in a while).
4746
4756
4747 2002-04-27 Fernando Perez <fperez@colorado.edu>
4757 2002-04-27 Fernando Perez <fperez@colorado.edu>
4748
4758
4749 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4759 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4750 starting a log in mid-session would reset the input history list.
4760 starting a log in mid-session would reset the input history list.
4751
4761
4752 2002-04-26 Fernando Perez <fperez@colorado.edu>
4762 2002-04-26 Fernando Perez <fperez@colorado.edu>
4753
4763
4754 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4764 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4755 all files were being included in an update. Now anything in
4765 all files were being included in an update. Now anything in
4756 UserConfig that matches [A-Za-z]*.py will go (this excludes
4766 UserConfig that matches [A-Za-z]*.py will go (this excludes
4757 __init__.py)
4767 __init__.py)
4758
4768
4759 2002-04-25 Fernando Perez <fperez@colorado.edu>
4769 2002-04-25 Fernando Perez <fperez@colorado.edu>
4760
4770
4761 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4771 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4762 to __builtins__ so that any form of embedded or imported code can
4772 to __builtins__ so that any form of embedded or imported code can
4763 test for being inside IPython.
4773 test for being inside IPython.
4764
4774
4765 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4775 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4766 changed to GnuplotMagic because it's now an importable module,
4776 changed to GnuplotMagic because it's now an importable module,
4767 this makes the name follow that of the standard Gnuplot module.
4777 this makes the name follow that of the standard Gnuplot module.
4768 GnuplotMagic can now be loaded at any time in mid-session.
4778 GnuplotMagic can now be loaded at any time in mid-session.
4769
4779
4770 2002-04-24 Fernando Perez <fperez@colorado.edu>
4780 2002-04-24 Fernando Perez <fperez@colorado.edu>
4771
4781
4772 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4782 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4773 the globals (IPython has its own namespace) and the
4783 the globals (IPython has its own namespace) and the
4774 PhysicalQuantity stuff is much better anyway.
4784 PhysicalQuantity stuff is much better anyway.
4775
4785
4776 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4786 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4777 embedding example to standard user directory for
4787 embedding example to standard user directory for
4778 distribution. Also put it in the manual.
4788 distribution. Also put it in the manual.
4779
4789
4780 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4790 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4781 instance as first argument (so it doesn't rely on some obscure
4791 instance as first argument (so it doesn't rely on some obscure
4782 hidden global).
4792 hidden global).
4783
4793
4784 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4794 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4785 delimiters. While it prevents ().TAB from working, it allows
4795 delimiters. While it prevents ().TAB from working, it allows
4786 completions in open (... expressions. This is by far a more common
4796 completions in open (... expressions. This is by far a more common
4787 case.
4797 case.
4788
4798
4789 2002-04-23 Fernando Perez <fperez@colorado.edu>
4799 2002-04-23 Fernando Perez <fperez@colorado.edu>
4790
4800
4791 * IPython/Extensions/InterpreterPasteInput.py: new
4801 * IPython/Extensions/InterpreterPasteInput.py: new
4792 syntax-processing module for pasting lines with >>> or ... at the
4802 syntax-processing module for pasting lines with >>> or ... at the
4793 start.
4803 start.
4794
4804
4795 * IPython/Extensions/PhysicalQ_Interactive.py
4805 * IPython/Extensions/PhysicalQ_Interactive.py
4796 (PhysicalQuantityInteractive.__int__): fixed to work with either
4806 (PhysicalQuantityInteractive.__int__): fixed to work with either
4797 Numeric or math.
4807 Numeric or math.
4798
4808
4799 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4809 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4800 provided profiles. Now we have:
4810 provided profiles. Now we have:
4801 -math -> math module as * and cmath with its own namespace.
4811 -math -> math module as * and cmath with its own namespace.
4802 -numeric -> Numeric as *, plus gnuplot & grace
4812 -numeric -> Numeric as *, plus gnuplot & grace
4803 -physics -> same as before
4813 -physics -> same as before
4804
4814
4805 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4815 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4806 user-defined magics wouldn't be found by @magic if they were
4816 user-defined magics wouldn't be found by @magic if they were
4807 defined as class methods. Also cleaned up the namespace search
4817 defined as class methods. Also cleaned up the namespace search
4808 logic and the string building (to use %s instead of many repeated
4818 logic and the string building (to use %s instead of many repeated
4809 string adds).
4819 string adds).
4810
4820
4811 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4821 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4812 of user-defined magics to operate with class methods (cleaner, in
4822 of user-defined magics to operate with class methods (cleaner, in
4813 line with the gnuplot code).
4823 line with the gnuplot code).
4814
4824
4815 2002-04-22 Fernando Perez <fperez@colorado.edu>
4825 2002-04-22 Fernando Perez <fperez@colorado.edu>
4816
4826
4817 * setup.py: updated dependency list so that manual is updated when
4827 * setup.py: updated dependency list so that manual is updated when
4818 all included files change.
4828 all included files change.
4819
4829
4820 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4830 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4821 the delimiter removal option (the fix is ugly right now).
4831 the delimiter removal option (the fix is ugly right now).
4822
4832
4823 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4833 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4824 all of the math profile (quicker loading, no conflict between
4834 all of the math profile (quicker loading, no conflict between
4825 g-9.8 and g-gnuplot).
4835 g-9.8 and g-gnuplot).
4826
4836
4827 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4837 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4828 name of post-mortem files to IPython_crash_report.txt.
4838 name of post-mortem files to IPython_crash_report.txt.
4829
4839
4830 * Cleanup/update of the docs. Added all the new readline info and
4840 * Cleanup/update of the docs. Added all the new readline info and
4831 formatted all lists as 'real lists'.
4841 formatted all lists as 'real lists'.
4832
4842
4833 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4843 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4834 tab-completion options, since the full readline parse_and_bind is
4844 tab-completion options, since the full readline parse_and_bind is
4835 now accessible.
4845 now accessible.
4836
4846
4837 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4847 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4838 handling of readline options. Now users can specify any string to
4848 handling of readline options. Now users can specify any string to
4839 be passed to parse_and_bind(), as well as the delimiters to be
4849 be passed to parse_and_bind(), as well as the delimiters to be
4840 removed.
4850 removed.
4841 (InteractiveShell.__init__): Added __name__ to the global
4851 (InteractiveShell.__init__): Added __name__ to the global
4842 namespace so that things like Itpl which rely on its existence
4852 namespace so that things like Itpl which rely on its existence
4843 don't crash.
4853 don't crash.
4844 (InteractiveShell._prefilter): Defined the default with a _ so
4854 (InteractiveShell._prefilter): Defined the default with a _ so
4845 that prefilter() is easier to override, while the default one
4855 that prefilter() is easier to override, while the default one
4846 remains available.
4856 remains available.
4847
4857
4848 2002-04-18 Fernando Perez <fperez@colorado.edu>
4858 2002-04-18 Fernando Perez <fperez@colorado.edu>
4849
4859
4850 * Added information about pdb in the docs.
4860 * Added information about pdb in the docs.
4851
4861
4852 2002-04-17 Fernando Perez <fperez@colorado.edu>
4862 2002-04-17 Fernando Perez <fperez@colorado.edu>
4853
4863
4854 * IPython/ipmaker.py (make_IPython): added rc_override option to
4864 * IPython/ipmaker.py (make_IPython): added rc_override option to
4855 allow passing config options at creation time which may override
4865 allow passing config options at creation time which may override
4856 anything set in the config files or command line. This is
4866 anything set in the config files or command line. This is
4857 particularly useful for configuring embedded instances.
4867 particularly useful for configuring embedded instances.
4858
4868
4859 2002-04-15 Fernando Perez <fperez@colorado.edu>
4869 2002-04-15 Fernando Perez <fperez@colorado.edu>
4860
4870
4861 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4871 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4862 crash embedded instances because of the input cache falling out of
4872 crash embedded instances because of the input cache falling out of
4863 sync with the output counter.
4873 sync with the output counter.
4864
4874
4865 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4875 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4866 mode which calls pdb after an uncaught exception in IPython itself.
4876 mode which calls pdb after an uncaught exception in IPython itself.
4867
4877
4868 2002-04-14 Fernando Perez <fperez@colorado.edu>
4878 2002-04-14 Fernando Perez <fperez@colorado.edu>
4869
4879
4870 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4880 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4871 readline, fix it back after each call.
4881 readline, fix it back after each call.
4872
4882
4873 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4883 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4874 method to force all access via __call__(), which guarantees that
4884 method to force all access via __call__(), which guarantees that
4875 traceback references are properly deleted.
4885 traceback references are properly deleted.
4876
4886
4877 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4887 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4878 improve printing when pprint is in use.
4888 improve printing when pprint is in use.
4879
4889
4880 2002-04-13 Fernando Perez <fperez@colorado.edu>
4890 2002-04-13 Fernando Perez <fperez@colorado.edu>
4881
4891
4882 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4892 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4883 exceptions aren't caught anymore. If the user triggers one, he
4893 exceptions aren't caught anymore. If the user triggers one, he
4884 should know why he's doing it and it should go all the way up,
4894 should know why he's doing it and it should go all the way up,
4885 just like any other exception. So now @abort will fully kill the
4895 just like any other exception. So now @abort will fully kill the
4886 embedded interpreter and the embedding code (unless that happens
4896 embedded interpreter and the embedding code (unless that happens
4887 to catch SystemExit).
4897 to catch SystemExit).
4888
4898
4889 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4899 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4890 and a debugger() method to invoke the interactive pdb debugger
4900 and a debugger() method to invoke the interactive pdb debugger
4891 after printing exception information. Also added the corresponding
4901 after printing exception information. Also added the corresponding
4892 -pdb option and @pdb magic to control this feature, and updated
4902 -pdb option and @pdb magic to control this feature, and updated
4893 the docs. After a suggestion from Christopher Hart
4903 the docs. After a suggestion from Christopher Hart
4894 (hart-AT-caltech.edu).
4904 (hart-AT-caltech.edu).
4895
4905
4896 2002-04-12 Fernando Perez <fperez@colorado.edu>
4906 2002-04-12 Fernando Perez <fperez@colorado.edu>
4897
4907
4898 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4908 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4899 the exception handlers defined by the user (not the CrashHandler)
4909 the exception handlers defined by the user (not the CrashHandler)
4900 so that user exceptions don't trigger an ipython bug report.
4910 so that user exceptions don't trigger an ipython bug report.
4901
4911
4902 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4912 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4903 configurable (it should have always been so).
4913 configurable (it should have always been so).
4904
4914
4905 2002-03-26 Fernando Perez <fperez@colorado.edu>
4915 2002-03-26 Fernando Perez <fperez@colorado.edu>
4906
4916
4907 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4917 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4908 and there to fix embedding namespace issues. This should all be
4918 and there to fix embedding namespace issues. This should all be
4909 done in a more elegant way.
4919 done in a more elegant way.
4910
4920
4911 2002-03-25 Fernando Perez <fperez@colorado.edu>
4921 2002-03-25 Fernando Perez <fperez@colorado.edu>
4912
4922
4913 * IPython/genutils.py (get_home_dir): Try to make it work under
4923 * IPython/genutils.py (get_home_dir): Try to make it work under
4914 win9x also.
4924 win9x also.
4915
4925
4916 2002-03-20 Fernando Perez <fperez@colorado.edu>
4926 2002-03-20 Fernando Perez <fperez@colorado.edu>
4917
4927
4918 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4928 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4919 sys.displayhook untouched upon __init__.
4929 sys.displayhook untouched upon __init__.
4920
4930
4921 2002-03-19 Fernando Perez <fperez@colorado.edu>
4931 2002-03-19 Fernando Perez <fperez@colorado.edu>
4922
4932
4923 * Released 0.2.9 (for embedding bug, basically).
4933 * Released 0.2.9 (for embedding bug, basically).
4924
4934
4925 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4935 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4926 exceptions so that enclosing shell's state can be restored.
4936 exceptions so that enclosing shell's state can be restored.
4927
4937
4928 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4938 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4929 naming conventions in the .ipython/ dir.
4939 naming conventions in the .ipython/ dir.
4930
4940
4931 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4941 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4932 from delimiters list so filenames with - in them get expanded.
4942 from delimiters list so filenames with - in them get expanded.
4933
4943
4934 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4944 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4935 sys.displayhook not being properly restored after an embedded call.
4945 sys.displayhook not being properly restored after an embedded call.
4936
4946
4937 2002-03-18 Fernando Perez <fperez@colorado.edu>
4947 2002-03-18 Fernando Perez <fperez@colorado.edu>
4938
4948
4939 * Released 0.2.8
4949 * Released 0.2.8
4940
4950
4941 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4951 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4942 some files weren't being included in a -upgrade.
4952 some files weren't being included in a -upgrade.
4943 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4953 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4944 on' so that the first tab completes.
4954 on' so that the first tab completes.
4945 (InteractiveShell.handle_magic): fixed bug with spaces around
4955 (InteractiveShell.handle_magic): fixed bug with spaces around
4946 quotes breaking many magic commands.
4956 quotes breaking many magic commands.
4947
4957
4948 * setup.py: added note about ignoring the syntax error messages at
4958 * setup.py: added note about ignoring the syntax error messages at
4949 installation.
4959 installation.
4950
4960
4951 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4961 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4952 streamlining the gnuplot interface, now there's only one magic @gp.
4962 streamlining the gnuplot interface, now there's only one magic @gp.
4953
4963
4954 2002-03-17 Fernando Perez <fperez@colorado.edu>
4964 2002-03-17 Fernando Perez <fperez@colorado.edu>
4955
4965
4956 * IPython/UserConfig/magic_gnuplot.py: new name for the
4966 * IPython/UserConfig/magic_gnuplot.py: new name for the
4957 example-magic_pm.py file. Much enhanced system, now with a shell
4967 example-magic_pm.py file. Much enhanced system, now with a shell
4958 for communicating directly with gnuplot, one command at a time.
4968 for communicating directly with gnuplot, one command at a time.
4959
4969
4960 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4970 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4961 setting __name__=='__main__'.
4971 setting __name__=='__main__'.
4962
4972
4963 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4973 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4964 mini-shell for accessing gnuplot from inside ipython. Should
4974 mini-shell for accessing gnuplot from inside ipython. Should
4965 extend it later for grace access too. Inspired by Arnd's
4975 extend it later for grace access too. Inspired by Arnd's
4966 suggestion.
4976 suggestion.
4967
4977
4968 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4978 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4969 calling magic functions with () in their arguments. Thanks to Arnd
4979 calling magic functions with () in their arguments. Thanks to Arnd
4970 Baecker for pointing this to me.
4980 Baecker for pointing this to me.
4971
4981
4972 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4982 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4973 infinitely for integer or complex arrays (only worked with floats).
4983 infinitely for integer or complex arrays (only worked with floats).
4974
4984
4975 2002-03-16 Fernando Perez <fperez@colorado.edu>
4985 2002-03-16 Fernando Perez <fperez@colorado.edu>
4976
4986
4977 * setup.py: Merged setup and setup_windows into a single script
4987 * setup.py: Merged setup and setup_windows into a single script
4978 which properly handles things for windows users.
4988 which properly handles things for windows users.
4979
4989
4980 2002-03-15 Fernando Perez <fperez@colorado.edu>
4990 2002-03-15 Fernando Perez <fperez@colorado.edu>
4981
4991
4982 * Big change to the manual: now the magics are all automatically
4992 * Big change to the manual: now the magics are all automatically
4983 documented. This information is generated from their docstrings
4993 documented. This information is generated from their docstrings
4984 and put in a latex file included by the manual lyx file. This way
4994 and put in a latex file included by the manual lyx file. This way
4985 we get always up to date information for the magics. The manual
4995 we get always up to date information for the magics. The manual
4986 now also has proper version information, also auto-synced.
4996 now also has proper version information, also auto-synced.
4987
4997
4988 For this to work, an undocumented --magic_docstrings option was added.
4998 For this to work, an undocumented --magic_docstrings option was added.
4989
4999
4990 2002-03-13 Fernando Perez <fperez@colorado.edu>
5000 2002-03-13 Fernando Perez <fperez@colorado.edu>
4991
5001
4992 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5002 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4993 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5003 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4994
5004
4995 2002-03-12 Fernando Perez <fperez@colorado.edu>
5005 2002-03-12 Fernando Perez <fperez@colorado.edu>
4996
5006
4997 * IPython/ultraTB.py (TermColors): changed color escapes again to
5007 * IPython/ultraTB.py (TermColors): changed color escapes again to
4998 fix the (old, reintroduced) line-wrapping bug. Basically, if
5008 fix the (old, reintroduced) line-wrapping bug. Basically, if
4999 \001..\002 aren't given in the color escapes, lines get wrapped
5009 \001..\002 aren't given in the color escapes, lines get wrapped
5000 weirdly. But giving those screws up old xterms and emacs terms. So
5010 weirdly. But giving those screws up old xterms and emacs terms. So
5001 I added some logic for emacs terms to be ok, but I can't identify old
5011 I added some logic for emacs terms to be ok, but I can't identify old
5002 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5012 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5003
5013
5004 2002-03-10 Fernando Perez <fperez@colorado.edu>
5014 2002-03-10 Fernando Perez <fperez@colorado.edu>
5005
5015
5006 * IPython/usage.py (__doc__): Various documentation cleanups and
5016 * IPython/usage.py (__doc__): Various documentation cleanups and
5007 updates, both in usage docstrings and in the manual.
5017 updates, both in usage docstrings and in the manual.
5008
5018
5009 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5019 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5010 handling of caching. Set minimum acceptabe value for having a
5020 handling of caching. Set minimum acceptabe value for having a
5011 cache at 20 values.
5021 cache at 20 values.
5012
5022
5013 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5023 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5014 install_first_time function to a method, renamed it and added an
5024 install_first_time function to a method, renamed it and added an
5015 'upgrade' mode. Now people can update their config directory with
5025 'upgrade' mode. Now people can update their config directory with
5016 a simple command line switch (-upgrade, also new).
5026 a simple command line switch (-upgrade, also new).
5017
5027
5018 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5028 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5019 @file (convenient for automagic users under Python >= 2.2).
5029 @file (convenient for automagic users under Python >= 2.2).
5020 Removed @files (it seemed more like a plural than an abbrev. of
5030 Removed @files (it seemed more like a plural than an abbrev. of
5021 'file show').
5031 'file show').
5022
5032
5023 * IPython/iplib.py (install_first_time): Fixed crash if there were
5033 * IPython/iplib.py (install_first_time): Fixed crash if there were
5024 backup files ('~') in .ipython/ install directory.
5034 backup files ('~') in .ipython/ install directory.
5025
5035
5026 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5036 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5027 system. Things look fine, but these changes are fairly
5037 system. Things look fine, but these changes are fairly
5028 intrusive. Test them for a few days.
5038 intrusive. Test them for a few days.
5029
5039
5030 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5040 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5031 the prompts system. Now all in/out prompt strings are user
5041 the prompts system. Now all in/out prompt strings are user
5032 controllable. This is particularly useful for embedding, as one
5042 controllable. This is particularly useful for embedding, as one
5033 can tag embedded instances with particular prompts.
5043 can tag embedded instances with particular prompts.
5034
5044
5035 Also removed global use of sys.ps1/2, which now allows nested
5045 Also removed global use of sys.ps1/2, which now allows nested
5036 embeddings without any problems. Added command-line options for
5046 embeddings without any problems. Added command-line options for
5037 the prompt strings.
5047 the prompt strings.
5038
5048
5039 2002-03-08 Fernando Perez <fperez@colorado.edu>
5049 2002-03-08 Fernando Perez <fperez@colorado.edu>
5040
5050
5041 * IPython/UserConfig/example-embed-short.py (ipshell): added
5051 * IPython/UserConfig/example-embed-short.py (ipshell): added
5042 example file with the bare minimum code for embedding.
5052 example file with the bare minimum code for embedding.
5043
5053
5044 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5054 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5045 functionality for the embeddable shell to be activated/deactivated
5055 functionality for the embeddable shell to be activated/deactivated
5046 either globally or at each call.
5056 either globally or at each call.
5047
5057
5048 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5058 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5049 rewriting the prompt with '--->' for auto-inputs with proper
5059 rewriting the prompt with '--->' for auto-inputs with proper
5050 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5060 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5051 this is handled by the prompts class itself, as it should.
5061 this is handled by the prompts class itself, as it should.
5052
5062
5053 2002-03-05 Fernando Perez <fperez@colorado.edu>
5063 2002-03-05 Fernando Perez <fperez@colorado.edu>
5054
5064
5055 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5065 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5056 @logstart to avoid name clashes with the math log function.
5066 @logstart to avoid name clashes with the math log function.
5057
5067
5058 * Big updates to X/Emacs section of the manual.
5068 * Big updates to X/Emacs section of the manual.
5059
5069
5060 * Removed ipython_emacs. Milan explained to me how to pass
5070 * Removed ipython_emacs. Milan explained to me how to pass
5061 arguments to ipython through Emacs. Some day I'm going to end up
5071 arguments to ipython through Emacs. Some day I'm going to end up
5062 learning some lisp...
5072 learning some lisp...
5063
5073
5064 2002-03-04 Fernando Perez <fperez@colorado.edu>
5074 2002-03-04 Fernando Perez <fperez@colorado.edu>
5065
5075
5066 * IPython/ipython_emacs: Created script to be used as the
5076 * IPython/ipython_emacs: Created script to be used as the
5067 py-python-command Emacs variable so we can pass IPython
5077 py-python-command Emacs variable so we can pass IPython
5068 parameters. I can't figure out how to tell Emacs directly to pass
5078 parameters. I can't figure out how to tell Emacs directly to pass
5069 parameters to IPython, so a dummy shell script will do it.
5079 parameters to IPython, so a dummy shell script will do it.
5070
5080
5071 Other enhancements made for things to work better under Emacs'
5081 Other enhancements made for things to work better under Emacs'
5072 various types of terminals. Many thanks to Milan Zamazal
5082 various types of terminals. Many thanks to Milan Zamazal
5073 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5083 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5074
5084
5075 2002-03-01 Fernando Perez <fperez@colorado.edu>
5085 2002-03-01 Fernando Perez <fperez@colorado.edu>
5076
5086
5077 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5087 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5078 that loading of readline is now optional. This gives better
5088 that loading of readline is now optional. This gives better
5079 control to emacs users.
5089 control to emacs users.
5080
5090
5081 * IPython/ultraTB.py (__date__): Modified color escape sequences
5091 * IPython/ultraTB.py (__date__): Modified color escape sequences
5082 and now things work fine under xterm and in Emacs' term buffers
5092 and now things work fine under xterm and in Emacs' term buffers
5083 (though not shell ones). Well, in emacs you get colors, but all
5093 (though not shell ones). Well, in emacs you get colors, but all
5084 seem to be 'light' colors (no difference between dark and light
5094 seem to be 'light' colors (no difference between dark and light
5085 ones). But the garbage chars are gone, and also in xterms. It
5095 ones). But the garbage chars are gone, and also in xterms. It
5086 seems that now I'm using 'cleaner' ansi sequences.
5096 seems that now I'm using 'cleaner' ansi sequences.
5087
5097
5088 2002-02-21 Fernando Perez <fperez@colorado.edu>
5098 2002-02-21 Fernando Perez <fperez@colorado.edu>
5089
5099
5090 * Released 0.2.7 (mainly to publish the scoping fix).
5100 * Released 0.2.7 (mainly to publish the scoping fix).
5091
5101
5092 * IPython/Logger.py (Logger.logstate): added. A corresponding
5102 * IPython/Logger.py (Logger.logstate): added. A corresponding
5093 @logstate magic was created.
5103 @logstate magic was created.
5094
5104
5095 * IPython/Magic.py: fixed nested scoping problem under Python
5105 * IPython/Magic.py: fixed nested scoping problem under Python
5096 2.1.x (automagic wasn't working).
5106 2.1.x (automagic wasn't working).
5097
5107
5098 2002-02-20 Fernando Perez <fperez@colorado.edu>
5108 2002-02-20 Fernando Perez <fperez@colorado.edu>
5099
5109
5100 * Released 0.2.6.
5110 * Released 0.2.6.
5101
5111
5102 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5112 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5103 option so that logs can come out without any headers at all.
5113 option so that logs can come out without any headers at all.
5104
5114
5105 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5115 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5106 SciPy.
5116 SciPy.
5107
5117
5108 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5118 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5109 that embedded IPython calls don't require vars() to be explicitly
5119 that embedded IPython calls don't require vars() to be explicitly
5110 passed. Now they are extracted from the caller's frame (code
5120 passed. Now they are extracted from the caller's frame (code
5111 snatched from Eric Jones' weave). Added better documentation to
5121 snatched from Eric Jones' weave). Added better documentation to
5112 the section on embedding and the example file.
5122 the section on embedding and the example file.
5113
5123
5114 * IPython/genutils.py (page): Changed so that under emacs, it just
5124 * IPython/genutils.py (page): Changed so that under emacs, it just
5115 prints the string. You can then page up and down in the emacs
5125 prints the string. You can then page up and down in the emacs
5116 buffer itself. This is how the builtin help() works.
5126 buffer itself. This is how the builtin help() works.
5117
5127
5118 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5128 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5119 macro scoping: macros need to be executed in the user's namespace
5129 macro scoping: macros need to be executed in the user's namespace
5120 to work as if they had been typed by the user.
5130 to work as if they had been typed by the user.
5121
5131
5122 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5132 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5123 execute automatically (no need to type 'exec...'). They then
5133 execute automatically (no need to type 'exec...'). They then
5124 behave like 'true macros'. The printing system was also modified
5134 behave like 'true macros'. The printing system was also modified
5125 for this to work.
5135 for this to work.
5126
5136
5127 2002-02-19 Fernando Perez <fperez@colorado.edu>
5137 2002-02-19 Fernando Perez <fperez@colorado.edu>
5128
5138
5129 * IPython/genutils.py (page_file): new function for paging files
5139 * IPython/genutils.py (page_file): new function for paging files
5130 in an OS-independent way. Also necessary for file viewing to work
5140 in an OS-independent way. Also necessary for file viewing to work
5131 well inside Emacs buffers.
5141 well inside Emacs buffers.
5132 (page): Added checks for being in an emacs buffer.
5142 (page): Added checks for being in an emacs buffer.
5133 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5143 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5134 same bug in iplib.
5144 same bug in iplib.
5135
5145
5136 2002-02-18 Fernando Perez <fperez@colorado.edu>
5146 2002-02-18 Fernando Perez <fperez@colorado.edu>
5137
5147
5138 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5148 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5139 of readline so that IPython can work inside an Emacs buffer.
5149 of readline so that IPython can work inside an Emacs buffer.
5140
5150
5141 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5151 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5142 method signatures (they weren't really bugs, but it looks cleaner
5152 method signatures (they weren't really bugs, but it looks cleaner
5143 and keeps PyChecker happy).
5153 and keeps PyChecker happy).
5144
5154
5145 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5155 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5146 for implementing various user-defined hooks. Currently only
5156 for implementing various user-defined hooks. Currently only
5147 display is done.
5157 display is done.
5148
5158
5149 * IPython/Prompts.py (CachedOutput._display): changed display
5159 * IPython/Prompts.py (CachedOutput._display): changed display
5150 functions so that they can be dynamically changed by users easily.
5160 functions so that they can be dynamically changed by users easily.
5151
5161
5152 * IPython/Extensions/numeric_formats.py (num_display): added an
5162 * IPython/Extensions/numeric_formats.py (num_display): added an
5153 extension for printing NumPy arrays in flexible manners. It
5163 extension for printing NumPy arrays in flexible manners. It
5154 doesn't do anything yet, but all the structure is in
5164 doesn't do anything yet, but all the structure is in
5155 place. Ultimately the plan is to implement output format control
5165 place. Ultimately the plan is to implement output format control
5156 like in Octave.
5166 like in Octave.
5157
5167
5158 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5168 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5159 methods are found at run-time by all the automatic machinery.
5169 methods are found at run-time by all the automatic machinery.
5160
5170
5161 2002-02-17 Fernando Perez <fperez@colorado.edu>
5171 2002-02-17 Fernando Perez <fperez@colorado.edu>
5162
5172
5163 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5173 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5164 whole file a little.
5174 whole file a little.
5165
5175
5166 * ToDo: closed this document. Now there's a new_design.lyx
5176 * ToDo: closed this document. Now there's a new_design.lyx
5167 document for all new ideas. Added making a pdf of it for the
5177 document for all new ideas. Added making a pdf of it for the
5168 end-user distro.
5178 end-user distro.
5169
5179
5170 * IPython/Logger.py (Logger.switch_log): Created this to replace
5180 * IPython/Logger.py (Logger.switch_log): Created this to replace
5171 logon() and logoff(). It also fixes a nasty crash reported by
5181 logon() and logoff(). It also fixes a nasty crash reported by
5172 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5182 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5173
5183
5174 * IPython/iplib.py (complete): got auto-completion to work with
5184 * IPython/iplib.py (complete): got auto-completion to work with
5175 automagic (I had wanted this for a long time).
5185 automagic (I had wanted this for a long time).
5176
5186
5177 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5187 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5178 to @file, since file() is now a builtin and clashes with automagic
5188 to @file, since file() is now a builtin and clashes with automagic
5179 for @file.
5189 for @file.
5180
5190
5181 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5191 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5182 of this was previously in iplib, which had grown to more than 2000
5192 of this was previously in iplib, which had grown to more than 2000
5183 lines, way too long. No new functionality, but it makes managing
5193 lines, way too long. No new functionality, but it makes managing
5184 the code a bit easier.
5194 the code a bit easier.
5185
5195
5186 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5196 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5187 information to crash reports.
5197 information to crash reports.
5188
5198
5189 2002-02-12 Fernando Perez <fperez@colorado.edu>
5199 2002-02-12 Fernando Perez <fperez@colorado.edu>
5190
5200
5191 * Released 0.2.5.
5201 * Released 0.2.5.
5192
5202
5193 2002-02-11 Fernando Perez <fperez@colorado.edu>
5203 2002-02-11 Fernando Perez <fperez@colorado.edu>
5194
5204
5195 * Wrote a relatively complete Windows installer. It puts
5205 * Wrote a relatively complete Windows installer. It puts
5196 everything in place, creates Start Menu entries and fixes the
5206 everything in place, creates Start Menu entries and fixes the
5197 color issues. Nothing fancy, but it works.
5207 color issues. Nothing fancy, but it works.
5198
5208
5199 2002-02-10 Fernando Perez <fperez@colorado.edu>
5209 2002-02-10 Fernando Perez <fperez@colorado.edu>
5200
5210
5201 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5211 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5202 os.path.expanduser() call so that we can type @run ~/myfile.py and
5212 os.path.expanduser() call so that we can type @run ~/myfile.py and
5203 have thigs work as expected.
5213 have thigs work as expected.
5204
5214
5205 * IPython/genutils.py (page): fixed exception handling so things
5215 * IPython/genutils.py (page): fixed exception handling so things
5206 work both in Unix and Windows correctly. Quitting a pager triggers
5216 work both in Unix and Windows correctly. Quitting a pager triggers
5207 an IOError/broken pipe in Unix, and in windows not finding a pager
5217 an IOError/broken pipe in Unix, and in windows not finding a pager
5208 is also an IOError, so I had to actually look at the return value
5218 is also an IOError, so I had to actually look at the return value
5209 of the exception, not just the exception itself. Should be ok now.
5219 of the exception, not just the exception itself. Should be ok now.
5210
5220
5211 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5221 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5212 modified to allow case-insensitive color scheme changes.
5222 modified to allow case-insensitive color scheme changes.
5213
5223
5214 2002-02-09 Fernando Perez <fperez@colorado.edu>
5224 2002-02-09 Fernando Perez <fperez@colorado.edu>
5215
5225
5216 * IPython/genutils.py (native_line_ends): new function to leave
5226 * IPython/genutils.py (native_line_ends): new function to leave
5217 user config files with os-native line-endings.
5227 user config files with os-native line-endings.
5218
5228
5219 * README and manual updates.
5229 * README and manual updates.
5220
5230
5221 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5231 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5222 instead of StringType to catch Unicode strings.
5232 instead of StringType to catch Unicode strings.
5223
5233
5224 * IPython/genutils.py (filefind): fixed bug for paths with
5234 * IPython/genutils.py (filefind): fixed bug for paths with
5225 embedded spaces (very common in Windows).
5235 embedded spaces (very common in Windows).
5226
5236
5227 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5237 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5228 files under Windows, so that they get automatically associated
5238 files under Windows, so that they get automatically associated
5229 with a text editor. Windows makes it a pain to handle
5239 with a text editor. Windows makes it a pain to handle
5230 extension-less files.
5240 extension-less files.
5231
5241
5232 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5242 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5233 warning about readline only occur for Posix. In Windows there's no
5243 warning about readline only occur for Posix. In Windows there's no
5234 way to get readline, so why bother with the warning.
5244 way to get readline, so why bother with the warning.
5235
5245
5236 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5246 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5237 for __str__ instead of dir(self), since dir() changed in 2.2.
5247 for __str__ instead of dir(self), since dir() changed in 2.2.
5238
5248
5239 * Ported to Windows! Tested on XP, I suspect it should work fine
5249 * Ported to Windows! Tested on XP, I suspect it should work fine
5240 on NT/2000, but I don't think it will work on 98 et al. That
5250 on NT/2000, but I don't think it will work on 98 et al. That
5241 series of Windows is such a piece of junk anyway that I won't try
5251 series of Windows is such a piece of junk anyway that I won't try
5242 porting it there. The XP port was straightforward, showed a few
5252 porting it there. The XP port was straightforward, showed a few
5243 bugs here and there (fixed all), in particular some string
5253 bugs here and there (fixed all), in particular some string
5244 handling stuff which required considering Unicode strings (which
5254 handling stuff which required considering Unicode strings (which
5245 Windows uses). This is good, but hasn't been too tested :) No
5255 Windows uses). This is good, but hasn't been too tested :) No
5246 fancy installer yet, I'll put a note in the manual so people at
5256 fancy installer yet, I'll put a note in the manual so people at
5247 least make manually a shortcut.
5257 least make manually a shortcut.
5248
5258
5249 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5259 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5250 into a single one, "colors". This now controls both prompt and
5260 into a single one, "colors". This now controls both prompt and
5251 exception color schemes, and can be changed both at startup
5261 exception color schemes, and can be changed both at startup
5252 (either via command-line switches or via ipythonrc files) and at
5262 (either via command-line switches or via ipythonrc files) and at
5253 runtime, with @colors.
5263 runtime, with @colors.
5254 (Magic.magic_run): renamed @prun to @run and removed the old
5264 (Magic.magic_run): renamed @prun to @run and removed the old
5255 @run. The two were too similar to warrant keeping both.
5265 @run. The two were too similar to warrant keeping both.
5256
5266
5257 2002-02-03 Fernando Perez <fperez@colorado.edu>
5267 2002-02-03 Fernando Perez <fperez@colorado.edu>
5258
5268
5259 * IPython/iplib.py (install_first_time): Added comment on how to
5269 * IPython/iplib.py (install_first_time): Added comment on how to
5260 configure the color options for first-time users. Put a <return>
5270 configure the color options for first-time users. Put a <return>
5261 request at the end so that small-terminal users get a chance to
5271 request at the end so that small-terminal users get a chance to
5262 read the startup info.
5272 read the startup info.
5263
5273
5264 2002-01-23 Fernando Perez <fperez@colorado.edu>
5274 2002-01-23 Fernando Perez <fperez@colorado.edu>
5265
5275
5266 * IPython/iplib.py (CachedOutput.update): Changed output memory
5276 * IPython/iplib.py (CachedOutput.update): Changed output memory
5267 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5277 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5268 input history we still use _i. Did this b/c these variable are
5278 input history we still use _i. Did this b/c these variable are
5269 very commonly used in interactive work, so the less we need to
5279 very commonly used in interactive work, so the less we need to
5270 type the better off we are.
5280 type the better off we are.
5271 (Magic.magic_prun): updated @prun to better handle the namespaces
5281 (Magic.magic_prun): updated @prun to better handle the namespaces
5272 the file will run in, including a fix for __name__ not being set
5282 the file will run in, including a fix for __name__ not being set
5273 before.
5283 before.
5274
5284
5275 2002-01-20 Fernando Perez <fperez@colorado.edu>
5285 2002-01-20 Fernando Perez <fperez@colorado.edu>
5276
5286
5277 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5287 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5278 extra garbage for Python 2.2. Need to look more carefully into
5288 extra garbage for Python 2.2. Need to look more carefully into
5279 this later.
5289 this later.
5280
5290
5281 2002-01-19 Fernando Perez <fperez@colorado.edu>
5291 2002-01-19 Fernando Perez <fperez@colorado.edu>
5282
5292
5283 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5293 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5284 display SyntaxError exceptions properly formatted when they occur
5294 display SyntaxError exceptions properly formatted when they occur
5285 (they can be triggered by imported code).
5295 (they can be triggered by imported code).
5286
5296
5287 2002-01-18 Fernando Perez <fperez@colorado.edu>
5297 2002-01-18 Fernando Perez <fperez@colorado.edu>
5288
5298
5289 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5299 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5290 SyntaxError exceptions are reported nicely formatted, instead of
5300 SyntaxError exceptions are reported nicely formatted, instead of
5291 spitting out only offset information as before.
5301 spitting out only offset information as before.
5292 (Magic.magic_prun): Added the @prun function for executing
5302 (Magic.magic_prun): Added the @prun function for executing
5293 programs with command line args inside IPython.
5303 programs with command line args inside IPython.
5294
5304
5295 2002-01-16 Fernando Perez <fperez@colorado.edu>
5305 2002-01-16 Fernando Perez <fperez@colorado.edu>
5296
5306
5297 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5307 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5298 to *not* include the last item given in a range. This brings their
5308 to *not* include the last item given in a range. This brings their
5299 behavior in line with Python's slicing:
5309 behavior in line with Python's slicing:
5300 a[n1:n2] -> a[n1]...a[n2-1]
5310 a[n1:n2] -> a[n1]...a[n2-1]
5301 It may be a bit less convenient, but I prefer to stick to Python's
5311 It may be a bit less convenient, but I prefer to stick to Python's
5302 conventions *everywhere*, so users never have to wonder.
5312 conventions *everywhere*, so users never have to wonder.
5303 (Magic.magic_macro): Added @macro function to ease the creation of
5313 (Magic.magic_macro): Added @macro function to ease the creation of
5304 macros.
5314 macros.
5305
5315
5306 2002-01-05 Fernando Perez <fperez@colorado.edu>
5316 2002-01-05 Fernando Perez <fperez@colorado.edu>
5307
5317
5308 * Released 0.2.4.
5318 * Released 0.2.4.
5309
5319
5310 * IPython/iplib.py (Magic.magic_pdef):
5320 * IPython/iplib.py (Magic.magic_pdef):
5311 (InteractiveShell.safe_execfile): report magic lines and error
5321 (InteractiveShell.safe_execfile): report magic lines and error
5312 lines without line numbers so one can easily copy/paste them for
5322 lines without line numbers so one can easily copy/paste them for
5313 re-execution.
5323 re-execution.
5314
5324
5315 * Updated manual with recent changes.
5325 * Updated manual with recent changes.
5316
5326
5317 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5327 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5318 docstring printing when class? is called. Very handy for knowing
5328 docstring printing when class? is called. Very handy for knowing
5319 how to create class instances (as long as __init__ is well
5329 how to create class instances (as long as __init__ is well
5320 documented, of course :)
5330 documented, of course :)
5321 (Magic.magic_doc): print both class and constructor docstrings.
5331 (Magic.magic_doc): print both class and constructor docstrings.
5322 (Magic.magic_pdef): give constructor info if passed a class and
5332 (Magic.magic_pdef): give constructor info if passed a class and
5323 __call__ info for callable object instances.
5333 __call__ info for callable object instances.
5324
5334
5325 2002-01-04 Fernando Perez <fperez@colorado.edu>
5335 2002-01-04 Fernando Perez <fperez@colorado.edu>
5326
5336
5327 * Made deep_reload() off by default. It doesn't always work
5337 * Made deep_reload() off by default. It doesn't always work
5328 exactly as intended, so it's probably safer to have it off. It's
5338 exactly as intended, so it's probably safer to have it off. It's
5329 still available as dreload() anyway, so nothing is lost.
5339 still available as dreload() anyway, so nothing is lost.
5330
5340
5331 2002-01-02 Fernando Perez <fperez@colorado.edu>
5341 2002-01-02 Fernando Perez <fperez@colorado.edu>
5332
5342
5333 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5343 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5334 so I wanted an updated release).
5344 so I wanted an updated release).
5335
5345
5336 2001-12-27 Fernando Perez <fperez@colorado.edu>
5346 2001-12-27 Fernando Perez <fperez@colorado.edu>
5337
5347
5338 * IPython/iplib.py (InteractiveShell.interact): Added the original
5348 * IPython/iplib.py (InteractiveShell.interact): Added the original
5339 code from 'code.py' for this module in order to change the
5349 code from 'code.py' for this module in order to change the
5340 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5350 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5341 the history cache would break when the user hit Ctrl-C, and
5351 the history cache would break when the user hit Ctrl-C, and
5342 interact() offers no way to add any hooks to it.
5352 interact() offers no way to add any hooks to it.
5343
5353
5344 2001-12-23 Fernando Perez <fperez@colorado.edu>
5354 2001-12-23 Fernando Perez <fperez@colorado.edu>
5345
5355
5346 * setup.py: added check for 'MANIFEST' before trying to remove
5356 * setup.py: added check for 'MANIFEST' before trying to remove
5347 it. Thanks to Sean Reifschneider.
5357 it. Thanks to Sean Reifschneider.
5348
5358
5349 2001-12-22 Fernando Perez <fperez@colorado.edu>
5359 2001-12-22 Fernando Perez <fperez@colorado.edu>
5350
5360
5351 * Released 0.2.2.
5361 * Released 0.2.2.
5352
5362
5353 * Finished (reasonably) writing the manual. Later will add the
5363 * Finished (reasonably) writing the manual. Later will add the
5354 python-standard navigation stylesheets, but for the time being
5364 python-standard navigation stylesheets, but for the time being
5355 it's fairly complete. Distribution will include html and pdf
5365 it's fairly complete. Distribution will include html and pdf
5356 versions.
5366 versions.
5357
5367
5358 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5368 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5359 (MayaVi author).
5369 (MayaVi author).
5360
5370
5361 2001-12-21 Fernando Perez <fperez@colorado.edu>
5371 2001-12-21 Fernando Perez <fperez@colorado.edu>
5362
5372
5363 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5373 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5364 good public release, I think (with the manual and the distutils
5374 good public release, I think (with the manual and the distutils
5365 installer). The manual can use some work, but that can go
5375 installer). The manual can use some work, but that can go
5366 slowly. Otherwise I think it's quite nice for end users. Next
5376 slowly. Otherwise I think it's quite nice for end users. Next
5367 summer, rewrite the guts of it...
5377 summer, rewrite the guts of it...
5368
5378
5369 * Changed format of ipythonrc files to use whitespace as the
5379 * Changed format of ipythonrc files to use whitespace as the
5370 separator instead of an explicit '='. Cleaner.
5380 separator instead of an explicit '='. Cleaner.
5371
5381
5372 2001-12-20 Fernando Perez <fperez@colorado.edu>
5382 2001-12-20 Fernando Perez <fperez@colorado.edu>
5373
5383
5374 * Started a manual in LyX. For now it's just a quick merge of the
5384 * Started a manual in LyX. For now it's just a quick merge of the
5375 various internal docstrings and READMEs. Later it may grow into a
5385 various internal docstrings and READMEs. Later it may grow into a
5376 nice, full-blown manual.
5386 nice, full-blown manual.
5377
5387
5378 * Set up a distutils based installer. Installation should now be
5388 * Set up a distutils based installer. Installation should now be
5379 trivially simple for end-users.
5389 trivially simple for end-users.
5380
5390
5381 2001-12-11 Fernando Perez <fperez@colorado.edu>
5391 2001-12-11 Fernando Perez <fperez@colorado.edu>
5382
5392
5383 * Released 0.2.0. First public release, announced it at
5393 * Released 0.2.0. First public release, announced it at
5384 comp.lang.python. From now on, just bugfixes...
5394 comp.lang.python. From now on, just bugfixes...
5385
5395
5386 * Went through all the files, set copyright/license notices and
5396 * Went through all the files, set copyright/license notices and
5387 cleaned up things. Ready for release.
5397 cleaned up things. Ready for release.
5388
5398
5389 2001-12-10 Fernando Perez <fperez@colorado.edu>
5399 2001-12-10 Fernando Perez <fperez@colorado.edu>
5390
5400
5391 * Changed the first-time installer not to use tarfiles. It's more
5401 * Changed the first-time installer not to use tarfiles. It's more
5392 robust now and less unix-dependent. Also makes it easier for
5402 robust now and less unix-dependent. Also makes it easier for
5393 people to later upgrade versions.
5403 people to later upgrade versions.
5394
5404
5395 * Changed @exit to @abort to reflect the fact that it's pretty
5405 * Changed @exit to @abort to reflect the fact that it's pretty
5396 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5406 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5397 becomes significant only when IPyhton is embedded: in that case,
5407 becomes significant only when IPyhton is embedded: in that case,
5398 C-D closes IPython only, but @abort kills the enclosing program
5408 C-D closes IPython only, but @abort kills the enclosing program
5399 too (unless it had called IPython inside a try catching
5409 too (unless it had called IPython inside a try catching
5400 SystemExit).
5410 SystemExit).
5401
5411
5402 * Created Shell module which exposes the actuall IPython Shell
5412 * Created Shell module which exposes the actuall IPython Shell
5403 classes, currently the normal and the embeddable one. This at
5413 classes, currently the normal and the embeddable one. This at
5404 least offers a stable interface we won't need to change when
5414 least offers a stable interface we won't need to change when
5405 (later) the internals are rewritten. That rewrite will be confined
5415 (later) the internals are rewritten. That rewrite will be confined
5406 to iplib and ipmaker, but the Shell interface should remain as is.
5416 to iplib and ipmaker, but the Shell interface should remain as is.
5407
5417
5408 * Added embed module which offers an embeddable IPShell object,
5418 * Added embed module which offers an embeddable IPShell object,
5409 useful to fire up IPython *inside* a running program. Great for
5419 useful to fire up IPython *inside* a running program. Great for
5410 debugging or dynamical data analysis.
5420 debugging or dynamical data analysis.
5411
5421
5412 2001-12-08 Fernando Perez <fperez@colorado.edu>
5422 2001-12-08 Fernando Perez <fperez@colorado.edu>
5413
5423
5414 * Fixed small bug preventing seeing info from methods of defined
5424 * Fixed small bug preventing seeing info from methods of defined
5415 objects (incorrect namespace in _ofind()).
5425 objects (incorrect namespace in _ofind()).
5416
5426
5417 * Documentation cleanup. Moved the main usage docstrings to a
5427 * Documentation cleanup. Moved the main usage docstrings to a
5418 separate file, usage.py (cleaner to maintain, and hopefully in the
5428 separate file, usage.py (cleaner to maintain, and hopefully in the
5419 future some perlpod-like way of producing interactive, man and
5429 future some perlpod-like way of producing interactive, man and
5420 html docs out of it will be found).
5430 html docs out of it will be found).
5421
5431
5422 * Added @profile to see your profile at any time.
5432 * Added @profile to see your profile at any time.
5423
5433
5424 * Added @p as an alias for 'print'. It's especially convenient if
5434 * Added @p as an alias for 'print'. It's especially convenient if
5425 using automagic ('p x' prints x).
5435 using automagic ('p x' prints x).
5426
5436
5427 * Small cleanups and fixes after a pychecker run.
5437 * Small cleanups and fixes after a pychecker run.
5428
5438
5429 * Changed the @cd command to handle @cd - and @cd -<n> for
5439 * Changed the @cd command to handle @cd - and @cd -<n> for
5430 visiting any directory in _dh.
5440 visiting any directory in _dh.
5431
5441
5432 * Introduced _dh, a history of visited directories. @dhist prints
5442 * Introduced _dh, a history of visited directories. @dhist prints
5433 it out with numbers.
5443 it out with numbers.
5434
5444
5435 2001-12-07 Fernando Perez <fperez@colorado.edu>
5445 2001-12-07 Fernando Perez <fperez@colorado.edu>
5436
5446
5437 * Released 0.1.22
5447 * Released 0.1.22
5438
5448
5439 * Made initialization a bit more robust against invalid color
5449 * Made initialization a bit more robust against invalid color
5440 options in user input (exit, not traceback-crash).
5450 options in user input (exit, not traceback-crash).
5441
5451
5442 * Changed the bug crash reporter to write the report only in the
5452 * Changed the bug crash reporter to write the report only in the
5443 user's .ipython directory. That way IPython won't litter people's
5453 user's .ipython directory. That way IPython won't litter people's
5444 hard disks with crash files all over the place. Also print on
5454 hard disks with crash files all over the place. Also print on
5445 screen the necessary mail command.
5455 screen the necessary mail command.
5446
5456
5447 * With the new ultraTB, implemented LightBG color scheme for light
5457 * With the new ultraTB, implemented LightBG color scheme for light
5448 background terminals. A lot of people like white backgrounds, so I
5458 background terminals. A lot of people like white backgrounds, so I
5449 guess we should at least give them something readable.
5459 guess we should at least give them something readable.
5450
5460
5451 2001-12-06 Fernando Perez <fperez@colorado.edu>
5461 2001-12-06 Fernando Perez <fperez@colorado.edu>
5452
5462
5453 * Modified the structure of ultraTB. Now there's a proper class
5463 * Modified the structure of ultraTB. Now there's a proper class
5454 for tables of color schemes which allow adding schemes easily and
5464 for tables of color schemes which allow adding schemes easily and
5455 switching the active scheme without creating a new instance every
5465 switching the active scheme without creating a new instance every
5456 time (which was ridiculous). The syntax for creating new schemes
5466 time (which was ridiculous). The syntax for creating new schemes
5457 is also cleaner. I think ultraTB is finally done, with a clean
5467 is also cleaner. I think ultraTB is finally done, with a clean
5458 class structure. Names are also much cleaner (now there's proper
5468 class structure. Names are also much cleaner (now there's proper
5459 color tables, no need for every variable to also have 'color' in
5469 color tables, no need for every variable to also have 'color' in
5460 its name).
5470 its name).
5461
5471
5462 * Broke down genutils into separate files. Now genutils only
5472 * Broke down genutils into separate files. Now genutils only
5463 contains utility functions, and classes have been moved to their
5473 contains utility functions, and classes have been moved to their
5464 own files (they had enough independent functionality to warrant
5474 own files (they had enough independent functionality to warrant
5465 it): ConfigLoader, OutputTrap, Struct.
5475 it): ConfigLoader, OutputTrap, Struct.
5466
5476
5467 2001-12-05 Fernando Perez <fperez@colorado.edu>
5477 2001-12-05 Fernando Perez <fperez@colorado.edu>
5468
5478
5469 * IPython turns 21! Released version 0.1.21, as a candidate for
5479 * IPython turns 21! Released version 0.1.21, as a candidate for
5470 public consumption. If all goes well, release in a few days.
5480 public consumption. If all goes well, release in a few days.
5471
5481
5472 * Fixed path bug (files in Extensions/ directory wouldn't be found
5482 * Fixed path bug (files in Extensions/ directory wouldn't be found
5473 unless IPython/ was explicitly in sys.path).
5483 unless IPython/ was explicitly in sys.path).
5474
5484
5475 * Extended the FlexCompleter class as MagicCompleter to allow
5485 * Extended the FlexCompleter class as MagicCompleter to allow
5476 completion of @-starting lines.
5486 completion of @-starting lines.
5477
5487
5478 * Created __release__.py file as a central repository for release
5488 * Created __release__.py file as a central repository for release
5479 info that other files can read from.
5489 info that other files can read from.
5480
5490
5481 * Fixed small bug in logging: when logging was turned on in
5491 * Fixed small bug in logging: when logging was turned on in
5482 mid-session, old lines with special meanings (!@?) were being
5492 mid-session, old lines with special meanings (!@?) were being
5483 logged without the prepended comment, which is necessary since
5493 logged without the prepended comment, which is necessary since
5484 they are not truly valid python syntax. This should make session
5494 they are not truly valid python syntax. This should make session
5485 restores produce less errors.
5495 restores produce less errors.
5486
5496
5487 * The namespace cleanup forced me to make a FlexCompleter class
5497 * The namespace cleanup forced me to make a FlexCompleter class
5488 which is nothing but a ripoff of rlcompleter, but with selectable
5498 which is nothing but a ripoff of rlcompleter, but with selectable
5489 namespace (rlcompleter only works in __main__.__dict__). I'll try
5499 namespace (rlcompleter only works in __main__.__dict__). I'll try
5490 to submit a note to the authors to see if this change can be
5500 to submit a note to the authors to see if this change can be
5491 incorporated in future rlcompleter releases (Dec.6: done)
5501 incorporated in future rlcompleter releases (Dec.6: done)
5492
5502
5493 * More fixes to namespace handling. It was a mess! Now all
5503 * More fixes to namespace handling. It was a mess! Now all
5494 explicit references to __main__.__dict__ are gone (except when
5504 explicit references to __main__.__dict__ are gone (except when
5495 really needed) and everything is handled through the namespace
5505 really needed) and everything is handled through the namespace
5496 dicts in the IPython instance. We seem to be getting somewhere
5506 dicts in the IPython instance. We seem to be getting somewhere
5497 with this, finally...
5507 with this, finally...
5498
5508
5499 * Small documentation updates.
5509 * Small documentation updates.
5500
5510
5501 * Created the Extensions directory under IPython (with an
5511 * Created the Extensions directory under IPython (with an
5502 __init__.py). Put the PhysicalQ stuff there. This directory should
5512 __init__.py). Put the PhysicalQ stuff there. This directory should
5503 be used for all special-purpose extensions.
5513 be used for all special-purpose extensions.
5504
5514
5505 * File renaming:
5515 * File renaming:
5506 ipythonlib --> ipmaker
5516 ipythonlib --> ipmaker
5507 ipplib --> iplib
5517 ipplib --> iplib
5508 This makes a bit more sense in terms of what these files actually do.
5518 This makes a bit more sense in terms of what these files actually do.
5509
5519
5510 * Moved all the classes and functions in ipythonlib to ipplib, so
5520 * Moved all the classes and functions in ipythonlib to ipplib, so
5511 now ipythonlib only has make_IPython(). This will ease up its
5521 now ipythonlib only has make_IPython(). This will ease up its
5512 splitting in smaller functional chunks later.
5522 splitting in smaller functional chunks later.
5513
5523
5514 * Cleaned up (done, I think) output of @whos. Better column
5524 * Cleaned up (done, I think) output of @whos. Better column
5515 formatting, and now shows str(var) for as much as it can, which is
5525 formatting, and now shows str(var) for as much as it can, which is
5516 typically what one gets with a 'print var'.
5526 typically what one gets with a 'print var'.
5517
5527
5518 2001-12-04 Fernando Perez <fperez@colorado.edu>
5528 2001-12-04 Fernando Perez <fperez@colorado.edu>
5519
5529
5520 * Fixed namespace problems. Now builtin/IPyhton/user names get
5530 * Fixed namespace problems. Now builtin/IPyhton/user names get
5521 properly reported in their namespace. Internal namespace handling
5531 properly reported in their namespace. Internal namespace handling
5522 is finally getting decent (not perfect yet, but much better than
5532 is finally getting decent (not perfect yet, but much better than
5523 the ad-hoc mess we had).
5533 the ad-hoc mess we had).
5524
5534
5525 * Removed -exit option. If people just want to run a python
5535 * Removed -exit option. If people just want to run a python
5526 script, that's what the normal interpreter is for. Less
5536 script, that's what the normal interpreter is for. Less
5527 unnecessary options, less chances for bugs.
5537 unnecessary options, less chances for bugs.
5528
5538
5529 * Added a crash handler which generates a complete post-mortem if
5539 * Added a crash handler which generates a complete post-mortem if
5530 IPython crashes. This will help a lot in tracking bugs down the
5540 IPython crashes. This will help a lot in tracking bugs down the
5531 road.
5541 road.
5532
5542
5533 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5543 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5534 which were boud to functions being reassigned would bypass the
5544 which were boud to functions being reassigned would bypass the
5535 logger, breaking the sync of _il with the prompt counter. This
5545 logger, breaking the sync of _il with the prompt counter. This
5536 would then crash IPython later when a new line was logged.
5546 would then crash IPython later when a new line was logged.
5537
5547
5538 2001-12-02 Fernando Perez <fperez@colorado.edu>
5548 2001-12-02 Fernando Perez <fperez@colorado.edu>
5539
5549
5540 * Made IPython a package. This means people don't have to clutter
5550 * Made IPython a package. This means people don't have to clutter
5541 their sys.path with yet another directory. Changed the INSTALL
5551 their sys.path with yet another directory. Changed the INSTALL
5542 file accordingly.
5552 file accordingly.
5543
5553
5544 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5554 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5545 sorts its output (so @who shows it sorted) and @whos formats the
5555 sorts its output (so @who shows it sorted) and @whos formats the
5546 table according to the width of the first column. Nicer, easier to
5556 table according to the width of the first column. Nicer, easier to
5547 read. Todo: write a generic table_format() which takes a list of
5557 read. Todo: write a generic table_format() which takes a list of
5548 lists and prints it nicely formatted, with optional row/column
5558 lists and prints it nicely formatted, with optional row/column
5549 separators and proper padding and justification.
5559 separators and proper padding and justification.
5550
5560
5551 * Released 0.1.20
5561 * Released 0.1.20
5552
5562
5553 * Fixed bug in @log which would reverse the inputcache list (a
5563 * Fixed bug in @log which would reverse the inputcache list (a
5554 copy operation was missing).
5564 copy operation was missing).
5555
5565
5556 * Code cleanup. @config was changed to use page(). Better, since
5566 * Code cleanup. @config was changed to use page(). Better, since
5557 its output is always quite long.
5567 its output is always quite long.
5558
5568
5559 * Itpl is back as a dependency. I was having too many problems
5569 * Itpl is back as a dependency. I was having too many problems
5560 getting the parametric aliases to work reliably, and it's just
5570 getting the parametric aliases to work reliably, and it's just
5561 easier to code weird string operations with it than playing %()s
5571 easier to code weird string operations with it than playing %()s
5562 games. It's only ~6k, so I don't think it's too big a deal.
5572 games. It's only ~6k, so I don't think it's too big a deal.
5563
5573
5564 * Found (and fixed) a very nasty bug with history. !lines weren't
5574 * Found (and fixed) a very nasty bug with history. !lines weren't
5565 getting cached, and the out of sync caches would crash
5575 getting cached, and the out of sync caches would crash
5566 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5576 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5567 division of labor a bit better. Bug fixed, cleaner structure.
5577 division of labor a bit better. Bug fixed, cleaner structure.
5568
5578
5569 2001-12-01 Fernando Perez <fperez@colorado.edu>
5579 2001-12-01 Fernando Perez <fperez@colorado.edu>
5570
5580
5571 * Released 0.1.19
5581 * Released 0.1.19
5572
5582
5573 * Added option -n to @hist to prevent line number printing. Much
5583 * Added option -n to @hist to prevent line number printing. Much
5574 easier to copy/paste code this way.
5584 easier to copy/paste code this way.
5575
5585
5576 * Created global _il to hold the input list. Allows easy
5586 * Created global _il to hold the input list. Allows easy
5577 re-execution of blocks of code by slicing it (inspired by Janko's
5587 re-execution of blocks of code by slicing it (inspired by Janko's
5578 comment on 'macros').
5588 comment on 'macros').
5579
5589
5580 * Small fixes and doc updates.
5590 * Small fixes and doc updates.
5581
5591
5582 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5592 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5583 much too fragile with automagic. Handles properly multi-line
5593 much too fragile with automagic. Handles properly multi-line
5584 statements and takes parameters.
5594 statements and takes parameters.
5585
5595
5586 2001-11-30 Fernando Perez <fperez@colorado.edu>
5596 2001-11-30 Fernando Perez <fperez@colorado.edu>
5587
5597
5588 * Version 0.1.18 released.
5598 * Version 0.1.18 released.
5589
5599
5590 * Fixed nasty namespace bug in initial module imports.
5600 * Fixed nasty namespace bug in initial module imports.
5591
5601
5592 * Added copyright/license notes to all code files (except
5602 * Added copyright/license notes to all code files (except
5593 DPyGetOpt). For the time being, LGPL. That could change.
5603 DPyGetOpt). For the time being, LGPL. That could change.
5594
5604
5595 * Rewrote a much nicer README, updated INSTALL, cleaned up
5605 * Rewrote a much nicer README, updated INSTALL, cleaned up
5596 ipythonrc-* samples.
5606 ipythonrc-* samples.
5597
5607
5598 * Overall code/documentation cleanup. Basically ready for
5608 * Overall code/documentation cleanup. Basically ready for
5599 release. Only remaining thing: licence decision (LGPL?).
5609 release. Only remaining thing: licence decision (LGPL?).
5600
5610
5601 * Converted load_config to a class, ConfigLoader. Now recursion
5611 * Converted load_config to a class, ConfigLoader. Now recursion
5602 control is better organized. Doesn't include the same file twice.
5612 control is better organized. Doesn't include the same file twice.
5603
5613
5604 2001-11-29 Fernando Perez <fperez@colorado.edu>
5614 2001-11-29 Fernando Perez <fperez@colorado.edu>
5605
5615
5606 * Got input history working. Changed output history variables from
5616 * Got input history working. Changed output history variables from
5607 _p to _o so that _i is for input and _o for output. Just cleaner
5617 _p to _o so that _i is for input and _o for output. Just cleaner
5608 convention.
5618 convention.
5609
5619
5610 * Implemented parametric aliases. This pretty much allows the
5620 * Implemented parametric aliases. This pretty much allows the
5611 alias system to offer full-blown shell convenience, I think.
5621 alias system to offer full-blown shell convenience, I think.
5612
5622
5613 * Version 0.1.17 released, 0.1.18 opened.
5623 * Version 0.1.17 released, 0.1.18 opened.
5614
5624
5615 * dot_ipython/ipythonrc (alias): added documentation.
5625 * dot_ipython/ipythonrc (alias): added documentation.
5616 (xcolor): Fixed small bug (xcolors -> xcolor)
5626 (xcolor): Fixed small bug (xcolors -> xcolor)
5617
5627
5618 * Changed the alias system. Now alias is a magic command to define
5628 * Changed the alias system. Now alias is a magic command to define
5619 aliases just like the shell. Rationale: the builtin magics should
5629 aliases just like the shell. Rationale: the builtin magics should
5620 be there for things deeply connected to IPython's
5630 be there for things deeply connected to IPython's
5621 architecture. And this is a much lighter system for what I think
5631 architecture. And this is a much lighter system for what I think
5622 is the really important feature: allowing users to define quickly
5632 is the really important feature: allowing users to define quickly
5623 magics that will do shell things for them, so they can customize
5633 magics that will do shell things for them, so they can customize
5624 IPython easily to match their work habits. If someone is really
5634 IPython easily to match their work habits. If someone is really
5625 desperate to have another name for a builtin alias, they can
5635 desperate to have another name for a builtin alias, they can
5626 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5636 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5627 works.
5637 works.
5628
5638
5629 2001-11-28 Fernando Perez <fperez@colorado.edu>
5639 2001-11-28 Fernando Perez <fperez@colorado.edu>
5630
5640
5631 * Changed @file so that it opens the source file at the proper
5641 * Changed @file so that it opens the source file at the proper
5632 line. Since it uses less, if your EDITOR environment is
5642 line. Since it uses less, if your EDITOR environment is
5633 configured, typing v will immediately open your editor of choice
5643 configured, typing v will immediately open your editor of choice
5634 right at the line where the object is defined. Not as quick as
5644 right at the line where the object is defined. Not as quick as
5635 having a direct @edit command, but for all intents and purposes it
5645 having a direct @edit command, but for all intents and purposes it
5636 works. And I don't have to worry about writing @edit to deal with
5646 works. And I don't have to worry about writing @edit to deal with
5637 all the editors, less does that.
5647 all the editors, less does that.
5638
5648
5639 * Version 0.1.16 released, 0.1.17 opened.
5649 * Version 0.1.16 released, 0.1.17 opened.
5640
5650
5641 * Fixed some nasty bugs in the page/page_dumb combo that could
5651 * Fixed some nasty bugs in the page/page_dumb combo that could
5642 crash IPython.
5652 crash IPython.
5643
5653
5644 2001-11-27 Fernando Perez <fperez@colorado.edu>
5654 2001-11-27 Fernando Perez <fperez@colorado.edu>
5645
5655
5646 * Version 0.1.15 released, 0.1.16 opened.
5656 * Version 0.1.15 released, 0.1.16 opened.
5647
5657
5648 * Finally got ? and ?? to work for undefined things: now it's
5658 * Finally got ? and ?? to work for undefined things: now it's
5649 possible to type {}.get? and get information about the get method
5659 possible to type {}.get? and get information about the get method
5650 of dicts, or os.path? even if only os is defined (so technically
5660 of dicts, or os.path? even if only os is defined (so technically
5651 os.path isn't). Works at any level. For example, after import os,
5661 os.path isn't). Works at any level. For example, after import os,
5652 os?, os.path?, os.path.abspath? all work. This is great, took some
5662 os?, os.path?, os.path.abspath? all work. This is great, took some
5653 work in _ofind.
5663 work in _ofind.
5654
5664
5655 * Fixed more bugs with logging. The sanest way to do it was to add
5665 * Fixed more bugs with logging. The sanest way to do it was to add
5656 to @log a 'mode' parameter. Killed two in one shot (this mode
5666 to @log a 'mode' parameter. Killed two in one shot (this mode
5657 option was a request of Janko's). I think it's finally clean
5667 option was a request of Janko's). I think it's finally clean
5658 (famous last words).
5668 (famous last words).
5659
5669
5660 * Added a page_dumb() pager which does a decent job of paging on
5670 * Added a page_dumb() pager which does a decent job of paging on
5661 screen, if better things (like less) aren't available. One less
5671 screen, if better things (like less) aren't available. One less
5662 unix dependency (someday maybe somebody will port this to
5672 unix dependency (someday maybe somebody will port this to
5663 windows).
5673 windows).
5664
5674
5665 * Fixed problem in magic_log: would lock of logging out if log
5675 * Fixed problem in magic_log: would lock of logging out if log
5666 creation failed (because it would still think it had succeeded).
5676 creation failed (because it would still think it had succeeded).
5667
5677
5668 * Improved the page() function using curses to auto-detect screen
5678 * Improved the page() function using curses to auto-detect screen
5669 size. Now it can make a much better decision on whether to print
5679 size. Now it can make a much better decision on whether to print
5670 or page a string. Option screen_length was modified: a value 0
5680 or page a string. Option screen_length was modified: a value 0
5671 means auto-detect, and that's the default now.
5681 means auto-detect, and that's the default now.
5672
5682
5673 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5683 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5674 go out. I'll test it for a few days, then talk to Janko about
5684 go out. I'll test it for a few days, then talk to Janko about
5675 licences and announce it.
5685 licences and announce it.
5676
5686
5677 * Fixed the length of the auto-generated ---> prompt which appears
5687 * Fixed the length of the auto-generated ---> prompt which appears
5678 for auto-parens and auto-quotes. Getting this right isn't trivial,
5688 for auto-parens and auto-quotes. Getting this right isn't trivial,
5679 with all the color escapes, different prompt types and optional
5689 with all the color escapes, different prompt types and optional
5680 separators. But it seems to be working in all the combinations.
5690 separators. But it seems to be working in all the combinations.
5681
5691
5682 2001-11-26 Fernando Perez <fperez@colorado.edu>
5692 2001-11-26 Fernando Perez <fperez@colorado.edu>
5683
5693
5684 * Wrote a regexp filter to get option types from the option names
5694 * Wrote a regexp filter to get option types from the option names
5685 string. This eliminates the need to manually keep two duplicate
5695 string. This eliminates the need to manually keep two duplicate
5686 lists.
5696 lists.
5687
5697
5688 * Removed the unneeded check_option_names. Now options are handled
5698 * Removed the unneeded check_option_names. Now options are handled
5689 in a much saner manner and it's easy to visually check that things
5699 in a much saner manner and it's easy to visually check that things
5690 are ok.
5700 are ok.
5691
5701
5692 * Updated version numbers on all files I modified to carry a
5702 * Updated version numbers on all files I modified to carry a
5693 notice so Janko and Nathan have clear version markers.
5703 notice so Janko and Nathan have clear version markers.
5694
5704
5695 * Updated docstring for ultraTB with my changes. I should send
5705 * Updated docstring for ultraTB with my changes. I should send
5696 this to Nathan.
5706 this to Nathan.
5697
5707
5698 * Lots of small fixes. Ran everything through pychecker again.
5708 * Lots of small fixes. Ran everything through pychecker again.
5699
5709
5700 * Made loading of deep_reload an cmd line option. If it's not too
5710 * Made loading of deep_reload an cmd line option. If it's not too
5701 kosher, now people can just disable it. With -nodeep_reload it's
5711 kosher, now people can just disable it. With -nodeep_reload it's
5702 still available as dreload(), it just won't overwrite reload().
5712 still available as dreload(), it just won't overwrite reload().
5703
5713
5704 * Moved many options to the no| form (-opt and -noopt
5714 * Moved many options to the no| form (-opt and -noopt
5705 accepted). Cleaner.
5715 accepted). Cleaner.
5706
5716
5707 * Changed magic_log so that if called with no parameters, it uses
5717 * Changed magic_log so that if called with no parameters, it uses
5708 'rotate' mode. That way auto-generated logs aren't automatically
5718 'rotate' mode. That way auto-generated logs aren't automatically
5709 over-written. For normal logs, now a backup is made if it exists
5719 over-written. For normal logs, now a backup is made if it exists
5710 (only 1 level of backups). A new 'backup' mode was added to the
5720 (only 1 level of backups). A new 'backup' mode was added to the
5711 Logger class to support this. This was a request by Janko.
5721 Logger class to support this. This was a request by Janko.
5712
5722
5713 * Added @logoff/@logon to stop/restart an active log.
5723 * Added @logoff/@logon to stop/restart an active log.
5714
5724
5715 * Fixed a lot of bugs in log saving/replay. It was pretty
5725 * Fixed a lot of bugs in log saving/replay. It was pretty
5716 broken. Now special lines (!@,/) appear properly in the command
5726 broken. Now special lines (!@,/) appear properly in the command
5717 history after a log replay.
5727 history after a log replay.
5718
5728
5719 * Tried and failed to implement full session saving via pickle. My
5729 * Tried and failed to implement full session saving via pickle. My
5720 idea was to pickle __main__.__dict__, but modules can't be
5730 idea was to pickle __main__.__dict__, but modules can't be
5721 pickled. This would be a better alternative to replaying logs, but
5731 pickled. This would be a better alternative to replaying logs, but
5722 seems quite tricky to get to work. Changed -session to be called
5732 seems quite tricky to get to work. Changed -session to be called
5723 -logplay, which more accurately reflects what it does. And if we
5733 -logplay, which more accurately reflects what it does. And if we
5724 ever get real session saving working, -session is now available.
5734 ever get real session saving working, -session is now available.
5725
5735
5726 * Implemented color schemes for prompts also. As for tracebacks,
5736 * Implemented color schemes for prompts also. As for tracebacks,
5727 currently only NoColor and Linux are supported. But now the
5737 currently only NoColor and Linux are supported. But now the
5728 infrastructure is in place, based on a generic ColorScheme
5738 infrastructure is in place, based on a generic ColorScheme
5729 class. So writing and activating new schemes both for the prompts
5739 class. So writing and activating new schemes both for the prompts
5730 and the tracebacks should be straightforward.
5740 and the tracebacks should be straightforward.
5731
5741
5732 * Version 0.1.13 released, 0.1.14 opened.
5742 * Version 0.1.13 released, 0.1.14 opened.
5733
5743
5734 * Changed handling of options for output cache. Now counter is
5744 * Changed handling of options for output cache. Now counter is
5735 hardwired starting at 1 and one specifies the maximum number of
5745 hardwired starting at 1 and one specifies the maximum number of
5736 entries *in the outcache* (not the max prompt counter). This is
5746 entries *in the outcache* (not the max prompt counter). This is
5737 much better, since many statements won't increase the cache
5747 much better, since many statements won't increase the cache
5738 count. It also eliminated some confusing options, now there's only
5748 count. It also eliminated some confusing options, now there's only
5739 one: cache_size.
5749 one: cache_size.
5740
5750
5741 * Added 'alias' magic function and magic_alias option in the
5751 * Added 'alias' magic function and magic_alias option in the
5742 ipythonrc file. Now the user can easily define whatever names he
5752 ipythonrc file. Now the user can easily define whatever names he
5743 wants for the magic functions without having to play weird
5753 wants for the magic functions without having to play weird
5744 namespace games. This gives IPython a real shell-like feel.
5754 namespace games. This gives IPython a real shell-like feel.
5745
5755
5746 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5756 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5747 @ or not).
5757 @ or not).
5748
5758
5749 This was one of the last remaining 'visible' bugs (that I know
5759 This was one of the last remaining 'visible' bugs (that I know
5750 of). I think if I can clean up the session loading so it works
5760 of). I think if I can clean up the session loading so it works
5751 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5761 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5752 about licensing).
5762 about licensing).
5753
5763
5754 2001-11-25 Fernando Perez <fperez@colorado.edu>
5764 2001-11-25 Fernando Perez <fperez@colorado.edu>
5755
5765
5756 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5766 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5757 there's a cleaner distinction between what ? and ?? show.
5767 there's a cleaner distinction between what ? and ?? show.
5758
5768
5759 * Added screen_length option. Now the user can define his own
5769 * Added screen_length option. Now the user can define his own
5760 screen size for page() operations.
5770 screen size for page() operations.
5761
5771
5762 * Implemented magic shell-like functions with automatic code
5772 * Implemented magic shell-like functions with automatic code
5763 generation. Now adding another function is just a matter of adding
5773 generation. Now adding another function is just a matter of adding
5764 an entry to a dict, and the function is dynamically generated at
5774 an entry to a dict, and the function is dynamically generated at
5765 run-time. Python has some really cool features!
5775 run-time. Python has some really cool features!
5766
5776
5767 * Renamed many options to cleanup conventions a little. Now all
5777 * Renamed many options to cleanup conventions a little. Now all
5768 are lowercase, and only underscores where needed. Also in the code
5778 are lowercase, and only underscores where needed. Also in the code
5769 option name tables are clearer.
5779 option name tables are clearer.
5770
5780
5771 * Changed prompts a little. Now input is 'In [n]:' instead of
5781 * Changed prompts a little. Now input is 'In [n]:' instead of
5772 'In[n]:='. This allows it the numbers to be aligned with the
5782 'In[n]:='. This allows it the numbers to be aligned with the
5773 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5783 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5774 Python (it was a Mathematica thing). The '...' continuation prompt
5784 Python (it was a Mathematica thing). The '...' continuation prompt
5775 was also changed a little to align better.
5785 was also changed a little to align better.
5776
5786
5777 * Fixed bug when flushing output cache. Not all _p<n> variables
5787 * Fixed bug when flushing output cache. Not all _p<n> variables
5778 exist, so their deletion needs to be wrapped in a try:
5788 exist, so their deletion needs to be wrapped in a try:
5779
5789
5780 * Figured out how to properly use inspect.formatargspec() (it
5790 * Figured out how to properly use inspect.formatargspec() (it
5781 requires the args preceded by *). So I removed all the code from
5791 requires the args preceded by *). So I removed all the code from
5782 _get_pdef in Magic, which was just replicating that.
5792 _get_pdef in Magic, which was just replicating that.
5783
5793
5784 * Added test to prefilter to allow redefining magic function names
5794 * Added test to prefilter to allow redefining magic function names
5785 as variables. This is ok, since the @ form is always available,
5795 as variables. This is ok, since the @ form is always available,
5786 but whe should allow the user to define a variable called 'ls' if
5796 but whe should allow the user to define a variable called 'ls' if
5787 he needs it.
5797 he needs it.
5788
5798
5789 * Moved the ToDo information from README into a separate ToDo.
5799 * Moved the ToDo information from README into a separate ToDo.
5790
5800
5791 * General code cleanup and small bugfixes. I think it's close to a
5801 * General code cleanup and small bugfixes. I think it's close to a
5792 state where it can be released, obviously with a big 'beta'
5802 state where it can be released, obviously with a big 'beta'
5793 warning on it.
5803 warning on it.
5794
5804
5795 * Got the magic function split to work. Now all magics are defined
5805 * Got the magic function split to work. Now all magics are defined
5796 in a separate class. It just organizes things a bit, and now
5806 in a separate class. It just organizes things a bit, and now
5797 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5807 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5798 was too long).
5808 was too long).
5799
5809
5800 * Changed @clear to @reset to avoid potential confusions with
5810 * Changed @clear to @reset to avoid potential confusions with
5801 the shell command clear. Also renamed @cl to @clear, which does
5811 the shell command clear. Also renamed @cl to @clear, which does
5802 exactly what people expect it to from their shell experience.
5812 exactly what people expect it to from their shell experience.
5803
5813
5804 Added a check to the @reset command (since it's so
5814 Added a check to the @reset command (since it's so
5805 destructive, it's probably a good idea to ask for confirmation).
5815 destructive, it's probably a good idea to ask for confirmation).
5806 But now reset only works for full namespace resetting. Since the
5816 But now reset only works for full namespace resetting. Since the
5807 del keyword is already there for deleting a few specific
5817 del keyword is already there for deleting a few specific
5808 variables, I don't see the point of having a redundant magic
5818 variables, I don't see the point of having a redundant magic
5809 function for the same task.
5819 function for the same task.
5810
5820
5811 2001-11-24 Fernando Perez <fperez@colorado.edu>
5821 2001-11-24 Fernando Perez <fperez@colorado.edu>
5812
5822
5813 * Updated the builtin docs (esp. the ? ones).
5823 * Updated the builtin docs (esp. the ? ones).
5814
5824
5815 * Ran all the code through pychecker. Not terribly impressed with
5825 * Ran all the code through pychecker. Not terribly impressed with
5816 it: lots of spurious warnings and didn't really find anything of
5826 it: lots of spurious warnings and didn't really find anything of
5817 substance (just a few modules being imported and not used).
5827 substance (just a few modules being imported and not used).
5818
5828
5819 * Implemented the new ultraTB functionality into IPython. New
5829 * Implemented the new ultraTB functionality into IPython. New
5820 option: xcolors. This chooses color scheme. xmode now only selects
5830 option: xcolors. This chooses color scheme. xmode now only selects
5821 between Plain and Verbose. Better orthogonality.
5831 between Plain and Verbose. Better orthogonality.
5822
5832
5823 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5833 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5824 mode and color scheme for the exception handlers. Now it's
5834 mode and color scheme for the exception handlers. Now it's
5825 possible to have the verbose traceback with no coloring.
5835 possible to have the verbose traceback with no coloring.
5826
5836
5827 2001-11-23 Fernando Perez <fperez@colorado.edu>
5837 2001-11-23 Fernando Perez <fperez@colorado.edu>
5828
5838
5829 * Version 0.1.12 released, 0.1.13 opened.
5839 * Version 0.1.12 released, 0.1.13 opened.
5830
5840
5831 * Removed option to set auto-quote and auto-paren escapes by
5841 * Removed option to set auto-quote and auto-paren escapes by
5832 user. The chances of breaking valid syntax are just too high. If
5842 user. The chances of breaking valid syntax are just too high. If
5833 someone *really* wants, they can always dig into the code.
5843 someone *really* wants, they can always dig into the code.
5834
5844
5835 * Made prompt separators configurable.
5845 * Made prompt separators configurable.
5836
5846
5837 2001-11-22 Fernando Perez <fperez@colorado.edu>
5847 2001-11-22 Fernando Perez <fperez@colorado.edu>
5838
5848
5839 * Small bugfixes in many places.
5849 * Small bugfixes in many places.
5840
5850
5841 * Removed the MyCompleter class from ipplib. It seemed redundant
5851 * Removed the MyCompleter class from ipplib. It seemed redundant
5842 with the C-p,C-n history search functionality. Less code to
5852 with the C-p,C-n history search functionality. Less code to
5843 maintain.
5853 maintain.
5844
5854
5845 * Moved all the original ipython.py code into ipythonlib.py. Right
5855 * Moved all the original ipython.py code into ipythonlib.py. Right
5846 now it's just one big dump into a function called make_IPython, so
5856 now it's just one big dump into a function called make_IPython, so
5847 no real modularity has been gained. But at least it makes the
5857 no real modularity has been gained. But at least it makes the
5848 wrapper script tiny, and since ipythonlib is a module, it gets
5858 wrapper script tiny, and since ipythonlib is a module, it gets
5849 compiled and startup is much faster.
5859 compiled and startup is much faster.
5850
5860
5851 This is a reasobably 'deep' change, so we should test it for a
5861 This is a reasobably 'deep' change, so we should test it for a
5852 while without messing too much more with the code.
5862 while without messing too much more with the code.
5853
5863
5854 2001-11-21 Fernando Perez <fperez@colorado.edu>
5864 2001-11-21 Fernando Perez <fperez@colorado.edu>
5855
5865
5856 * Version 0.1.11 released, 0.1.12 opened for further work.
5866 * Version 0.1.11 released, 0.1.12 opened for further work.
5857
5867
5858 * Removed dependency on Itpl. It was only needed in one place. It
5868 * Removed dependency on Itpl. It was only needed in one place. It
5859 would be nice if this became part of python, though. It makes life
5869 would be nice if this became part of python, though. It makes life
5860 *a lot* easier in some cases.
5870 *a lot* easier in some cases.
5861
5871
5862 * Simplified the prefilter code a bit. Now all handlers are
5872 * Simplified the prefilter code a bit. Now all handlers are
5863 expected to explicitly return a value (at least a blank string).
5873 expected to explicitly return a value (at least a blank string).
5864
5874
5865 * Heavy edits in ipplib. Removed the help system altogether. Now
5875 * Heavy edits in ipplib. Removed the help system altogether. Now
5866 obj?/?? is used for inspecting objects, a magic @doc prints
5876 obj?/?? is used for inspecting objects, a magic @doc prints
5867 docstrings, and full-blown Python help is accessed via the 'help'
5877 docstrings, and full-blown Python help is accessed via the 'help'
5868 keyword. This cleans up a lot of code (less to maintain) and does
5878 keyword. This cleans up a lot of code (less to maintain) and does
5869 the job. Since 'help' is now a standard Python component, might as
5879 the job. Since 'help' is now a standard Python component, might as
5870 well use it and remove duplicate functionality.
5880 well use it and remove duplicate functionality.
5871
5881
5872 Also removed the option to use ipplib as a standalone program. By
5882 Also removed the option to use ipplib as a standalone program. By
5873 now it's too dependent on other parts of IPython to function alone.
5883 now it's too dependent on other parts of IPython to function alone.
5874
5884
5875 * Fixed bug in genutils.pager. It would crash if the pager was
5885 * Fixed bug in genutils.pager. It would crash if the pager was
5876 exited immediately after opening (broken pipe).
5886 exited immediately after opening (broken pipe).
5877
5887
5878 * Trimmed down the VerboseTB reporting a little. The header is
5888 * Trimmed down the VerboseTB reporting a little. The header is
5879 much shorter now and the repeated exception arguments at the end
5889 much shorter now and the repeated exception arguments at the end
5880 have been removed. For interactive use the old header seemed a bit
5890 have been removed. For interactive use the old header seemed a bit
5881 excessive.
5891 excessive.
5882
5892
5883 * Fixed small bug in output of @whos for variables with multi-word
5893 * Fixed small bug in output of @whos for variables with multi-word
5884 types (only first word was displayed).
5894 types (only first word was displayed).
5885
5895
5886 2001-11-17 Fernando Perez <fperez@colorado.edu>
5896 2001-11-17 Fernando Perez <fperez@colorado.edu>
5887
5897
5888 * Version 0.1.10 released, 0.1.11 opened for further work.
5898 * Version 0.1.10 released, 0.1.11 opened for further work.
5889
5899
5890 * Modified dirs and friends. dirs now *returns* the stack (not
5900 * Modified dirs and friends. dirs now *returns* the stack (not
5891 prints), so one can manipulate it as a variable. Convenient to
5901 prints), so one can manipulate it as a variable. Convenient to
5892 travel along many directories.
5902 travel along many directories.
5893
5903
5894 * Fixed bug in magic_pdef: would only work with functions with
5904 * Fixed bug in magic_pdef: would only work with functions with
5895 arguments with default values.
5905 arguments with default values.
5896
5906
5897 2001-11-14 Fernando Perez <fperez@colorado.edu>
5907 2001-11-14 Fernando Perez <fperez@colorado.edu>
5898
5908
5899 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5909 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5900 example with IPython. Various other minor fixes and cleanups.
5910 example with IPython. Various other minor fixes and cleanups.
5901
5911
5902 * Version 0.1.9 released, 0.1.10 opened for further work.
5912 * Version 0.1.9 released, 0.1.10 opened for further work.
5903
5913
5904 * Added sys.path to the list of directories searched in the
5914 * Added sys.path to the list of directories searched in the
5905 execfile= option. It used to be the current directory and the
5915 execfile= option. It used to be the current directory and the
5906 user's IPYTHONDIR only.
5916 user's IPYTHONDIR only.
5907
5917
5908 2001-11-13 Fernando Perez <fperez@colorado.edu>
5918 2001-11-13 Fernando Perez <fperez@colorado.edu>
5909
5919
5910 * Reinstated the raw_input/prefilter separation that Janko had
5920 * Reinstated the raw_input/prefilter separation that Janko had
5911 initially. This gives a more convenient setup for extending the
5921 initially. This gives a more convenient setup for extending the
5912 pre-processor from the outside: raw_input always gets a string,
5922 pre-processor from the outside: raw_input always gets a string,
5913 and prefilter has to process it. We can then redefine prefilter
5923 and prefilter has to process it. We can then redefine prefilter
5914 from the outside and implement extensions for special
5924 from the outside and implement extensions for special
5915 purposes.
5925 purposes.
5916
5926
5917 Today I got one for inputting PhysicalQuantity objects
5927 Today I got one for inputting PhysicalQuantity objects
5918 (from Scientific) without needing any function calls at
5928 (from Scientific) without needing any function calls at
5919 all. Extremely convenient, and it's all done as a user-level
5929 all. Extremely convenient, and it's all done as a user-level
5920 extension (no IPython code was touched). Now instead of:
5930 extension (no IPython code was touched). Now instead of:
5921 a = PhysicalQuantity(4.2,'m/s**2')
5931 a = PhysicalQuantity(4.2,'m/s**2')
5922 one can simply say
5932 one can simply say
5923 a = 4.2 m/s**2
5933 a = 4.2 m/s**2
5924 or even
5934 or even
5925 a = 4.2 m/s^2
5935 a = 4.2 m/s^2
5926
5936
5927 I use this, but it's also a proof of concept: IPython really is
5937 I use this, but it's also a proof of concept: IPython really is
5928 fully user-extensible, even at the level of the parsing of the
5938 fully user-extensible, even at the level of the parsing of the
5929 command line. It's not trivial, but it's perfectly doable.
5939 command line. It's not trivial, but it's perfectly doable.
5930
5940
5931 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5941 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5932 the problem of modules being loaded in the inverse order in which
5942 the problem of modules being loaded in the inverse order in which
5933 they were defined in
5943 they were defined in
5934
5944
5935 * Version 0.1.8 released, 0.1.9 opened for further work.
5945 * Version 0.1.8 released, 0.1.9 opened for further work.
5936
5946
5937 * Added magics pdef, source and file. They respectively show the
5947 * Added magics pdef, source and file. They respectively show the
5938 definition line ('prototype' in C), source code and full python
5948 definition line ('prototype' in C), source code and full python
5939 file for any callable object. The object inspector oinfo uses
5949 file for any callable object. The object inspector oinfo uses
5940 these to show the same information.
5950 these to show the same information.
5941
5951
5942 * Version 0.1.7 released, 0.1.8 opened for further work.
5952 * Version 0.1.7 released, 0.1.8 opened for further work.
5943
5953
5944 * Separated all the magic functions into a class called Magic. The
5954 * Separated all the magic functions into a class called Magic. The
5945 InteractiveShell class was becoming too big for Xemacs to handle
5955 InteractiveShell class was becoming too big for Xemacs to handle
5946 (de-indenting a line would lock it up for 10 seconds while it
5956 (de-indenting a line would lock it up for 10 seconds while it
5947 backtracked on the whole class!)
5957 backtracked on the whole class!)
5948
5958
5949 FIXME: didn't work. It can be done, but right now namespaces are
5959 FIXME: didn't work. It can be done, but right now namespaces are
5950 all messed up. Do it later (reverted it for now, so at least
5960 all messed up. Do it later (reverted it for now, so at least
5951 everything works as before).
5961 everything works as before).
5952
5962
5953 * Got the object introspection system (magic_oinfo) working! I
5963 * Got the object introspection system (magic_oinfo) working! I
5954 think this is pretty much ready for release to Janko, so he can
5964 think this is pretty much ready for release to Janko, so he can
5955 test it for a while and then announce it. Pretty much 100% of what
5965 test it for a while and then announce it. Pretty much 100% of what
5956 I wanted for the 'phase 1' release is ready. Happy, tired.
5966 I wanted for the 'phase 1' release is ready. Happy, tired.
5957
5967
5958 2001-11-12 Fernando Perez <fperez@colorado.edu>
5968 2001-11-12 Fernando Perez <fperez@colorado.edu>
5959
5969
5960 * Version 0.1.6 released, 0.1.7 opened for further work.
5970 * Version 0.1.6 released, 0.1.7 opened for further work.
5961
5971
5962 * Fixed bug in printing: it used to test for truth before
5972 * Fixed bug in printing: it used to test for truth before
5963 printing, so 0 wouldn't print. Now checks for None.
5973 printing, so 0 wouldn't print. Now checks for None.
5964
5974
5965 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5975 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5966 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5976 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5967 reaches by hand into the outputcache. Think of a better way to do
5977 reaches by hand into the outputcache. Think of a better way to do
5968 this later.
5978 this later.
5969
5979
5970 * Various small fixes thanks to Nathan's comments.
5980 * Various small fixes thanks to Nathan's comments.
5971
5981
5972 * Changed magic_pprint to magic_Pprint. This way it doesn't
5982 * Changed magic_pprint to magic_Pprint. This way it doesn't
5973 collide with pprint() and the name is consistent with the command
5983 collide with pprint() and the name is consistent with the command
5974 line option.
5984 line option.
5975
5985
5976 * Changed prompt counter behavior to be fully like
5986 * Changed prompt counter behavior to be fully like
5977 Mathematica's. That is, even input that doesn't return a result
5987 Mathematica's. That is, even input that doesn't return a result
5978 raises the prompt counter. The old behavior was kind of confusing
5988 raises the prompt counter. The old behavior was kind of confusing
5979 (getting the same prompt number several times if the operation
5989 (getting the same prompt number several times if the operation
5980 didn't return a result).
5990 didn't return a result).
5981
5991
5982 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5992 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5983
5993
5984 * Fixed -Classic mode (wasn't working anymore).
5994 * Fixed -Classic mode (wasn't working anymore).
5985
5995
5986 * Added colored prompts using Nathan's new code. Colors are
5996 * Added colored prompts using Nathan's new code. Colors are
5987 currently hardwired, they can be user-configurable. For
5997 currently hardwired, they can be user-configurable. For
5988 developers, they can be chosen in file ipythonlib.py, at the
5998 developers, they can be chosen in file ipythonlib.py, at the
5989 beginning of the CachedOutput class def.
5999 beginning of the CachedOutput class def.
5990
6000
5991 2001-11-11 Fernando Perez <fperez@colorado.edu>
6001 2001-11-11 Fernando Perez <fperez@colorado.edu>
5992
6002
5993 * Version 0.1.5 released, 0.1.6 opened for further work.
6003 * Version 0.1.5 released, 0.1.6 opened for further work.
5994
6004
5995 * Changed magic_env to *return* the environment as a dict (not to
6005 * Changed magic_env to *return* the environment as a dict (not to
5996 print it). This way it prints, but it can also be processed.
6006 print it). This way it prints, but it can also be processed.
5997
6007
5998 * Added Verbose exception reporting to interactive
6008 * Added Verbose exception reporting to interactive
5999 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6009 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6000 traceback. Had to make some changes to the ultraTB file. This is
6010 traceback. Had to make some changes to the ultraTB file. This is
6001 probably the last 'big' thing in my mental todo list. This ties
6011 probably the last 'big' thing in my mental todo list. This ties
6002 in with the next entry:
6012 in with the next entry:
6003
6013
6004 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6014 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6005 has to specify is Plain, Color or Verbose for all exception
6015 has to specify is Plain, Color or Verbose for all exception
6006 handling.
6016 handling.
6007
6017
6008 * Removed ShellServices option. All this can really be done via
6018 * Removed ShellServices option. All this can really be done via
6009 the magic system. It's easier to extend, cleaner and has automatic
6019 the magic system. It's easier to extend, cleaner and has automatic
6010 namespace protection and documentation.
6020 namespace protection and documentation.
6011
6021
6012 2001-11-09 Fernando Perez <fperez@colorado.edu>
6022 2001-11-09 Fernando Perez <fperez@colorado.edu>
6013
6023
6014 * Fixed bug in output cache flushing (missing parameter to
6024 * Fixed bug in output cache flushing (missing parameter to
6015 __init__). Other small bugs fixed (found using pychecker).
6025 __init__). Other small bugs fixed (found using pychecker).
6016
6026
6017 * Version 0.1.4 opened for bugfixing.
6027 * Version 0.1.4 opened for bugfixing.
6018
6028
6019 2001-11-07 Fernando Perez <fperez@colorado.edu>
6029 2001-11-07 Fernando Perez <fperez@colorado.edu>
6020
6030
6021 * Version 0.1.3 released, mainly because of the raw_input bug.
6031 * Version 0.1.3 released, mainly because of the raw_input bug.
6022
6032
6023 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6033 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6024 and when testing for whether things were callable, a call could
6034 and when testing for whether things were callable, a call could
6025 actually be made to certain functions. They would get called again
6035 actually be made to certain functions. They would get called again
6026 once 'really' executed, with a resulting double call. A disaster
6036 once 'really' executed, with a resulting double call. A disaster
6027 in many cases (list.reverse() would never work!).
6037 in many cases (list.reverse() would never work!).
6028
6038
6029 * Removed prefilter() function, moved its code to raw_input (which
6039 * Removed prefilter() function, moved its code to raw_input (which
6030 after all was just a near-empty caller for prefilter). This saves
6040 after all was just a near-empty caller for prefilter). This saves
6031 a function call on every prompt, and simplifies the class a tiny bit.
6041 a function call on every prompt, and simplifies the class a tiny bit.
6032
6042
6033 * Fix _ip to __ip name in magic example file.
6043 * Fix _ip to __ip name in magic example file.
6034
6044
6035 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6045 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6036 work with non-gnu versions of tar.
6046 work with non-gnu versions of tar.
6037
6047
6038 2001-11-06 Fernando Perez <fperez@colorado.edu>
6048 2001-11-06 Fernando Perez <fperez@colorado.edu>
6039
6049
6040 * Version 0.1.2. Just to keep track of the recent changes.
6050 * Version 0.1.2. Just to keep track of the recent changes.
6041
6051
6042 * Fixed nasty bug in output prompt routine. It used to check 'if
6052 * Fixed nasty bug in output prompt routine. It used to check 'if
6043 arg != None...'. Problem is, this fails if arg implements a
6053 arg != None...'. Problem is, this fails if arg implements a
6044 special comparison (__cmp__) which disallows comparing to
6054 special comparison (__cmp__) which disallows comparing to
6045 None. Found it when trying to use the PhysicalQuantity module from
6055 None. Found it when trying to use the PhysicalQuantity module from
6046 ScientificPython.
6056 ScientificPython.
6047
6057
6048 2001-11-05 Fernando Perez <fperez@colorado.edu>
6058 2001-11-05 Fernando Perez <fperez@colorado.edu>
6049
6059
6050 * Also added dirs. Now the pushd/popd/dirs family functions
6060 * Also added dirs. Now the pushd/popd/dirs family functions
6051 basically like the shell, with the added convenience of going home
6061 basically like the shell, with the added convenience of going home
6052 when called with no args.
6062 when called with no args.
6053
6063
6054 * pushd/popd slightly modified to mimic shell behavior more
6064 * pushd/popd slightly modified to mimic shell behavior more
6055 closely.
6065 closely.
6056
6066
6057 * Added env,pushd,popd from ShellServices as magic functions. I
6067 * Added env,pushd,popd from ShellServices as magic functions. I
6058 think the cleanest will be to port all desired functions from
6068 think the cleanest will be to port all desired functions from
6059 ShellServices as magics and remove ShellServices altogether. This
6069 ShellServices as magics and remove ShellServices altogether. This
6060 will provide a single, clean way of adding functionality
6070 will provide a single, clean way of adding functionality
6061 (shell-type or otherwise) to IP.
6071 (shell-type or otherwise) to IP.
6062
6072
6063 2001-11-04 Fernando Perez <fperez@colorado.edu>
6073 2001-11-04 Fernando Perez <fperez@colorado.edu>
6064
6074
6065 * Added .ipython/ directory to sys.path. This way users can keep
6075 * Added .ipython/ directory to sys.path. This way users can keep
6066 customizations there and access them via import.
6076 customizations there and access them via import.
6067
6077
6068 2001-11-03 Fernando Perez <fperez@colorado.edu>
6078 2001-11-03 Fernando Perez <fperez@colorado.edu>
6069
6079
6070 * Opened version 0.1.1 for new changes.
6080 * Opened version 0.1.1 for new changes.
6071
6081
6072 * Changed version number to 0.1.0: first 'public' release, sent to
6082 * Changed version number to 0.1.0: first 'public' release, sent to
6073 Nathan and Janko.
6083 Nathan and Janko.
6074
6084
6075 * Lots of small fixes and tweaks.
6085 * Lots of small fixes and tweaks.
6076
6086
6077 * Minor changes to whos format. Now strings are shown, snipped if
6087 * Minor changes to whos format. Now strings are shown, snipped if
6078 too long.
6088 too long.
6079
6089
6080 * Changed ShellServices to work on __main__ so they show up in @who
6090 * Changed ShellServices to work on __main__ so they show up in @who
6081
6091
6082 * Help also works with ? at the end of a line:
6092 * Help also works with ? at the end of a line:
6083 ?sin and sin?
6093 ?sin and sin?
6084 both produce the same effect. This is nice, as often I use the
6094 both produce the same effect. This is nice, as often I use the
6085 tab-complete to find the name of a method, but I used to then have
6095 tab-complete to find the name of a method, but I used to then have
6086 to go to the beginning of the line to put a ? if I wanted more
6096 to go to the beginning of the line to put a ? if I wanted more
6087 info. Now I can just add the ? and hit return. Convenient.
6097 info. Now I can just add the ? and hit return. Convenient.
6088
6098
6089 2001-11-02 Fernando Perez <fperez@colorado.edu>
6099 2001-11-02 Fernando Perez <fperez@colorado.edu>
6090
6100
6091 * Python version check (>=2.1) added.
6101 * Python version check (>=2.1) added.
6092
6102
6093 * Added LazyPython documentation. At this point the docs are quite
6103 * Added LazyPython documentation. At this point the docs are quite
6094 a mess. A cleanup is in order.
6104 a mess. A cleanup is in order.
6095
6105
6096 * Auto-installer created. For some bizarre reason, the zipfiles
6106 * Auto-installer created. For some bizarre reason, the zipfiles
6097 module isn't working on my system. So I made a tar version
6107 module isn't working on my system. So I made a tar version
6098 (hopefully the command line options in various systems won't kill
6108 (hopefully the command line options in various systems won't kill
6099 me).
6109 me).
6100
6110
6101 * Fixes to Struct in genutils. Now all dictionary-like methods are
6111 * Fixes to Struct in genutils. Now all dictionary-like methods are
6102 protected (reasonably).
6112 protected (reasonably).
6103
6113
6104 * Added pager function to genutils and changed ? to print usage
6114 * Added pager function to genutils and changed ? to print usage
6105 note through it (it was too long).
6115 note through it (it was too long).
6106
6116
6107 * Added the LazyPython functionality. Works great! I changed the
6117 * Added the LazyPython functionality. Works great! I changed the
6108 auto-quote escape to ';', it's on home row and next to '. But
6118 auto-quote escape to ';', it's on home row and next to '. But
6109 both auto-quote and auto-paren (still /) escapes are command-line
6119 both auto-quote and auto-paren (still /) escapes are command-line
6110 parameters.
6120 parameters.
6111
6121
6112
6122
6113 2001-11-01 Fernando Perez <fperez@colorado.edu>
6123 2001-11-01 Fernando Perez <fperez@colorado.edu>
6114
6124
6115 * Version changed to 0.0.7. Fairly large change: configuration now
6125 * Version changed to 0.0.7. Fairly large change: configuration now
6116 is all stored in a directory, by default .ipython. There, all
6126 is all stored in a directory, by default .ipython. There, all
6117 config files have normal looking names (not .names)
6127 config files have normal looking names (not .names)
6118
6128
6119 * Version 0.0.6 Released first to Lucas and Archie as a test
6129 * Version 0.0.6 Released first to Lucas and Archie as a test
6120 run. Since it's the first 'semi-public' release, change version to
6130 run. Since it's the first 'semi-public' release, change version to
6121 > 0.0.6 for any changes now.
6131 > 0.0.6 for any changes now.
6122
6132
6123 * Stuff I had put in the ipplib.py changelog:
6133 * Stuff I had put in the ipplib.py changelog:
6124
6134
6125 Changes to InteractiveShell:
6135 Changes to InteractiveShell:
6126
6136
6127 - Made the usage message a parameter.
6137 - Made the usage message a parameter.
6128
6138
6129 - Require the name of the shell variable to be given. It's a bit
6139 - Require the name of the shell variable to be given. It's a bit
6130 of a hack, but allows the name 'shell' not to be hardwired in the
6140 of a hack, but allows the name 'shell' not to be hardwired in the
6131 magic (@) handler, which is problematic b/c it requires
6141 magic (@) handler, which is problematic b/c it requires
6132 polluting the global namespace with 'shell'. This in turn is
6142 polluting the global namespace with 'shell'. This in turn is
6133 fragile: if a user redefines a variable called shell, things
6143 fragile: if a user redefines a variable called shell, things
6134 break.
6144 break.
6135
6145
6136 - magic @: all functions available through @ need to be defined
6146 - magic @: all functions available through @ need to be defined
6137 as magic_<name>, even though they can be called simply as
6147 as magic_<name>, even though they can be called simply as
6138 @<name>. This allows the special command @magic to gather
6148 @<name>. This allows the special command @magic to gather
6139 information automatically about all existing magic functions,
6149 information automatically about all existing magic functions,
6140 even if they are run-time user extensions, by parsing the shell
6150 even if they are run-time user extensions, by parsing the shell
6141 instance __dict__ looking for special magic_ names.
6151 instance __dict__ looking for special magic_ names.
6142
6152
6143 - mainloop: added *two* local namespace parameters. This allows
6153 - mainloop: added *two* local namespace parameters. This allows
6144 the class to differentiate between parameters which were there
6154 the class to differentiate between parameters which were there
6145 before and after command line initialization was processed. This
6155 before and after command line initialization was processed. This
6146 way, later @who can show things loaded at startup by the
6156 way, later @who can show things loaded at startup by the
6147 user. This trick was necessary to make session saving/reloading
6157 user. This trick was necessary to make session saving/reloading
6148 really work: ideally after saving/exiting/reloading a session,
6158 really work: ideally after saving/exiting/reloading a session,
6149 *everything* should look the same, including the output of @who. I
6159 *everything* should look the same, including the output of @who. I
6150 was only able to make this work with this double namespace
6160 was only able to make this work with this double namespace
6151 trick.
6161 trick.
6152
6162
6153 - added a header to the logfile which allows (almost) full
6163 - added a header to the logfile which allows (almost) full
6154 session restoring.
6164 session restoring.
6155
6165
6156 - prepend lines beginning with @ or !, with a and log
6166 - prepend lines beginning with @ or !, with a and log
6157 them. Why? !lines: may be useful to know what you did @lines:
6167 them. Why? !lines: may be useful to know what you did @lines:
6158 they may affect session state. So when restoring a session, at
6168 they may affect session state. So when restoring a session, at
6159 least inform the user of their presence. I couldn't quite get
6169 least inform the user of their presence. I couldn't quite get
6160 them to properly re-execute, but at least the user is warned.
6170 them to properly re-execute, but at least the user is warned.
6161
6171
6162 * Started ChangeLog.
6172 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now