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