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