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