##// END OF EJS Templates
Arnd's wxversion support.
fperez -
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -1,917 +1,933 b''
1 1 # -*- coding: utf-8 -*-
2 2 """IPython Shell classes.
3 3
4 4 All the matplotlib support code was co-developed with John Hunter,
5 5 matplotlib's author.
6 6
7 $Id: Shell.py 994 2006-01-08 08:29:44Z fperez $"""
7 $Id: Shell.py 998 2006-01-09 06:57:40Z fperez $"""
8 8
9 9 #*****************************************************************************
10 10 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
11 11 #
12 12 # Distributed under the terms of the BSD License. The full license is in
13 13 # the file COPYING, distributed as part of this software.
14 14 #*****************************************************************************
15 15
16 16 from IPython import Release
17 17 __author__ = '%s <%s>' % Release.authors['Fernando']
18 18 __license__ = Release.license
19 19
20 20 # Code begins
21 21 import __main__
22 22 import __builtin__
23 23 import os
24 24 import sys
25 25 import signal
26 26 import threading
27 27
28 28 import IPython
29 29 from IPython import ultraTB
30 30 from IPython.genutils import Term,warn,error,flag_calls
31 31 from IPython.iplib import InteractiveShell
32 32 from IPython.ipmaker import make_IPython
33 33 from IPython.Magic import Magic
34 34 from IPython.Struct import Struct
35 35
36 36 # global flag to pass around information about Ctrl-C without exceptions
37 37 KBINT = False
38 38
39 39 # global flag to turn on/off Tk support.
40 40 USE_TK = False
41 41
42 42 #-----------------------------------------------------------------------------
43 43 # This class is trivial now, but I want to have it in to publish a clean
44 44 # interface. Later when the internals are reorganized, code that uses this
45 45 # shouldn't have to change.
46 46
47 47 class IPShell:
48 48 """Create an IPython instance."""
49 49
50 50 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
51 51 debug=1,shell_class=InteractiveShell):
52 52 self.IP = make_IPython(argv,user_ns=user_ns,user_global_ns=user_global_ns,
53 53 debug=debug,shell_class=shell_class)
54 54
55 55 def mainloop(self,sys_exit=0,banner=None):
56 56 self.IP.mainloop(banner)
57 57 if sys_exit:
58 58 sys.exit()
59 59
60 60 #-----------------------------------------------------------------------------
61 61 class IPShellEmbed:
62 62 """Allow embedding an IPython shell into a running program.
63 63
64 64 Instances of this class are callable, with the __call__ method being an
65 65 alias to the embed() method of an InteractiveShell instance.
66 66
67 67 Usage (see also the example-embed.py file for a running example):
68 68
69 69 ipshell = IPShellEmbed([argv,banner,exit_msg,rc_override])
70 70
71 71 - argv: list containing valid command-line options for IPython, as they
72 72 would appear in sys.argv[1:].
73 73
74 74 For example, the following command-line options:
75 75
76 76 $ ipython -prompt_in1 'Input <\\#>' -colors LightBG
77 77
78 78 would be passed in the argv list as:
79 79
80 80 ['-prompt_in1','Input <\\#>','-colors','LightBG']
81 81
82 82 - banner: string which gets printed every time the interpreter starts.
83 83
84 84 - exit_msg: string which gets printed every time the interpreter exits.
85 85
86 86 - rc_override: a dict or Struct of configuration options such as those
87 87 used by IPython. These options are read from your ~/.ipython/ipythonrc
88 88 file when the Shell object is created. Passing an explicit rc_override
89 89 dict with any options you want allows you to override those values at
90 90 creation time without having to modify the file. This way you can create
91 91 embeddable instances configured in any way you want without editing any
92 92 global files (thus keeping your interactive IPython configuration
93 93 unchanged).
94 94
95 95 Then the ipshell instance can be called anywhere inside your code:
96 96
97 97 ipshell(header='') -> Opens up an IPython shell.
98 98
99 99 - header: string printed by the IPython shell upon startup. This can let
100 100 you know where in your code you are when dropping into the shell. Note
101 101 that 'banner' gets prepended to all calls, so header is used for
102 102 location-specific information.
103 103
104 104 For more details, see the __call__ method below.
105 105
106 106 When the IPython shell is exited with Ctrl-D, normal program execution
107 107 resumes.
108 108
109 109 This functionality was inspired by a posting on comp.lang.python by cmkl
110 110 <cmkleffner@gmx.de> on Dec. 06/01 concerning similar uses of pyrepl, and
111 111 by the IDL stop/continue commands."""
112 112
113 113 def __init__(self,argv=None,banner='',exit_msg=None,rc_override=None):
114 114 """Note that argv here is a string, NOT a list."""
115 115 self.set_banner(banner)
116 116 self.set_exit_msg(exit_msg)
117 117 self.set_dummy_mode(0)
118 118
119 119 # sys.displayhook is a global, we need to save the user's original
120 120 # Don't rely on __displayhook__, as the user may have changed that.
121 121 self.sys_displayhook_ori = sys.displayhook
122 122
123 123 # save readline completer status
124 124 try:
125 125 #print 'Save completer',sys.ipcompleter # dbg
126 126 self.sys_ipcompleter_ori = sys.ipcompleter
127 127 except:
128 128 pass # not nested with IPython
129 129
130 130 # FIXME. Passing user_ns breaks namespace handling.
131 131 #self.IP = make_IPython(argv,user_ns=__main__.__dict__)
132 132 self.IP = make_IPython(argv,rc_override=rc_override,embedded=True)
133 133
134 134 # copy our own displayhook also
135 135 self.sys_displayhook_embed = sys.displayhook
136 136 # and leave the system's display hook clean
137 137 sys.displayhook = self.sys_displayhook_ori
138 138 # don't use the ipython crash handler so that user exceptions aren't
139 139 # trapped
140 140 sys.excepthook = ultraTB.FormattedTB(color_scheme = self.IP.rc.colors,
141 141 mode = self.IP.rc.xmode,
142 142 call_pdb = self.IP.rc.pdb)
143 143 self.restore_system_completer()
144 144
145 145 def restore_system_completer(self):
146 146 """Restores the readline completer which was in place.
147 147
148 148 This allows embedded IPython within IPython not to disrupt the
149 149 parent's completion.
150 150 """
151 151
152 152 try:
153 153 self.IP.readline.set_completer(self.sys_ipcompleter_ori)
154 154 sys.ipcompleter = self.sys_ipcompleter_ori
155 155 except:
156 156 pass
157 157
158 158 def __call__(self,header='',local_ns=None,global_ns=None,dummy=None):
159 159 """Activate the interactive interpreter.
160 160
161 161 __call__(self,header='',local_ns=None,global_ns,dummy=None) -> Start
162 162 the interpreter shell with the given local and global namespaces, and
163 163 optionally print a header string at startup.
164 164
165 165 The shell can be globally activated/deactivated using the
166 166 set/get_dummy_mode methods. This allows you to turn off a shell used
167 167 for debugging globally.
168 168
169 169 However, *each* time you call the shell you can override the current
170 170 state of dummy_mode with the optional keyword parameter 'dummy'. For
171 171 example, if you set dummy mode on with IPShell.set_dummy_mode(1), you
172 172 can still have a specific call work by making it as IPShell(dummy=0).
173 173
174 174 The optional keyword parameter dummy controls whether the call
175 175 actually does anything. """
176 176
177 177 # Allow the dummy parameter to override the global __dummy_mode
178 178 if dummy or (dummy != 0 and self.__dummy_mode):
179 179 return
180 180
181 181 # Set global subsystems (display,completions) to our values
182 182 sys.displayhook = self.sys_displayhook_embed
183 183 if self.IP.has_readline:
184 184 self.IP.readline.set_completer(self.IP.Completer.complete)
185 185
186 186 if self.banner and header:
187 187 format = '%s\n%s\n'
188 188 else:
189 189 format = '%s%s\n'
190 190 banner = format % (self.banner,header)
191 191
192 192 # Call the embedding code with a stack depth of 1 so it can skip over
193 193 # our call and get the original caller's namespaces.
194 194 self.IP.embed_mainloop(banner,local_ns,global_ns,stack_depth=1)
195 195
196 196 if self.exit_msg:
197 197 print self.exit_msg
198 198
199 199 # Restore global systems (display, completion)
200 200 sys.displayhook = self.sys_displayhook_ori
201 201 self.restore_system_completer()
202 202
203 203 def set_dummy_mode(self,dummy):
204 204 """Sets the embeddable shell's dummy mode parameter.
205 205
206 206 set_dummy_mode(dummy): dummy = 0 or 1.
207 207
208 208 This parameter is persistent and makes calls to the embeddable shell
209 209 silently return without performing any action. This allows you to
210 210 globally activate or deactivate a shell you're using with a single call.
211 211
212 212 If you need to manually"""
213 213
214 214 if dummy not in [0,1,False,True]:
215 215 raise ValueError,'dummy parameter must be boolean'
216 216 self.__dummy_mode = dummy
217 217
218 218 def get_dummy_mode(self):
219 219 """Return the current value of the dummy mode parameter.
220 220 """
221 221 return self.__dummy_mode
222 222
223 223 def set_banner(self,banner):
224 224 """Sets the global banner.
225 225
226 226 This banner gets prepended to every header printed when the shell
227 227 instance is called."""
228 228
229 229 self.banner = banner
230 230
231 231 def set_exit_msg(self,exit_msg):
232 232 """Sets the global exit_msg.
233 233
234 234 This exit message gets printed upon exiting every time the embedded
235 235 shell is called. It is None by default. """
236 236
237 237 self.exit_msg = exit_msg
238 238
239 239 #-----------------------------------------------------------------------------
240 240 def sigint_handler (signum,stack_frame):
241 241 """Sigint handler for threaded apps.
242 242
243 243 This is a horrible hack to pass information about SIGINT _without_ using
244 244 exceptions, since I haven't been able to properly manage cross-thread
245 245 exceptions in GTK/WX. In fact, I don't think it can be done (or at least
246 246 that's my understanding from a c.l.py thread where this was discussed)."""
247 247
248 248 global KBINT
249 249
250 250 print '\nKeyboardInterrupt - Press <Enter> to continue.',
251 251 Term.cout.flush()
252 252 # Set global flag so that runsource can know that Ctrl-C was hit
253 253 KBINT = True
254 254
255 255 class MTInteractiveShell(InteractiveShell):
256 256 """Simple multi-threaded shell."""
257 257
258 258 # Threading strategy taken from:
259 259 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
260 260 # McErlean and John Finlay. Modified with corrections by Antoon Pardon,
261 261 # from the pygtk mailing list, to avoid lockups with system calls.
262 262
263 263 # class attribute to indicate whether the class supports threads or not.
264 264 # Subclasses with thread support should override this as needed.
265 265 isthreaded = True
266 266
267 267 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
268 268 user_ns=None,user_global_ns=None,banner2='',**kw):
269 269 """Similar to the normal InteractiveShell, but with threading control"""
270 270
271 271 InteractiveShell.__init__(self,name,usage,rc,user_ns,
272 272 user_global_ns,banner2)
273 273
274 274 # Locking control variable
275 275 self.thread_ready = threading.Condition()
276 276
277 277 # Stuff to do at closing time
278 278 self._kill = False
279 279 on_kill = kw.get('on_kill')
280 280 if on_kill is None:
281 281 on_kill = []
282 282 # Check that all things to kill are callable:
283 283 for t in on_kill:
284 284 if not callable(t):
285 285 raise TypeError,'on_kill must be a list of callables'
286 286 self.on_kill = on_kill
287 287
288 288 def runsource(self, source, filename="<input>", symbol="single"):
289 289 """Compile and run some source in the interpreter.
290 290
291 291 Modified version of code.py's runsource(), to handle threading issues.
292 292 See the original for full docstring details."""
293 293
294 294 global KBINT
295 295
296 296 # If Ctrl-C was typed, we reset the flag and return right away
297 297 if KBINT:
298 298 KBINT = False
299 299 return False
300 300
301 301 try:
302 302 code = self.compile(source, filename, symbol)
303 303 except (OverflowError, SyntaxError, ValueError):
304 304 # Case 1
305 305 self.showsyntaxerror(filename)
306 306 return False
307 307
308 308 if code is None:
309 309 # Case 2
310 310 return True
311 311
312 312 # Case 3
313 313 # Store code in self, so the execution thread can handle it
314 314 self.thread_ready.acquire()
315 315 self.code_to_run = code
316 316 self.thread_ready.wait() # Wait until processed in timeout interval
317 317 self.thread_ready.release()
318 318
319 319 return False
320 320
321 321 def runcode(self):
322 322 """Execute a code object.
323 323
324 324 Multithreaded wrapper around IPython's runcode()."""
325 325
326 326 # lock thread-protected stuff
327 327 self.thread_ready.acquire()
328 328
329 329 # Install sigint handler
330 330 try:
331 331 signal.signal(signal.SIGINT, sigint_handler)
332 332 except SystemError:
333 333 # This happens under Windows, which seems to have all sorts
334 334 # of problems with signal handling. Oh well...
335 335 pass
336 336
337 337 if self._kill:
338 338 print >>Term.cout, 'Closing threads...',
339 339 Term.cout.flush()
340 340 for tokill in self.on_kill:
341 341 tokill()
342 342 print >>Term.cout, 'Done.'
343 343
344 344 # Run pending code by calling parent class
345 345 if self.code_to_run is not None:
346 346 self.thread_ready.notify()
347 347 InteractiveShell.runcode(self,self.code_to_run)
348 348
349 349 # We're done with thread-protected variables
350 350 self.thread_ready.release()
351 351 # This MUST return true for gtk threading to work
352 352 return True
353 353
354 354 def kill (self):
355 355 """Kill the thread, returning when it has been shut down."""
356 356 self.thread_ready.acquire()
357 357 self._kill = True
358 358 self.thread_ready.release()
359 359
360 360 class MatplotlibShellBase:
361 361 """Mixin class to provide the necessary modifications to regular IPython
362 362 shell classes for matplotlib support.
363 363
364 364 Given Python's MRO, this should be used as the FIRST class in the
365 365 inheritance hierarchy, so that it overrides the relevant methods."""
366 366
367 367 def _matplotlib_config(self,name):
368 368 """Return various items needed to setup the user's shell with matplotlib"""
369 369
370 370 # Initialize matplotlib to interactive mode always
371 371 import matplotlib
372 372 from matplotlib import backends
373 373 matplotlib.interactive(True)
374 374
375 375 def use(arg):
376 376 """IPython wrapper for matplotlib's backend switcher.
377 377
378 378 In interactive use, we can not allow switching to a different
379 379 interactive backend, since thread conflicts will most likely crash
380 380 the python interpreter. This routine does a safety check first,
381 381 and refuses to perform a dangerous switch. It still allows
382 382 switching to non-interactive backends."""
383 383
384 384 if arg in backends.interactive_bk and arg != self.mpl_backend:
385 385 m=('invalid matplotlib backend switch.\n'
386 386 'This script attempted to switch to the interactive '
387 387 'backend: `%s`\n'
388 388 'Your current choice of interactive backend is: `%s`\n\n'
389 389 'Switching interactive matplotlib backends at runtime\n'
390 390 'would crash the python interpreter, '
391 391 'and IPython has blocked it.\n\n'
392 392 'You need to either change your choice of matplotlib backend\n'
393 393 'by editing your .matplotlibrc file, or run this script as a \n'
394 394 'standalone file from the command line, not using IPython.\n' %
395 395 (arg,self.mpl_backend) )
396 396 raise RuntimeError, m
397 397 else:
398 398 self.mpl_use(arg)
399 399 self.mpl_use._called = True
400 400
401 401 self.matplotlib = matplotlib
402 402 self.mpl_backend = matplotlib.rcParams['backend']
403 403
404 404 # we also need to block switching of interactive backends by use()
405 405 self.mpl_use = matplotlib.use
406 406 self.mpl_use._called = False
407 407 # overwrite the original matplotlib.use with our wrapper
408 408 matplotlib.use = use
409 409
410 410
411 411 # This must be imported last in the matplotlib series, after
412 412 # backend/interactivity choices have been made
413 413 try:
414 414 import matplotlib.pylab as pylab
415 415 self.pylab = pylab
416 416 self.pylab_name = 'pylab'
417 417 except ImportError:
418 418 import matplotlib.matlab as matlab
419 419 self.pylab = matlab
420 420 self.pylab_name = 'matlab'
421 421
422 422 self.pylab.show._needmain = False
423 423 # We need to detect at runtime whether show() is called by the user.
424 424 # For this, we wrap it into a decorator which adds a 'called' flag.
425 425 self.pylab.draw_if_interactive = flag_calls(self.pylab.draw_if_interactive)
426 426
427 427 # Build a user namespace initialized with matplotlib/matlab features.
428 428 user_ns = {'__name__':'__main__',
429 429 '__builtins__' : __builtin__ }
430 430
431 431 # Be careful not to remove the final \n in the code string below, or
432 432 # things will break badly with py22 (I think it's a python bug, 2.3 is
433 433 # OK).
434 434 pname = self.pylab_name # Python can't interpolate dotted var names
435 435 exec ("import matplotlib\n"
436 436 "import matplotlib.%(pname)s as %(pname)s\n"
437 437 "from matplotlib.%(pname)s import *\n" % locals()) in user_ns
438 438
439 439 # Build matplotlib info banner
440 440 b="""
441 441 Welcome to pylab, a matplotlib-based Python environment.
442 442 For more information, type 'help(pylab)'.
443 443 """
444 444 return user_ns,b
445 445
446 446 def mplot_exec(self,fname,*where,**kw):
447 447 """Execute a matplotlib script.
448 448
449 449 This is a call to execfile(), but wrapped in safeties to properly
450 450 handle interactive rendering and backend switching."""
451 451
452 452 #print '*** Matplotlib runner ***' # dbg
453 453 # turn off rendering until end of script
454 454 isInteractive = self.matplotlib.rcParams['interactive']
455 455 self.matplotlib.interactive(False)
456 456 self.safe_execfile(fname,*where,**kw)
457 457 self.matplotlib.interactive(isInteractive)
458 458 # make rendering call now, if the user tried to do it
459 459 if self.pylab.draw_if_interactive.called:
460 460 self.pylab.draw()
461 461 self.pylab.draw_if_interactive.called = False
462 462
463 463 # if a backend switch was performed, reverse it now
464 464 if self.mpl_use._called:
465 465 self.matplotlib.rcParams['backend'] = self.mpl_backend
466 466
467 467 def magic_run(self,parameter_s=''):
468 468 Magic.magic_run(self,parameter_s,runner=self.mplot_exec)
469 469
470 470 # Fix the docstring so users see the original as well
471 471 magic_run.__doc__ = "%s\n%s" % (Magic.magic_run.__doc__,
472 472 "\n *** Modified %run for Matplotlib,"
473 473 " with proper interactive handling ***")
474 474
475 475 # Now we provide 2 versions of a matplotlib-aware IPython base shells, single
476 476 # and multithreaded. Note that these are meant for internal use, the IPShell*
477 477 # classes below are the ones meant for public consumption.
478 478
479 479 class MatplotlibShell(MatplotlibShellBase,InteractiveShell):
480 480 """Single-threaded shell with matplotlib support."""
481 481
482 482 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
483 483 user_ns=None,user_global_ns=None,**kw):
484 484 user_ns,b2 = self._matplotlib_config(name)
485 485 InteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
486 486 banner2=b2,**kw)
487 487
488 488 class MatplotlibMTShell(MatplotlibShellBase,MTInteractiveShell):
489 489 """Multi-threaded shell with matplotlib support."""
490 490
491 491 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
492 492 user_ns=None,user_global_ns=None, **kw):
493 493 user_ns,b2 = self._matplotlib_config(name)
494 494 MTInteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns,
495 495 banner2=b2,**kw)
496 496
497 497 #-----------------------------------------------------------------------------
498 498 # Utility functions for the different GUI enabled IPShell* classes.
499 499
500 500 def get_tk():
501 501 """Tries to import Tkinter and returns a withdrawn Tkinter root
502 502 window. If Tkinter is already imported or not available, this
503 503 returns None. This function calls `hijack_tk` underneath.
504 504 """
505 505 if not USE_TK or sys.modules.has_key('Tkinter'):
506 506 return None
507 507 else:
508 508 try:
509 509 import Tkinter
510 510 except ImportError:
511 511 return None
512 512 else:
513 513 hijack_tk()
514 514 r = Tkinter.Tk()
515 515 r.withdraw()
516 516 return r
517 517
518 518 def hijack_tk():
519 519 """Modifies Tkinter's mainloop with a dummy so when a module calls
520 520 mainloop, it does not block.
521 521
522 522 """
523 523 def misc_mainloop(self, n=0):
524 524 pass
525 525 def tkinter_mainloop(n=0):
526 526 pass
527 527
528 528 import Tkinter
529 529 Tkinter.Misc.mainloop = misc_mainloop
530 530 Tkinter.mainloop = tkinter_mainloop
531 531
532 532 def update_tk(tk):
533 533 """Updates the Tkinter event loop. This is typically called from
534 534 the respective WX or GTK mainloops.
535 535 """
536 536 if tk:
537 537 tk.update()
538 538
539 539 def hijack_wx():
540 540 """Modifies wxPython's MainLoop with a dummy so user code does not
541 541 block IPython. The hijacked mainloop function is returned.
542 542 """
543 543 def dummy_mainloop(*args, **kw):
544 544 pass
545 545 import wxPython
546 546 ver = wxPython.__version__
547 547 orig_mainloop = None
548 548 if ver[:3] >= '2.5':
549 549 import wx
550 550 if hasattr(wx, '_core_'): core = getattr(wx, '_core_')
551 551 elif hasattr(wx, '_core'): core = getattr(wx, '_core')
552 552 else: raise AttributeError('Could not find wx core module')
553 553 orig_mainloop = core.PyApp_MainLoop
554 554 core.PyApp_MainLoop = dummy_mainloop
555 555 elif ver[:3] == '2.4':
556 556 orig_mainloop = wxPython.wxc.wxPyApp_MainLoop
557 557 wxPython.wxc.wxPyApp_MainLoop = dummy_mainloop
558 558 else:
559 559 warn("Unable to find either wxPython version 2.4 or >= 2.5.")
560 560 return orig_mainloop
561 561
562 562 def hijack_gtk():
563 563 """Modifies pyGTK's mainloop with a dummy so user code does not
564 564 block IPython. This function returns the original `gtk.mainloop`
565 565 function that has been hijacked.
566 566 """
567 567 def dummy_mainloop(*args, **kw):
568 568 pass
569 569 import gtk
570 570 if gtk.pygtk_version >= (2,4,0): orig_mainloop = gtk.main
571 571 else: orig_mainloop = gtk.mainloop
572 572 gtk.mainloop = dummy_mainloop
573 573 gtk.main = dummy_mainloop
574 574 return orig_mainloop
575 575
576 576 #-----------------------------------------------------------------------------
577 577 # The IPShell* classes below are the ones meant to be run by external code as
578 578 # IPython instances. Note that unless a specific threading strategy is
579 579 # desired, the factory function start() below should be used instead (it
580 580 # selects the proper threaded class).
581 581
582 582 class IPShellGTK(threading.Thread):
583 583 """Run a gtk mainloop() in a separate thread.
584 584
585 585 Python commands can be passed to the thread where they will be executed.
586 586 This is implemented by periodically checking for passed code using a
587 587 GTK timeout callback."""
588 588
589 589 TIMEOUT = 100 # Millisecond interval between timeouts.
590 590
591 591 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
592 592 debug=1,shell_class=MTInteractiveShell):
593 593
594 594 import gtk
595 595
596 596 self.gtk = gtk
597 597 self.gtk_mainloop = hijack_gtk()
598 598
599 599 # Allows us to use both Tk and GTK.
600 600 self.tk = get_tk()
601 601
602 602 if gtk.pygtk_version >= (2,4,0): mainquit = self.gtk.main_quit
603 603 else: mainquit = self.gtk.mainquit
604 604
605 605 self.IP = make_IPython(argv,user_ns=user_ns,
606 606 user_global_ns=user_global_ns,
607 607 debug=debug,
608 608 shell_class=shell_class,
609 609 on_kill=[mainquit])
610 610
611 611 # HACK: slot for banner in self; it will be passed to the mainloop
612 612 # method only and .run() needs it. The actual value will be set by
613 613 # .mainloop().
614 614 self._banner = None
615 615
616 616 threading.Thread.__init__(self)
617 617
618 618 def run(self):
619 619 self.IP.mainloop(self._banner)
620 620 self.IP.kill()
621 621
622 622 def mainloop(self,sys_exit=0,banner=None):
623 623
624 624 self._banner = banner
625 625
626 626 if self.gtk.pygtk_version >= (2,4,0):
627 627 import gobject
628 628 gobject.timeout_add(self.TIMEOUT, self.on_timer)
629 629 else:
630 630 self.gtk.timeout_add(self.TIMEOUT, self.on_timer)
631 631
632 632 if sys.platform != 'win32':
633 633 try:
634 634 if self.gtk.gtk_version[0] >= 2:
635 635 self.gtk.threads_init()
636 636 except AttributeError:
637 637 pass
638 638 except RuntimeError:
639 639 error('Your pyGTK likely has not been compiled with '
640 640 'threading support.\n'
641 641 'The exception printout is below.\n'
642 642 'You can either rebuild pyGTK with threads, or '
643 643 'try using \n'
644 644 'matplotlib with a different backend (like Tk or WX).\n'
645 645 'Note that matplotlib will most likely not work in its '
646 646 'current state!')
647 647 self.IP.InteractiveTB()
648 648 self.start()
649 649 self.gtk.threads_enter()
650 650 self.gtk_mainloop()
651 651 self.gtk.threads_leave()
652 652 self.join()
653 653
654 654 def on_timer(self):
655 655 update_tk(self.tk)
656 656 return self.IP.runcode()
657 657
658 658
659 659 class IPShellWX(threading.Thread):
660 660 """Run a wx mainloop() in a separate thread.
661 661
662 662 Python commands can be passed to the thread where they will be executed.
663 663 This is implemented by periodically checking for passed code using a
664 664 GTK timeout callback."""
665 665
666 666 TIMEOUT = 100 # Millisecond interval between timeouts.
667 667
668 668 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
669 669 debug=1,shell_class=MTInteractiveShell):
670 670
671 self.IP = make_IPython(argv,user_ns=user_ns,
672 user_global_ns=user_global_ns,
673 debug=debug,
674 shell_class=shell_class,
675 on_kill=[self.wxexit])
676
677 wantedwxversion=self.IP.rc.wxversion
678 if wantedwxversion!="0":
679 try:
680 import wxversion
681 except ImportError:
682 error('The wxversion module is needed for WX version selection')
683 else:
684 try:
685 wxversion.select(wantedwxversion)
686 except:
687 self.IP.InteractiveTB()
688 error('Requested wxPython version %s could not be loaded' %
689 wantedwxversion)
690
671 691 import wxPython.wx as wx
672 692
673 693 threading.Thread.__init__(self)
674 694 self.wx = wx
675 695 self.wx_mainloop = hijack_wx()
676 696
677 697 # Allows us to use both Tk and GTK.
678 698 self.tk = get_tk()
679 699
680 self.IP = make_IPython(argv,user_ns=user_ns,
681 user_global_ns=user_global_ns,
682 debug=debug,
683 shell_class=shell_class,
684 on_kill=[self.wxexit])
700
685 701 # HACK: slot for banner in self; it will be passed to the mainloop
686 702 # method only and .run() needs it. The actual value will be set by
687 703 # .mainloop().
688 704 self._banner = None
689 705
690 706 self.app = None
691 707
692 708 def wxexit(self, *args):
693 709 if self.app is not None:
694 710 self.app.agent.timer.Stop()
695 711 self.app.ExitMainLoop()
696 712
697 713 def run(self):
698 714 self.IP.mainloop(self._banner)
699 715 self.IP.kill()
700 716
701 717 def mainloop(self,sys_exit=0,banner=None):
702 718
703 719 self._banner = banner
704 720
705 721 self.start()
706 722
707 723 class TimerAgent(self.wx.wxMiniFrame):
708 724 wx = self.wx
709 725 IP = self.IP
710 726 tk = self.tk
711 727 def __init__(self, parent, interval):
712 728 style = self.wx.wxDEFAULT_FRAME_STYLE | self.wx.wxTINY_CAPTION_HORIZ
713 729 self.wx.wxMiniFrame.__init__(self, parent, -1, ' ', pos=(200, 200),
714 730 size=(100, 100),style=style)
715 731 self.Show(False)
716 732 self.interval = interval
717 733 self.timerId = self.wx.wxNewId()
718 734
719 735 def StartWork(self):
720 736 self.timer = self.wx.wxTimer(self, self.timerId)
721 737 self.wx.EVT_TIMER(self, self.timerId, self.OnTimer)
722 738 self.timer.Start(self.interval)
723 739
724 740 def OnTimer(self, event):
725 741 update_tk(self.tk)
726 742 self.IP.runcode()
727 743
728 744 class App(self.wx.wxApp):
729 745 wx = self.wx
730 746 TIMEOUT = self.TIMEOUT
731 747 def OnInit(self):
732 748 'Create the main window and insert the custom frame'
733 749 self.agent = TimerAgent(None, self.TIMEOUT)
734 750 self.agent.Show(self.wx.false)
735 751 self.agent.StartWork()
736 752 return self.wx.true
737 753
738 754 self.app = App(redirect=False)
739 755 self.wx_mainloop(self.app)
740 756 self.join()
741 757
742 758
743 759 class IPShellQt(threading.Thread):
744 760 """Run a Qt event loop in a separate thread.
745 761
746 762 Python commands can be passed to the thread where they will be executed.
747 763 This is implemented by periodically checking for passed code using a
748 764 Qt timer / slot."""
749 765
750 766 TIMEOUT = 100 # Millisecond interval between timeouts.
751 767
752 768 def __init__(self,argv=None,user_ns=None,user_global_ns=None,
753 769 debug=0,shell_class=MTInteractiveShell):
754 770
755 771 import qt
756 772
757 773 class newQApplication:
758 774 def __init__( self ):
759 775 self.QApplication = qt.QApplication
760 776
761 777 def __call__( *args, **kwargs ):
762 778 return qt.qApp
763 779
764 780 def exec_loop( *args, **kwargs ):
765 781 pass
766 782
767 783 def __getattr__( self, name ):
768 784 return getattr( self.QApplication, name )
769 785
770 786 qt.QApplication = newQApplication()
771 787
772 788 # Allows us to use both Tk and QT.
773 789 self.tk = get_tk()
774 790
775 791 self.IP = make_IPython(argv,user_ns=user_ns,
776 792 user_global_ns=user_global_ns,
777 793 debug=debug,
778 794 shell_class=shell_class,
779 795 on_kill=[qt.qApp.exit])
780 796
781 797 # HACK: slot for banner in self; it will be passed to the mainloop
782 798 # method only and .run() needs it. The actual value will be set by
783 799 # .mainloop().
784 800 self._banner = None
785 801
786 802 threading.Thread.__init__(self)
787 803
788 804 def run(self):
789 805 self.IP.mainloop(self._banner)
790 806 self.IP.kill()
791 807
792 808 def mainloop(self,sys_exit=0,banner=None):
793 809
794 810 import qt
795 811
796 812 self._banner = banner
797 813
798 814 if qt.QApplication.startingUp():
799 815 a = qt.QApplication.QApplication(sys.argv)
800 816 self.timer = qt.QTimer()
801 817 qt.QObject.connect( self.timer, qt.SIGNAL( 'timeout()' ), self.on_timer )
802 818
803 819 self.start()
804 820 self.timer.start( self.TIMEOUT, True )
805 821 while True:
806 822 if self.IP._kill: break
807 823 qt.qApp.exec_loop()
808 824 self.join()
809 825
810 826 def on_timer(self):
811 827 update_tk(self.tk)
812 828 result = self.IP.runcode()
813 829 self.timer.start( self.TIMEOUT, True )
814 830 return result
815 831
816 832 # A set of matplotlib public IPython shell classes, for single-threaded
817 833 # (Tk* and FLTK* backends) and multithreaded (GTK* and WX* backends) use.
818 834 class IPShellMatplotlib(IPShell):
819 835 """Subclass IPShell with MatplotlibShell as the internal shell.
820 836
821 837 Single-threaded class, meant for the Tk* and FLTK* backends.
822 838
823 839 Having this on a separate class simplifies the external driver code."""
824 840
825 841 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
826 842 IPShell.__init__(self,argv,user_ns,user_global_ns,debug,
827 843 shell_class=MatplotlibShell)
828 844
829 845 class IPShellMatplotlibGTK(IPShellGTK):
830 846 """Subclass IPShellGTK with MatplotlibMTShell as the internal shell.
831 847
832 848 Multi-threaded class, meant for the GTK* backends."""
833 849
834 850 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
835 851 IPShellGTK.__init__(self,argv,user_ns,user_global_ns,debug,
836 852 shell_class=MatplotlibMTShell)
837 853
838 854 class IPShellMatplotlibWX(IPShellWX):
839 855 """Subclass IPShellWX with MatplotlibMTShell as the internal shell.
840 856
841 857 Multi-threaded class, meant for the WX* backends."""
842 858
843 859 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
844 860 IPShellWX.__init__(self,argv,user_ns,user_global_ns,debug,
845 861 shell_class=MatplotlibMTShell)
846 862
847 863 class IPShellMatplotlibQt(IPShellQt):
848 864 """Subclass IPShellQt with MatplotlibMTShell as the internal shell.
849 865
850 866 Multi-threaded class, meant for the Qt* backends."""
851 867
852 868 def __init__(self,argv=None,user_ns=None,user_global_ns=None,debug=1):
853 869 IPShellQt.__init__(self,argv,user_ns,user_global_ns,debug,
854 870 shell_class=MatplotlibMTShell)
855 871
856 872 #-----------------------------------------------------------------------------
857 873 # Factory functions to actually start the proper thread-aware shell
858 874
859 875 def _matplotlib_shell_class():
860 876 """Factory function to handle shell class selection for matplotlib.
861 877
862 878 The proper shell class to use depends on the matplotlib backend, since
863 879 each backend requires a different threading strategy."""
864 880
865 881 try:
866 882 import matplotlib
867 883 except ImportError:
868 884 error('matplotlib could NOT be imported! Starting normal IPython.')
869 885 sh_class = IPShell
870 886 else:
871 887 backend = matplotlib.rcParams['backend']
872 888 if backend.startswith('GTK'):
873 889 sh_class = IPShellMatplotlibGTK
874 890 elif backend.startswith('WX'):
875 891 sh_class = IPShellMatplotlibWX
876 892 elif backend.startswith('Qt'):
877 893 sh_class = IPShellMatplotlibQt
878 894 else:
879 895 sh_class = IPShellMatplotlib
880 896 #print 'Using %s with the %s backend.' % (sh_class,backend) # dbg
881 897 return sh_class
882 898
883 899 # This is the one which should be called by external code.
884 900 def start():
885 901 """Return a running shell instance, dealing with threading options.
886 902
887 903 This is a factory function which will instantiate the proper IPython shell
888 904 based on the user's threading choice. Such a selector is needed because
889 905 different GUI toolkits require different thread handling details."""
890 906
891 907 global USE_TK
892 908 # Crude sys.argv hack to extract the threading options.
893 909 argv = sys.argv
894 910 if len(argv) > 1:
895 911 if len(argv) > 2:
896 912 arg2 = argv[2]
897 913 if arg2.endswith('-tk'):
898 914 USE_TK = True
899 915 arg1 = argv[1]
900 916 if arg1.endswith('-gthread'):
901 917 shell = IPShellGTK
902 918 elif arg1.endswith( '-qthread' ):
903 919 shell = IPShellQt
904 920 elif arg1.endswith('-wthread'):
905 921 shell = IPShellWX
906 922 elif arg1.endswith('-pylab'):
907 923 shell = _matplotlib_shell_class()
908 924 else:
909 925 shell = IPShell
910 926 else:
911 927 shell = IPShell
912 928 return shell()
913 929
914 930 # Some aliases for backwards compatibility
915 931 IPythonShell = IPShell
916 932 IPythonShellEmbed = IPShellEmbed
917 933 #************************ End of file <Shell.py> ***************************
@@ -1,587 +1,597 b''
1 1 # -*- Mode: Shell-Script -*- Not really, but shows comments correctly
2 # $Id: ipythonrc 990 2006-01-04 06:59:02Z fperez $
2 # $Id: ipythonrc 998 2006-01-09 06:57:40Z fperez $
3 3
4 4 #***************************************************************************
5 5 #
6 6 # Configuration file for IPython -- ipythonrc format
7 7 #
8 8 # The format of this file is simply one of 'key value' lines.
9 9 # Lines containing only whitespace at the beginning and then a # are ignored
10 10 # as comments. But comments can NOT be put on lines with data.
11 11
12 12 # The meaning and use of each key are explained below.
13 13
14 14 #---------------------------------------------------------------------------
15 15 # Section: included files
16 16
17 17 # Put one or more *config* files (with the syntax of this file) you want to
18 18 # include. For keys with a unique value the outermost file has precedence. For
19 19 # keys with multiple values, they all get assembled into a list which then
20 20 # gets loaded by IPython.
21 21
22 22 # In this file, all lists of things should simply be space-separated.
23 23
24 24 # This allows you to build hierarchies of files which recursively load
25 25 # lower-level services. If this is your main ~/.ipython/ipythonrc file, you
26 26 # should only keep here basic things you always want available. Then you can
27 27 # include it in every other special-purpose config file you create.
28 28 include
29 29
30 30 #---------------------------------------------------------------------------
31 31 # Section: startup setup
32 32
33 33 # These are mostly things which parallel a command line option of the same
34 34 # name.
35 35
36 36 # Keys in this section should only appear once. If any key from this section
37 37 # is encountered more than once, the last value remains, all earlier ones get
38 38 # discarded.
39 39
40 40
41 41 # Automatic calling of callable objects. If set to 1 or 2, callable objects
42 42 # are automatically called when invoked at the command line, even if you don't
43 43 # type parentheses. IPython adds the parentheses for you. For example:
44 44
45 45 #In [1]: str 45
46 46 #------> str(45)
47 47 #Out[1]: '45'
48 48
49 49 # IPython reprints your line with '---->' indicating that it added
50 50 # parentheses. While this option is very convenient for interactive use, it
51 51 # may occasionally cause problems with objects which have side-effects if
52 52 # called unexpectedly.
53 53
54 54 # The valid values for autocall are:
55 55
56 56 # autocall 0 -> disabled (you can toggle it at runtime with the %autocall magic)
57 57
58 58 # autocall 1 -> active, but do not apply if there are no arguments on the line.
59 59
60 60 # In this mode, you get:
61 61
62 62 #In [1]: callable
63 63 #Out[1]: <built-in function callable>
64 64
65 65 #In [2]: callable 'hello'
66 66 #------> callable('hello')
67 67 #Out[2]: False
68 68
69 69 # 2 -> Active always. Even if no arguments are present, the callable object
70 70 # is called:
71 71
72 72 #In [4]: callable
73 73 #------> callable()
74 74
75 75 # Note that even with autocall off, you can still use '/' at the start of a
76 76 # line to treat the first argument on the command line as a function and add
77 77 # parentheses to it:
78 78
79 79 #In [8]: /str 43
80 80 #------> str(43)
81 81 #Out[8]: '43'
82 82
83 83 autocall 1
84 84
85 85 # Auto-edit syntax errors. When you use the %edit magic in ipython to edit
86 86 # source code (see the 'editor' variable below), it is possible that you save
87 87 # a file with syntax errors in it. If this variable is true, IPython will ask
88 88 # you whether to re-open the editor immediately to correct such an error.
89 89
90 90 autoedit_syntax 1
91 91
92 92 # Auto-indent. IPython can recognize lines ending in ':' and indent the next
93 93 # line, while also un-indenting automatically after 'raise' or 'return'.
94 94
95 95 # This feature uses the readline library, so it will honor your ~/.inputrc
96 96 # configuration (or whatever file your INPUTRC variable points to). Adding
97 97 # the following lines to your .inputrc file can make indent/unindenting more
98 98 # convenient (M-i indents, M-u unindents):
99 99
100 100 # $if Python
101 101 # "\M-i": " "
102 102 # "\M-u": "\d\d\d\d"
103 103 # $endif
104 104
105 105 # The feature is potentially a bit dangerous, because it can cause problems
106 106 # with pasting of indented code (the pasted code gets re-indented on each
107 107 # line). But it's a huge time-saver when working interactively. The magic
108 108 # function @autoindent allows you to toggle it on/off at runtime.
109 109
110 110 autoindent 1
111 111
112 112 # Auto-magic. This gives you access to all the magic functions without having
113 113 # to prepend them with an @ sign. If you define a variable with the same name
114 114 # as a magic function (say who=1), you will need to access the magic function
115 115 # with @ (@who in this example). However, if later you delete your variable
116 116 # (del who), you'll recover the automagic calling form.
117 117
118 118 # Considering that many magic functions provide a lot of shell-like
119 119 # functionality, automagic gives you something close to a full Python+system
120 120 # shell environment (and you can extend it further if you want).
121 121
122 122 automagic 1
123 123
124 124 # Size of the output cache. After this many entries are stored, the cache will
125 125 # get flushed. Depending on the size of your intermediate calculations, you
126 126 # may have memory problems if you make it too big, since keeping things in the
127 127 # cache prevents Python from reclaiming the memory for old results. Experiment
128 128 # with a value that works well for you.
129 129
130 130 # If you choose cache_size 0 IPython will revert to python's regular >>>
131 131 # unnumbered prompt. You will still have _, __ and ___ for your last three
132 132 # results, but that will be it. No dynamic _1, _2, etc. will be created. If
133 133 # you are running on a slow machine or with very limited memory, this may
134 134 # help.
135 135
136 136 cache_size 1000
137 137
138 138 # Classic mode: Setting 'classic 1' you lose many of IPython niceties,
139 139 # but that's your choice! Classic 1 -> same as IPython -classic.
140 140 # Note that this is _not_ the normal python interpreter, it's simply
141 141 # IPython emulating most of the classic interpreter's behavior.
142 142 classic 0
143 143
144 144 # colors - Coloring option for prompts and traceback printouts.
145 145
146 146 # Currently available schemes: NoColor, Linux, LightBG.
147 147
148 148 # This option allows coloring the prompts and traceback printouts. This
149 149 # requires a terminal which can properly handle color escape sequences. If you
150 150 # are having problems with this, use the NoColor scheme (uses no color escapes
151 151 # at all).
152 152
153 153 # The Linux option works well in linux console type environments: dark
154 154 # background with light fonts.
155 155
156 156 # LightBG is similar to Linux but swaps dark/light colors to be more readable
157 157 # in light background terminals.
158 158
159 159 # keep uncommented only the one you want:
160 160 colors Linux
161 161 #colors LightBG
162 162 #colors NoColor
163 163
164 164 ########################
165 165 # Note to Windows users
166 166 #
167 167 # Color and readline support is avaialble to Windows users via Gary Bishop's
168 168 # readline library. You can find Gary's tools at
169 169 # http://sourceforge.net/projects/uncpythontools.
170 170 # Note that his readline module requires in turn the ctypes library, available
171 171 # at http://starship.python.net/crew/theller/ctypes.
172 172 ########################
173 173
174 174 # color_info: IPython can display information about objects via a set of
175 175 # functions, and optionally can use colors for this, syntax highlighting
176 176 # source code and various other elements. This information is passed through a
177 177 # pager (it defaults to 'less' if $PAGER is not set).
178 178
179 179 # If your pager has problems, try to setting it to properly handle escapes
180 180 # (see the less manpage for detail), or disable this option. The magic
181 181 # function @color_info allows you to toggle this interactively for testing.
182 182
183 183 color_info 1
184 184
185 185 # confirm_exit: set to 1 if you want IPython to confirm when you try to exit
186 186 # with an EOF (Control-d in Unix, Control-Z/Enter in Windows). Note that using
187 187 # the magic functions @Exit or @Quit you can force a direct exit, bypassing
188 188 # any confirmation.
189 189
190 190 confirm_exit 1
191 191
192 192 # Use deep_reload() as a substitute for reload() by default. deep_reload() is
193 193 # still available as dreload() and appears as a builtin.
194 194
195 195 deep_reload 0
196 196
197 197 # Which editor to use with the @edit command. If you leave this at 0, IPython
198 198 # will honor your EDITOR environment variable. Since this editor is invoked on
199 199 # the fly by ipython and is meant for editing small code snippets, you may
200 200 # want to use a small, lightweight editor here.
201 201
202 202 # For Emacs users, setting up your Emacs server properly as described in the
203 203 # manual is a good idea. An alternative is to use jed, a very light editor
204 204 # with much of the feel of Emacs (though not as powerful for heavy-duty work).
205 205
206 206 editor 0
207 207
208 208 # log 1 -> same as ipython -log. This automatically logs to ./ipython.log
209 209 log 0
210 210
211 211 # Same as ipython -Logfile YourLogfileName.
212 212 # Don't use with log 1 (use one or the other)
213 213 logfile ''
214 214
215 215 # banner 0 -> same as ipython -nobanner
216 216 banner 1
217 217
218 218 # messages 0 -> same as ipython -nomessages
219 219 messages 1
220 220
221 221 # Automatically call the pdb debugger after every uncaught exception. If you
222 222 # are used to debugging using pdb, this puts you automatically inside of it
223 223 # after any call (either in IPython or in code called by it) which triggers an
224 224 # exception which goes uncaught.
225 225 pdb 0
226 226
227 227 # Enable the pprint module for printing. pprint tends to give a more readable
228 228 # display (than print) for complex nested data structures.
229 229 pprint 1
230 230
231 231 # Prompt strings
232 232
233 233 # Most bash-like escapes can be used to customize IPython's prompts, as well as
234 234 # a few additional ones which are IPython-specific. All valid prompt escapes
235 235 # are described in detail in the Customization section of the IPython HTML/PDF
236 236 # manual.
237 237
238 238 # Use \# to represent the current prompt number, and quote them to protect
239 239 # spaces.
240 240 prompt_in1 'In [\#]: '
241 241
242 242 # \D is replaced by as many dots as there are digits in the
243 243 # current value of \#.
244 244 prompt_in2 ' .\D.: '
245 245
246 246 prompt_out 'Out[\#]: '
247 247
248 248 # Select whether to left-pad the output prompts to match the length of the
249 249 # input ones. This allows you for example to use a simple '>' as an output
250 250 # prompt, and yet have the output line up with the input. If set to false,
251 251 # the output prompts will be unpadded (flush left).
252 252 prompts_pad_left 1
253 253
254 254 # quick 1 -> same as ipython -quick
255 255 quick 0
256 256
257 257 # Use the readline library (1) or not (0). Most users will want this on, but
258 258 # if you experience strange problems with line management (mainly when using
259 259 # IPython inside Emacs buffers) you may try disabling it. Not having it on
260 260 # prevents you from getting command history with the arrow keys, searching and
261 261 # name completion using TAB.
262 262
263 263 readline 1
264 264
265 265 # Screen Length: number of lines of your screen. This is used to control
266 266 # printing of very long strings. Strings longer than this number of lines will
267 267 # be paged with the less command instead of directly printed.
268 268
269 269 # The default value for this is 0, which means IPython will auto-detect your
270 270 # screen size every time it needs to print. If for some reason this isn't
271 271 # working well (it needs curses support), specify it yourself. Otherwise don't
272 272 # change the default.
273 273
274 274 screen_length 0
275 275
276 276 # Prompt separators for input and output.
277 277 # Use \n for newline explicitly, without quotes.
278 278 # Use 0 (like at the cmd line) to turn off a given separator.
279 279
280 280 # The structure of prompt printing is:
281 281 # (SeparateIn)Input....
282 282 # (SeparateOut)Output...
283 283 # (SeparateOut2), # that is, no newline is printed after Out2
284 284 # By choosing these you can organize your output any way you want.
285 285
286 286 separate_in \n
287 287 separate_out 0
288 288 separate_out2 0
289 289
290 290 # 'nosep 1' is a shorthand for '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'.
291 291 # Simply removes all input/output separators, overriding the choices above.
292 292 nosep 0
293 293
294 294 # Wildcard searches - IPython has a system for searching names using
295 295 # shell-like wildcards; type %psearch? for details. This variables sets
296 296 # whether by default such searches should be case sensitive or not. You can
297 297 # always override the default at the system command line or the IPython
298 298 # prompt.
299 299
300 300 wildcards_case_sensitive 1
301 301
302 302 # xmode - Exception reporting mode.
303 303
304 304 # Valid modes: Plain, Context and Verbose.
305 305
306 306 # Plain: similar to python's normal traceback printing.
307 307
308 308 # Context: prints 5 lines of context source code around each line in the
309 309 # traceback.
310 310
311 311 # Verbose: similar to Context, but additionally prints the variables currently
312 312 # visible where the exception happened (shortening their strings if too
313 313 # long). This can potentially be very slow, if you happen to have a huge data
314 314 # structure whose string representation is complex to compute. Your computer
315 315 # may appear to freeze for a while with cpu usage at 100%. If this occurs, you
316 316 # can cancel the traceback with Ctrl-C (maybe hitting it more than once).
317 317
318 318 #xmode Plain
319 319 xmode Context
320 320 #xmode Verbose
321 321
322 322 # multi_line_specials: if true, allow magics, aliases and shell escapes (via
323 323 # !cmd) to be used in multi-line input (like for loops). For example, if you
324 324 # have this active, the following is valid in IPython:
325 325 #
326 326 #In [17]: for i in range(3):
327 327 # ....: mkdir $i
328 328 # ....: !touch $i/hello
329 329 # ....: ls -l $i
330 330
331 331 multi_line_specials 1
332 332
333 # wxversion: request a specific wxPython version (used for -wthread)
334
335 # Set this to the value of wxPython you want to use, but note that this
336 # feature requires you to have the wxversion Python module to work. If you
337 # don't have the wxversion module (try 'import wxversion' at the prompt to
338 # check) or simply want to leave the system to pick up the default, leave this
339 # variable at 0.
340
341 wxversion 0
342
333 343 #---------------------------------------------------------------------------
334 344 # Section: Readline configuration (readline is not available for MS-Windows)
335 345
336 346 # This is done via the following options:
337 347
338 348 # (i) readline_parse_and_bind: this option can appear as many times as you
339 349 # want, each time defining a string to be executed via a
340 350 # readline.parse_and_bind() command. The syntax for valid commands of this
341 351 # kind can be found by reading the documentation for the GNU readline library,
342 352 # as these commands are of the kind which readline accepts in its
343 353 # configuration file.
344 354
345 355 # The TAB key can be used to complete names at the command line in one of two
346 356 # ways: 'complete' and 'menu-complete'. The difference is that 'complete' only
347 357 # completes as much as possible while 'menu-complete' cycles through all
348 358 # possible completions. Leave the one you prefer uncommented.
349 359
350 360 readline_parse_and_bind tab: complete
351 361 #readline_parse_and_bind tab: menu-complete
352 362
353 363 # This binds Control-l to printing the list of all possible completions when
354 364 # there is more than one (what 'complete' does when hitting TAB twice, or at
355 365 # the first TAB if show-all-if-ambiguous is on)
356 366 readline_parse_and_bind "\C-l": possible-completions
357 367
358 368 # This forces readline to automatically print the above list when tab
359 369 # completion is set to 'complete'. You can still get this list manually by
360 370 # using the key bound to 'possible-completions' (Control-l by default) or by
361 371 # hitting TAB twice. Turning this on makes the printing happen at the first
362 372 # TAB.
363 373 readline_parse_and_bind set show-all-if-ambiguous on
364 374
365 375 # If you have TAB set to complete names, you can rebind any key (Control-o by
366 376 # default) to insert a true TAB character.
367 377 readline_parse_and_bind "\C-o": tab-insert
368 378
369 379 # These commands allow you to indent/unindent easily, with the 4-space
370 380 # convention of the Python coding standards. Since IPython's internal
371 381 # auto-indent system also uses 4 spaces, you should not change the number of
372 382 # spaces in the code below.
373 383 readline_parse_and_bind "\M-i": " "
374 384 readline_parse_and_bind "\M-o": "\d\d\d\d"
375 385 readline_parse_and_bind "\M-I": "\d\d\d\d"
376 386
377 387 # Bindings for incremental searches in the history. These searches use the
378 388 # string typed so far on the command line and search anything in the previous
379 389 # input history containing them.
380 390 readline_parse_and_bind "\C-r": reverse-search-history
381 391 readline_parse_and_bind "\C-s": forward-search-history
382 392
383 393 # Bindings for completing the current line in the history of previous
384 394 # commands. This allows you to recall any previous command by typing its first
385 395 # few letters and hitting Control-p, bypassing all intermediate commands which
386 396 # may be in the history (much faster than hitting up-arrow 50 times!)
387 397 readline_parse_and_bind "\C-p": history-search-backward
388 398 readline_parse_and_bind "\C-n": history-search-forward
389 399
390 400 # I also like to have the same functionality on the plain arrow keys. If you'd
391 401 # rather have the arrows use all the history (and not just match what you've
392 402 # typed so far), comment out or delete the next two lines.
393 403 readline_parse_and_bind "\e[A": history-search-backward
394 404 readline_parse_and_bind "\e[B": history-search-forward
395 405
396 406 # These are typically on by default under *nix, but not win32.
397 407 readline_parse_and_bind "\C-k": kill-line
398 408 readline_parse_and_bind "\C-u": unix-line-discard
399 409
400 410 # (ii) readline_remove_delims: a string of characters to be removed from the
401 411 # default word-delimiters list used by readline, so that completions may be
402 412 # performed on strings which contain them.
403 413
404 414 readline_remove_delims -/~
405 415
406 416 # (iii) readline_merge_completions: whether to merge the result of all
407 417 # possible completions or not. If true, IPython will complete filenames,
408 418 # python names and aliases and return all possible completions. If you set it
409 419 # to false, each completer is used at a time, and only if it doesn't return
410 420 # any completions is the next one used.
411 421
412 422 # The default order is: [python_matches, file_matches, alias_matches]
413 423
414 424 readline_merge_completions 1
415 425
416 426 # (iv) readline_omit__names: normally hitting <tab> after a '.' in a name
417 427 # will complete all attributes of an object, including all the special methods
418 428 # whose names start with single or double underscores (like __getitem__ or
419 429 # __class__).
420 430
421 431 # This variable allows you to control this completion behavior:
422 432
423 433 # readline_omit__names 1 -> completion will omit showing any names starting
424 434 # with two __, but it will still show names starting with one _.
425 435
426 436 # readline_omit__names 2 -> completion will omit all names beginning with one
427 437 # _ (which obviously means filtering out the double __ ones).
428 438
429 439 # Even when this option is set, you can still see those names by explicitly
430 440 # typing a _ after the period and hitting <tab>: 'name._<tab>' will always
431 441 # complete attribute names starting with '_'.
432 442
433 443 # This option is off by default so that new users see all attributes of any
434 444 # objects they are dealing with.
435 445
436 446 readline_omit__names 0
437 447
438 448 #---------------------------------------------------------------------------
439 449 # Section: modules to be loaded with 'import ...'
440 450
441 451 # List, separated by spaces, the names of the modules you want to import
442 452
443 453 # Example:
444 454 # import_mod sys os
445 455 # will produce internally the statements
446 456 # import sys
447 457 # import os
448 458
449 459 # Each import is executed in its own try/except block, so if one module
450 460 # fails to load the others will still be ok.
451 461
452 462 import_mod
453 463
454 464 #---------------------------------------------------------------------------
455 465 # Section: modules to import some functions from: 'from ... import ...'
456 466
457 467 # List, one per line, the modules for which you want only to import some
458 468 # functions. Give the module name first and then the name of functions to be
459 469 # imported from that module.
460 470
461 471 # Example:
462 472
463 473 # import_some IPython.genutils timing timings
464 474 # will produce internally the statement
465 475 # from IPython.genutils import timing, timings
466 476
467 477 # timing() and timings() are two IPython utilities for timing the execution of
468 478 # your own functions, which you may find useful. Just commment out the above
469 479 # line if you want to test them.
470 480
471 481 # If you have more than one modules_some line, each gets its own try/except
472 482 # block (like modules, see above).
473 483
474 484 import_some
475 485
476 486 #---------------------------------------------------------------------------
477 487 # Section: modules to import all from : 'from ... import *'
478 488
479 489 # List (same syntax as import_mod above) those modules for which you want to
480 490 # import all functions. Remember, this is a potentially dangerous thing to do,
481 491 # since it is very easy to overwrite names of things you need. Use with
482 492 # caution.
483 493
484 494 # Example:
485 495 # import_all sys os
486 496 # will produce internally the statements
487 497 # from sys import *
488 498 # from os import *
489 499
490 500 # As before, each will be called in a separate try/except block.
491 501
492 502 import_all
493 503
494 504 #---------------------------------------------------------------------------
495 505 # Section: Python code to execute.
496 506
497 507 # Put here code to be explicitly executed (keep it simple!)
498 508 # Put one line of python code per line. All whitespace is removed (this is a
499 509 # feature, not a bug), so don't get fancy building loops here.
500 510 # This is just for quick convenient creation of things you want available.
501 511
502 512 # Example:
503 513 # execute x = 1
504 514 # execute print 'hello world'; y = z = 'a'
505 515 # will produce internally
506 516 # x = 1
507 517 # print 'hello world'; y = z = 'a'
508 518 # and each *line* (not each statement, we don't do python syntax parsing) is
509 519 # executed in its own try/except block.
510 520
511 521 execute
512 522
513 523 # Note for the adventurous: you can use this to define your own names for the
514 524 # magic functions, by playing some namespace tricks:
515 525
516 526 # execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
517 527
518 528 # defines @pf as a new name for @profile.
519 529
520 530 #---------------------------------------------------------------------------
521 531 # Section: Pyhton files to load and execute.
522 532
523 533 # Put here the full names of files you want executed with execfile(file). If
524 534 # you want complicated initialization, just write whatever you want in a
525 535 # regular python file and load it from here.
526 536
527 537 # Filenames defined here (which *must* include the extension) are searched for
528 538 # through all of sys.path. Since IPython adds your .ipython directory to
529 539 # sys.path, they can also be placed in your .ipython dir and will be
530 540 # found. Otherwise (if you want to execute things not in .ipyton nor in
531 541 # sys.path) give a full path (you can use ~, it gets expanded)
532 542
533 543 # Example:
534 544 # execfile file1.py ~/file2.py
535 545 # will generate
536 546 # execfile('file1.py')
537 547 # execfile('_path_to_your_home/file2.py')
538 548
539 549 # As before, each file gets its own try/except block.
540 550
541 551 execfile
542 552
543 553 # If you are feeling adventurous, you can even add functionality to IPython
544 554 # through here. IPython works through a global variable called __ip which
545 555 # exists at the time when these files are read. If you know what you are doing
546 556 # (read the source) you can add functions to __ip in files loaded here.
547 557
548 558 # The file example-magic.py contains a simple but correct example. Try it:
549 559
550 560 # execfile example-magic.py
551 561
552 562 # Look at the examples in IPython/iplib.py for more details on how these magic
553 563 # functions need to process their arguments.
554 564
555 565 #---------------------------------------------------------------------------
556 566 # Section: aliases for system shell commands
557 567
558 568 # Here you can define your own names for system commands. The syntax is
559 569 # similar to that of the builtin @alias function:
560 570
561 571 # alias alias_name command_string
562 572
563 573 # The resulting aliases are auto-generated magic functions (hence usable as
564 574 # @alias_name)
565 575
566 576 # For example:
567 577
568 578 # alias myls ls -la
569 579
570 580 # will define 'myls' as an alias for executing the system command 'ls -la'.
571 581 # This allows you to customize IPython's environment to have the same aliases
572 582 # you are accustomed to from your own shell.
573 583
574 584 # You can also define aliases with parameters using %s specifiers (one per
575 585 # parameter):
576 586
577 587 # alias parts echo first %s second %s
578 588
579 589 # will give you in IPython:
580 590 # >>> @parts A B
581 591 # first A second B
582 592
583 593 # Use one 'alias' statement per alias you wish to define.
584 594
585 595 # alias
586 596
587 597 #************************* end of file <ipythonrc> ************************
@@ -1,64 +1,64 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 One of Python's nicest features is its interactive interpreter. This allows
6 6 very fast testing of ideas without the overhead of creating test files as is
7 7 typical in most programming languages. However, the interpreter supplied with
8 8 the standard Python distribution is fairly primitive (and IDLE isn't really
9 9 much better).
10 10
11 11 IPython tries to:
12 12
13 13 i - provide an efficient environment for interactive work in Python
14 14 programming. It tries to address what we see as shortcomings of the standard
15 15 Python prompt, and adds many features to make interactive work much more
16 16 efficient.
17 17
18 18 ii - offer a flexible framework so that it can be used as the base
19 19 environment for other projects and problems where Python can be the
20 20 underlying language. Specifically scientific environments like Mathematica,
21 21 IDL and Mathcad inspired its design, but similar ideas can be useful in many
22 22 fields. Python is a fabulous language for implementing this kind of system
23 23 (due to its dynamic and introspective features), and with suitable libraries
24 24 entire systems could be built leveraging Python's power.
25 25
26 26 iii - serve as an embeddable, ready to go interpreter for your own programs.
27 27
28 28 IPython requires Python 2.2 or newer.
29 29
30 $Id: __init__.py 775 2005-09-01 20:24:59Z fperez $"""
30 $Id: __init__.py 998 2006-01-09 06:57:40Z fperez $"""
31 31
32 32 #*****************************************************************************
33 33 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
34 34 #
35 35 # Distributed under the terms of the BSD License. The full license is in
36 36 # the file COPYING, distributed as part of this software.
37 37 #*****************************************************************************
38 38
39 39 # Enforce proper version requirements
40 40 import sys
41 if sys.version[0:3] < '2.2':
42 raise ImportError, 'Python Version 2.2 or above is required.'
41 if sys.version[0:3] < '2.3':
42 raise ImportError, 'Python Version 2.3 or above is required.'
43 43
44 44 # Define what gets imported with a 'from IPython import *'
45 45 __all__ = ['deep_reload','genutils','ultraTB','DPyGetOpt','Itpl','hooks',
46 46 'ConfigLoader','OutputTrap','Release','Struct','Shell']
47 47
48 48 # Load __all__ in IPython namespace so that a simple 'import IPython' gives
49 49 # access to them via IPython.<name>
50 50 glob,loc = globals(),locals()
51 51 for name in __all__:
52 52 __import__(name,glob,loc,[])
53 53
54 54 # Release data
55 55 from IPython import Release # do it explicitly so pydoc can see it - pydoc bug
56 56 __author__ = '%s <%s>\n%s <%s>\n%s <%s>' % \
57 57 ( Release.authors['Fernando'] + Release.authors['Janko'] + \
58 58 Release.authors['Nathan'] )
59 59 __license__ = Release.license
60 60 __version__ = Release.version
61 61 __revision__ = Release.revision
62 62
63 63 # Namespace cleanup
64 64 del name,glob,loc
@@ -1,701 +1,703 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 Requires Python 2.1 or better.
6 6
7 7 This file contains the main make_IPython() starter function.
8 8
9 $Id: ipmaker.py 994 2006-01-08 08:29:44Z fperez $"""
9 $Id: ipmaker.py 998 2006-01-09 06:57:40Z fperez $"""
10 10
11 11 #*****************************************************************************
12 12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
13 13 #
14 14 # Distributed under the terms of the BSD License. The full license is in
15 15 # the file COPYING, distributed as part of this software.
16 16 #*****************************************************************************
17 17
18 18 from IPython import Release
19 19 __author__ = '%s <%s>' % Release.authors['Fernando']
20 20 __license__ = Release.license
21 21 __version__ = Release.version
22 22
23 23 credits._Printer__data = """
24 24 Python: %s
25 25
26 26 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
27 27 See http://ipython.scipy.org for more information.""" \
28 28 % credits._Printer__data
29 29
30 30 copyright._Printer__data += """
31 31
32 32 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
33 33 All Rights Reserved."""
34 34
35 35 #****************************************************************************
36 36 # Required modules
37 37
38 38 # From the standard library
39 39 import __main__
40 40 import __builtin__
41 41 import os
42 42 import re
43 43 import sys
44 44 import types
45 45 from pprint import pprint,pformat
46 46
47 47 # Our own
48 48 from IPython import DPyGetOpt
49 49 from IPython.Struct import Struct
50 50 from IPython.OutputTrap import OutputTrap
51 51 from IPython.ConfigLoader import ConfigLoader
52 52 from IPython.iplib import InteractiveShell
53 53 from IPython.usage import cmd_line_usage,interactive_usage
54 54 from IPython.genutils import *
55 55
56 56 #-----------------------------------------------------------------------------
57 57 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
58 58 rc_override=None,shell_class=InteractiveShell,
59 59 embedded=False,**kw):
60 60 """This is a dump of IPython into a single function.
61 61
62 62 Later it will have to be broken up in a sensible manner.
63 63
64 64 Arguments:
65 65
66 66 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
67 67 script name, b/c DPyGetOpt strips the first argument only for the real
68 68 sys.argv.
69 69
70 70 - user_ns: a dict to be used as the user's namespace."""
71 71
72 72 #----------------------------------------------------------------------
73 73 # Defaults and initialization
74 74
75 75 # For developer debugging, deactivates crash handler and uses pdb.
76 76 DEVDEBUG = False
77 77
78 78 if argv is None:
79 79 argv = sys.argv
80 80
81 81 # __IP is the main global that lives throughout and represents the whole
82 82 # application. If the user redefines it, all bets are off as to what
83 83 # happens.
84 84
85 85 # __IP is the name of he global which the caller will have accessible as
86 86 # __IP.name. We set its name via the first parameter passed to
87 87 # InteractiveShell:
88 88
89 89 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
90 90 embedded=embedded,**kw)
91 91
92 92 # Put 'help' in the user namespace
93 93 from site import _Helper
94 94 IP.user_ns['help'] = _Helper()
95 95
96 96
97 97 if DEVDEBUG:
98 98 # For developer debugging only (global flag)
99 99 from IPython import ultraTB
100 100 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
101 101
102 102 IP.BANNER_PARTS = ['Python %s\n'
103 103 'Type "copyright", "credits" or "license" '
104 104 'for more information.\n'
105 105 % (sys.version.split('\n')[0],),
106 106 "IPython %s -- An enhanced Interactive Python."
107 107 % (__version__,),
108 108 """? -> Introduction to IPython's features.
109 109 %magic -> Information about IPython's 'magic' % functions.
110 110 help -> Python's own help system.
111 111 object? -> Details about 'object'. ?object also works, ?? prints more.
112 112 """ ]
113 113
114 114 IP.usage = interactive_usage
115 115
116 116 # Platform-dependent suffix and directory names. We use _ipython instead
117 117 # of .ipython under win32 b/c there's software that breaks with .named
118 118 # directories on that platform.
119 119 if os.name == 'posix':
120 120 rc_suffix = ''
121 121 ipdir_def = '.ipython'
122 122 else:
123 123 rc_suffix = '.ini'
124 124 ipdir_def = '_ipython'
125 125
126 126 # default directory for configuration
127 127 ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR',
128 128 os.path.join(IP.home_dir,ipdir_def)))
129 129
130 130 # we need the directory where IPython itself is installed
131 131 import IPython
132 132 IPython_dir = os.path.dirname(IPython.__file__)
133 133 del IPython
134 134
135 135 #-------------------------------------------------------------------------
136 136 # Command line handling
137 137
138 138 # Valid command line options (uses DPyGetOpt syntax, like Perl's
139 139 # GetOpt::Long)
140 140
141 141 # Any key not listed here gets deleted even if in the file (like session
142 142 # or profile). That's deliberate, to maintain the rc namespace clean.
143 143
144 144 # Each set of options appears twice: under _conv only the names are
145 145 # listed, indicating which type they must be converted to when reading the
146 146 # ipythonrc file. And under DPyGetOpt they are listed with the regular
147 147 # DPyGetOpt syntax (=s,=i,:f,etc).
148 148
149 149 # Make sure there's a space before each end of line (they get auto-joined!)
150 150 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
151 151 'c=s classic|cl color_info! colors=s confirm_exit! '
152 152 'debug! deep_reload! editor=s log|l messages! nosep pdb! '
153 153 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
154 154 'quick screen_length|sl=i prompts_pad_left=i '
155 155 'logfile|lf=s logplay|lp=s profile|p=s '
156 156 'readline! readline_merge_completions! '
157 157 'readline_omit__names! '
158 158 'rcfile=s separate_in|si=s separate_out|so=s '
159 159 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
160 160 'magic_docstrings system_verbose! '
161 161 'multi_line_specials! '
162 'wxversion=s '
162 163 'autoedit_syntax!')
163 164
164 165 # Options that can *only* appear at the cmd line (not in rcfiles).
165 166
166 167 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
167 168 # the 'C-c !' command in emacs automatically appends a -i option at the end.
168 169 cmdline_only = ('help ignore|i ipythondir=s Version upgrade '
169 170 'gthread! qthread! wthread! pylab! tk!')
170 171
171 172 # Build the actual name list to be used by DPyGetOpt
172 173 opts_names = qw(cmdline_opts) + qw(cmdline_only)
173 174
174 175 # Set sensible command line defaults.
175 176 # This should have everything from cmdline_opts and cmdline_only
176 177 opts_def = Struct(autocall = 1,
177 178 autoedit_syntax = 1,
178 179 autoindent=0,
179 180 automagic = 1,
180 181 banner = 1,
181 182 cache_size = 1000,
182 183 c = '',
183 184 classic = 0,
184 185 colors = 'NoColor',
185 186 color_info = 0,
186 187 confirm_exit = 1,
187 188 debug = 0,
188 189 deep_reload = 0,
189 190 editor = '0',
190 191 help = 0,
191 192 ignore = 0,
192 193 ipythondir = ipythondir,
193 194 log = 0,
194 195 logfile = '',
195 196 logplay = '',
196 197 multi_line_specials = 1,
197 198 messages = 1,
198 199 nosep = 0,
199 200 pdb = 0,
200 201 pprint = 0,
201 202 profile = '',
202 203 prompt_in1 = 'In [\\#]: ',
203 204 prompt_in2 = ' .\\D.: ',
204 205 prompt_out = 'Out[\\#]: ',
205 206 prompts_pad_left = 1,
206 207 quick = 0,
207 208 readline = 1,
208 209 readline_merge_completions = 1,
209 210 readline_omit__names = 0,
210 211 rcfile = 'ipythonrc' + rc_suffix,
211 212 screen_length = 0,
212 213 separate_in = '\n',
213 214 separate_out = '\n',
214 215 separate_out2 = '',
215 216 system_verbose = 0,
216 217 gthread = 0,
217 218 qthread = 0,
218 219 wthread = 0,
219 220 pylab = 0,
220 221 tk = 0,
221 222 upgrade = 0,
222 223 Version = 0,
223 224 xmode = 'Verbose',
224 225 wildcards_case_sensitive = 1,
226 wxversion = '0',
225 227 magic_docstrings = 0, # undocumented, for doc generation
226 228 )
227 229
228 230 # Things that will *only* appear in rcfiles (not at the command line).
229 231 # Make sure there's a space before each end of line (they get auto-joined!)
230 232 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
231 233 qw_lol: 'import_some ',
232 234 # for things with embedded whitespace:
233 235 list_strings:'execute alias readline_parse_and_bind ',
234 236 # Regular strings need no conversion:
235 237 None:'readline_remove_delims ',
236 238 }
237 239 # Default values for these
238 240 rc_def = Struct(include = [],
239 241 import_mod = [],
240 242 import_all = [],
241 243 import_some = [[]],
242 244 execute = [],
243 245 execfile = [],
244 246 alias = [],
245 247 readline_parse_and_bind = [],
246 248 readline_remove_delims = '',
247 249 )
248 250
249 251 # Build the type conversion dictionary from the above tables:
250 252 typeconv = rcfile_opts.copy()
251 253 typeconv.update(optstr2types(cmdline_opts))
252 254
253 255 # FIXME: the None key appears in both, put that back together by hand. Ugly!
254 256 typeconv[None] += ' ' + rcfile_opts[None]
255 257
256 258 # Remove quotes at ends of all strings (used to protect spaces)
257 259 typeconv[unquote_ends] = typeconv[None]
258 260 del typeconv[None]
259 261
260 262 # Build the list we'll use to make all config decisions with defaults:
261 263 opts_all = opts_def.copy()
262 264 opts_all.update(rc_def)
263 265
264 266 # Build conflict resolver for recursive loading of config files:
265 267 # - preserve means the outermost file maintains the value, it is not
266 268 # overwritten if an included file has the same key.
267 269 # - add_flip applies + to the two values, so it better make sense to add
268 270 # those types of keys. But it flips them first so that things loaded
269 271 # deeper in the inclusion chain have lower precedence.
270 272 conflict = {'preserve': ' '.join([ typeconv[int],
271 273 typeconv[unquote_ends] ]),
272 274 'add_flip': ' '.join([ typeconv[qwflat],
273 275 typeconv[qw_lol],
274 276 typeconv[list_strings] ])
275 277 }
276 278
277 279 # Now actually process the command line
278 280 getopt = DPyGetOpt.DPyGetOpt()
279 281 getopt.setIgnoreCase(0)
280 282
281 283 getopt.parseConfiguration(opts_names)
282 284
283 285 try:
284 286 getopt.processArguments(argv)
285 287 except:
286 288 print cmd_line_usage
287 289 warn('\nError in Arguments: ' + `sys.exc_value`)
288 290 sys.exit(1)
289 291
290 292 # convert the options dict to a struct for much lighter syntax later
291 293 opts = Struct(getopt.optionValues)
292 294 args = getopt.freeValues
293 295
294 296 # this is the struct (which has default values at this point) with which
295 297 # we make all decisions:
296 298 opts_all.update(opts)
297 299
298 300 # Options that force an immediate exit
299 301 if opts_all.help:
300 302 page(cmd_line_usage)
301 303 sys.exit()
302 304
303 305 if opts_all.Version:
304 306 print __version__
305 307 sys.exit()
306 308
307 309 if opts_all.magic_docstrings:
308 310 IP.magic_magic('-latex')
309 311 sys.exit()
310 312
311 313 # Create user config directory if it doesn't exist. This must be done
312 314 # *after* getting the cmd line options.
313 315 if not os.path.isdir(opts_all.ipythondir):
314 316 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
315 317
316 318 # upgrade user config files while preserving a copy of the originals
317 319 if opts_all.upgrade:
318 320 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
319 321
320 322 # check mutually exclusive options in the *original* command line
321 323 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
322 324 qw('classic profile'),qw('classic rcfile')])
323 325
324 326 #---------------------------------------------------------------------------
325 327 # Log replay
326 328
327 329 # if -logplay, we need to 'become' the other session. That basically means
328 330 # replacing the current command line environment with that of the old
329 331 # session and moving on.
330 332
331 333 # this is needed so that later we know we're in session reload mode, as
332 334 # opts_all will get overwritten:
333 335 load_logplay = 0
334 336
335 337 if opts_all.logplay:
336 338 load_logplay = opts_all.logplay
337 339 opts_debug_save = opts_all.debug
338 340 try:
339 341 logplay = open(opts_all.logplay)
340 342 except IOError:
341 343 if opts_all.debug: IP.InteractiveTB()
342 344 warn('Could not open logplay file '+`opts_all.logplay`)
343 345 # restore state as if nothing had happened and move on, but make
344 346 # sure that later we don't try to actually load the session file
345 347 logplay = None
346 348 load_logplay = 0
347 349 del opts_all.logplay
348 350 else:
349 351 try:
350 352 logplay.readline()
351 353 logplay.readline();
352 354 # this reloads that session's command line
353 355 cmd = logplay.readline()[6:]
354 356 exec cmd
355 357 # restore the true debug flag given so that the process of
356 358 # session loading itself can be monitored.
357 359 opts.debug = opts_debug_save
358 360 # save the logplay flag so later we don't overwrite the log
359 361 opts.logplay = load_logplay
360 362 # now we must update our own structure with defaults
361 363 opts_all.update(opts)
362 364 # now load args
363 365 cmd = logplay.readline()[6:]
364 366 exec cmd
365 367 logplay.close()
366 368 except:
367 369 logplay.close()
368 370 if opts_all.debug: IP.InteractiveTB()
369 371 warn("Logplay file lacking full configuration information.\n"
370 372 "I'll try to read it, but some things may not work.")
371 373
372 374 #-------------------------------------------------------------------------
373 375 # set up output traps: catch all output from files, being run, modules
374 376 # loaded, etc. Then give it to the user in a clean form at the end.
375 377
376 378 msg_out = 'Output messages. '
377 379 msg_err = 'Error messages. '
378 380 msg_sep = '\n'
379 381 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
380 382 msg_err,msg_sep,debug,
381 383 quiet_out=1),
382 384 user_exec = OutputTrap('User File Execution',msg_out,
383 385 msg_err,msg_sep,debug),
384 386 logplay = OutputTrap('Log Loader',msg_out,
385 387 msg_err,msg_sep,debug),
386 388 summary = ''
387 389 )
388 390
389 391 #-------------------------------------------------------------------------
390 392 # Process user ipythonrc-type configuration files
391 393
392 394 # turn on output trapping and log to msg.config
393 395 # remember that with debug on, trapping is actually disabled
394 396 msg.config.trap_all()
395 397
396 398 # look for rcfile in current or default directory
397 399 try:
398 400 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
399 401 except IOError:
400 402 if opts_all.debug: IP.InteractiveTB()
401 403 warn('Configuration file %s not found. Ignoring request.'
402 404 % (opts_all.rcfile) )
403 405
404 406 # 'profiles' are a shorthand notation for config filenames
405 407 if opts_all.profile:
406 408 try:
407 409 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
408 410 + rc_suffix,
409 411 opts_all.ipythondir)
410 412 except IOError:
411 413 if opts_all.debug: IP.InteractiveTB()
412 414 opts.profile = '' # remove profile from options if invalid
413 415 warn('Profile configuration file %s not found. Ignoring request.'
414 416 % (opts_all.profile) )
415 417
416 418 # load the config file
417 419 rcfiledata = None
418 420 if opts_all.quick:
419 421 print 'Launching IPython in quick mode. No config file read.'
420 422 elif opts_all.classic:
421 423 print 'Launching IPython in classic mode. No config file read.'
422 424 elif opts_all.rcfile:
423 425 try:
424 426 cfg_loader = ConfigLoader(conflict)
425 427 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
426 428 'include',opts_all.ipythondir,
427 429 purge = 1,
428 430 unique = conflict['preserve'])
429 431 except:
430 432 IP.InteractiveTB()
431 433 warn('Problems loading configuration file '+
432 434 `opts_all.rcfile`+
433 435 '\nStarting with default -bare bones- configuration.')
434 436 else:
435 437 warn('No valid configuration file found in either currrent directory\n'+
436 438 'or in the IPython config. directory: '+`opts_all.ipythondir`+
437 439 '\nProceeding with internal defaults.')
438 440
439 441 #------------------------------------------------------------------------
440 442 # Set exception handlers in mode requested by user.
441 443 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
442 444 IP.magic_xmode(opts_all.xmode)
443 445 otrap.release_out()
444 446
445 447 #------------------------------------------------------------------------
446 448 # Execute user config
447 449
448 450 # Create a valid config structure with the right precedence order:
449 451 # defaults < rcfile < command line. This needs to be in the instance, so
450 452 # that method calls below that rely on it find it.
451 453 IP.rc = rc_def.copy()
452 454
453 455 # Work with a local alias inside this routine to avoid unnecessary
454 456 # attribute lookups.
455 457 IP_rc = IP.rc
456 458
457 459 IP_rc.update(opts_def)
458 460 if rcfiledata:
459 461 # now we can update
460 462 IP_rc.update(rcfiledata)
461 463 IP_rc.update(opts)
462 464 IP_rc.update(rc_override)
463 465
464 466 # Store the original cmd line for reference:
465 467 IP_rc.opts = opts
466 468 IP_rc.args = args
467 469
468 470 # create a *runtime* Struct like rc for holding parameters which may be
469 471 # created and/or modified by runtime user extensions.
470 472 IP.runtime_rc = Struct()
471 473
472 474 # from this point on, all config should be handled through IP_rc,
473 475 # opts* shouldn't be used anymore.
474 476
475 477 # add personal .ipython dir to sys.path so that users can put things in
476 478 # there for customization
477 479 sys.path.append(IP_rc.ipythondir)
478 480 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
479 481
480 482 # update IP_rc with some special things that need manual
481 483 # tweaks. Basically options which affect other options. I guess this
482 484 # should just be written so that options are fully orthogonal and we
483 485 # wouldn't worry about this stuff!
484 486
485 487 if IP_rc.classic:
486 488 IP_rc.quick = 1
487 489 IP_rc.cache_size = 0
488 490 IP_rc.pprint = 0
489 491 IP_rc.prompt_in1 = '>>> '
490 492 IP_rc.prompt_in2 = '... '
491 493 IP_rc.prompt_out = ''
492 494 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
493 495 IP_rc.colors = 'NoColor'
494 496 IP_rc.xmode = 'Plain'
495 497
496 498 # configure readline
497 499 # Define the history file for saving commands in between sessions
498 500 if IP_rc.profile:
499 501 histfname = 'history-%s' % IP_rc.profile
500 502 else:
501 503 histfname = 'history'
502 504 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
503 505
504 506 # update exception handlers with rc file status
505 507 otrap.trap_out() # I don't want these messages ever.
506 508 IP.magic_xmode(IP_rc.xmode)
507 509 otrap.release_out()
508 510
509 511 # activate logging if requested and not reloading a log
510 512 if IP_rc.logplay:
511 513 IP.magic_logstart(IP_rc.logplay + ' append')
512 514 elif IP_rc.logfile:
513 515 IP.magic_logstart(IP_rc.logfile)
514 516 elif IP_rc.log:
515 517 IP.magic_logstart()
516 518
517 519 # find user editor so that it we don't have to look it up constantly
518 520 if IP_rc.editor.strip()=='0':
519 521 try:
520 522 ed = os.environ['EDITOR']
521 523 except KeyError:
522 524 if os.name == 'posix':
523 525 ed = 'vi' # the only one guaranteed to be there!
524 526 else:
525 527 ed = 'notepad' # same in Windows!
526 528 IP_rc.editor = ed
527 529
528 530 # Keep track of whether this is an embedded instance or not (useful for
529 531 # post-mortems).
530 532 IP_rc.embedded = IP.embedded
531 533
532 534 # Recursive reload
533 535 try:
534 536 from IPython import deep_reload
535 537 if IP_rc.deep_reload:
536 538 __builtin__.reload = deep_reload.reload
537 539 else:
538 540 __builtin__.dreload = deep_reload.reload
539 541 del deep_reload
540 542 except ImportError:
541 543 pass
542 544
543 545 # Save the current state of our namespace so that the interactive shell
544 546 # can later know which variables have been created by us from config files
545 547 # and loading. This way, loading a file (in any way) is treated just like
546 548 # defining things on the command line, and %who works as expected.
547 549
548 550 # DON'T do anything that affects the namespace beyond this point!
549 551 IP.internal_ns.update(__main__.__dict__)
550 552
551 553 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
552 554
553 555 # Now run through the different sections of the users's config
554 556 if IP_rc.debug:
555 557 print 'Trying to execute the following configuration structure:'
556 558 print '(Things listed first are deeper in the inclusion tree and get'
557 559 print 'loaded first).\n'
558 560 pprint(IP_rc.__dict__)
559 561
560 562 for mod in IP_rc.import_mod:
561 563 try:
562 564 exec 'import '+mod in IP.user_ns
563 565 except :
564 566 IP.InteractiveTB()
565 567 import_fail_info(mod)
566 568
567 569 for mod_fn in IP_rc.import_some:
568 570 if mod_fn == []: break
569 571 mod,fn = mod_fn[0],','.join(mod_fn[1:])
570 572 try:
571 573 exec 'from '+mod+' import '+fn in IP.user_ns
572 574 except :
573 575 IP.InteractiveTB()
574 576 import_fail_info(mod,fn)
575 577
576 578 for mod in IP_rc.import_all:
577 579 try:
578 580 exec 'from '+mod+' import *' in IP.user_ns
579 581 except :
580 582 IP.InteractiveTB()
581 583 import_fail_info(mod)
582 584
583 585 for code in IP_rc.execute:
584 586 try:
585 587 exec code in IP.user_ns
586 588 except:
587 589 IP.InteractiveTB()
588 590 warn('Failure executing code: ' + `code`)
589 591
590 592 # Execute the files the user wants in ipythonrc
591 593 for file in IP_rc.execfile:
592 594 try:
593 595 file = filefind(file,sys.path+[IPython_dir])
594 596 except IOError:
595 597 warn(itpl('File $file not found. Skipping it.'))
596 598 else:
597 599 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
598 600
599 601 # release stdout and stderr and save config log into a global summary
600 602 msg.config.release_all()
601 603 if IP_rc.messages:
602 604 msg.summary += msg.config.summary_all()
603 605
604 606 #------------------------------------------------------------------------
605 607 # Setup interactive session
606 608
607 609 # Now we should be fully configured. We can then execute files or load
608 610 # things only needed for interactive use. Then we'll open the shell.
609 611
610 612 # Take a snapshot of the user namespace before opening the shell. That way
611 613 # we'll be able to identify which things were interactively defined and
612 614 # which were defined through config files.
613 615 IP.user_config_ns = IP.user_ns.copy()
614 616
615 617 # Force reading a file as if it were a session log. Slower but safer.
616 618 if load_logplay:
617 619 print 'Replaying log...'
618 620 try:
619 621 if IP_rc.debug:
620 622 logplay_quiet = 0
621 623 else:
622 624 logplay_quiet = 1
623 625
624 626 msg.logplay.trap_all()
625 627 IP.safe_execfile(load_logplay,IP.user_ns,
626 628 islog = 1, quiet = logplay_quiet)
627 629 msg.logplay.release_all()
628 630 if IP_rc.messages:
629 631 msg.summary += msg.logplay.summary_all()
630 632 except:
631 633 warn('Problems replaying logfile %s.' % load_logplay)
632 634 IP.InteractiveTB()
633 635
634 636 # Load remaining files in command line
635 637 msg.user_exec.trap_all()
636 638
637 639 # Do NOT execute files named in the command line as scripts to be loaded
638 640 # by embedded instances. Doing so has the potential for an infinite
639 641 # recursion if there are exceptions thrown in the process.
640 642
641 643 # XXX FIXME: the execution of user files should be moved out to after
642 644 # ipython is fully initialized, just as if they were run via %run at the
643 645 # ipython prompt. This would also give them the benefit of ipython's
644 646 # nice tracebacks.
645 647
646 648 if not embedded and IP_rc.args:
647 649 name_save = IP.user_ns['__name__']
648 650 IP.user_ns['__name__'] = '__main__'
649 651 try:
650 652 # Set our own excepthook in case the user code tries to call it
651 653 # directly. This prevents triggering the IPython crash handler.
652 654 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
653 655 for run in args:
654 656 IP.safe_execfile(run,IP.user_ns)
655 657 finally:
656 658 # Reset our crash handler in place
657 659 sys.excepthook = old_excepthook
658 660
659 661 IP.user_ns['__name__'] = name_save
660 662
661 663 msg.user_exec.release_all()
662 664 if IP_rc.messages:
663 665 msg.summary += msg.user_exec.summary_all()
664 666
665 667 # since we can't specify a null string on the cmd line, 0 is the equivalent:
666 668 if IP_rc.nosep:
667 669 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
668 670 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
669 671 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
670 672 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
671 673 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
672 674 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
673 675 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
674 676
675 677 # Determine how many lines at the bottom of the screen are needed for
676 678 # showing prompts, so we can know wheter long strings are to be printed or
677 679 # paged:
678 680 num_lines_bot = IP_rc.separate_in.count('\n')+1
679 681 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
680 682
681 683 # configure startup banner
682 684 if IP_rc.c: # regular python doesn't print the banner with -c
683 685 IP_rc.banner = 0
684 686 if IP_rc.banner:
685 687 BANN_P = IP.BANNER_PARTS
686 688 else:
687 689 BANN_P = []
688 690
689 691 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
690 692
691 693 # add message log (possibly empty)
692 694 if msg.summary: BANN_P.append(msg.summary)
693 695 # Final banner is a string
694 696 IP.BANNER = '\n'.join(BANN_P)
695 697
696 698 # Finalize the IPython instance. This assumes the rc structure is fully
697 699 # in place.
698 700 IP.post_config_initialization()
699 701
700 702 return IP
701 703 #************************ end of file <ipmaker.py> **************************
@@ -1,589 +1,599 b''
1 1 # -*- coding: utf-8 -*-
2 2 #*****************************************************************************
3 3 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
4 4 #
5 5 # Distributed under the terms of the BSD License. The full license is in
6 6 # the file COPYING, distributed as part of this software.
7 7 #*****************************************************************************
8 8
9 # $Id: usage.py 990 2006-01-04 06:59:02Z fperez $
9 # $Id: usage.py 998 2006-01-09 06:57:40Z fperez $
10 10
11 11 from IPython import Release
12 12 __author__ = '%s <%s>' % Release.authors['Fernando']
13 13 __license__ = Release.license
14 14 __version__ = Release.version
15 15
16 16 __doc__ = """
17 17 IPython -- An enhanced Interactive Python
18 18 =========================================
19 19
20 20 A Python shell with automatic history (input and output), dynamic object
21 21 introspection, easier configuration, command completion, access to the system
22 22 shell and more.
23 23
24 24 IPython can also be embedded in running programs. See EMBEDDING below.
25 25
26 26
27 27 USAGE
28 28 ipython [options] files
29 29
30 30 If invoked with no options, it executes all the files listed in
31 31 sequence and drops you into the interpreter while still acknowledging
32 32 any options you may have set in your ipythonrc file. This behavior is
33 33 different from standard Python, which when called as python -i will
34 34 only execute one file and will ignore your configuration setup.
35 35
36 36 Please note that some of the configuration options are not available at
37 37 the command line, simply because they are not practical here. Look into
38 38 your ipythonrc configuration file for details on those. This file
39 39 typically installed in the $HOME/.ipython directory.
40 40
41 41 For Windows users, $HOME resolves to C:\\Documents and
42 42 Settings\\YourUserName in most instances, and _ipython is used instead
43 43 of .ipython, since some Win32 programs have problems with dotted names
44 44 in directories.
45 45
46 46 In the rest of this text, we will refer to this directory as
47 47 IPYTHONDIR.
48 48
49 49
50 50 SPECIAL THREADING OPTIONS
51 51 The following special options are ONLY valid at the beginning of the
52 52 command line, and not later. This is because they control the initial-
53 53 ization of ipython itself, before the normal option-handling mechanism
54 54 is active.
55 55
56 56 -gthread, -qthread, -wthread, -pylab
57 57
58 58 Only ONE of these can be given, and it can only be given as the
59 59 first option passed to IPython (it will have no effect in any
60 60 other position). They provide threading support for the GTK, QT
61 61 and WXWidgets toolkits, and for the matplotlib library.
62 62
63 63 With any of the first three options, IPython starts running a
64 64 separate thread for the graphical toolkit's operation, so that
65 65 you can open and control graphical elements from within an
66 66 IPython command line, without blocking. All three provide
67 67 essentially the same functionality, respectively for GTK, QT and
68 68 WXWidgets (via their Python interfaces).
69 69
70 Note that with -wthread, you can additionally use the -wxversion
71 option to request a specific version of wx to be used. This
72 requires that you have the 'wxversion' Python module installed,
73 which is part of recent wxPython distributions.
74
70 75 If -pylab is given, IPython loads special support for the mat-
71 76 plotlib library (http://matplotlib.sourceforge.net), allowing
72 77 interactive usage of any of its backends as defined in the
73 78 user's .matplotlibrc file. It automatically activates GTK, QT
74 79 or WX threading for IPyhton if the choice of matplotlib backend
75 80 requires it. It also modifies the %run command to correctly
76 81 execute (without blocking) any matplotlib-based script which
77 82 calls show() at the end.
78 83
79 84 -tk The -g/q/wthread options, and -pylab (if matplotlib is
80 85 configured to use GTK, QT or WX), will normally block Tk
81 86 graphical interfaces. This means that when GTK, QT or WX
82 87 threading is active, any attempt to open a Tk GUI will result in
83 88 a dead window, and possibly cause the Python interpreter to
84 89 crash. An extra option, -tk, is available to address this
85 90 issue. It can ONLY be given as a SECOND option after any of the
86 91 above (-gthread, -qthread, -wthread or -pylab).
87 92
88 93 If -tk is given, IPython will try to coordinate Tk threading
89 94 with GTK, QT or WX. This is however potentially unreliable, and
90 95 you will have to test on your platform and Python configuration
91 96 to determine whether it works for you. Debian users have
92 97 reported success, apparently due to the fact that Debian builds
93 98 all of Tcl, Tk, Tkinter and Python with pthreads support. Under
94 99 other Linux environments (such as Fedora Core 2/3), this option
95 100 has caused random crashes and lockups of the Python interpreter.
96 101 Under other operating systems (Mac OSX and Windows), you'll need
97 102 to try it to find out, since currently no user reports are
98 103 available.
99 104
100 105 There is unfortunately no way for IPython to determine at run-
101 106 time whether -tk will work reliably or not, so you will need to
102 107 do some experiments before relying on it for regular work.
103 108
104 109 A WARNING ABOUT SIGNALS AND THREADS
105 110
106 111 When any of the thread systems (GTK, QT or WX) are active, either
107 112 directly or via -pylab with a threaded backend, it is impossible to
108 113 interrupt long-running Python code via Ctrl-C. IPython can not pass
109 114 the KeyboardInterrupt exception (or the underlying SIGINT) across
110 115 threads, so any long-running process started from IPython will run to
111 116 completion, or will have to be killed via an external (OS-based)
112 117 mechanism.
113 118
114 119 To the best of my knowledge, this limitation is imposed by the Python
115 120 interpreter itself, and it comes from the difficulty of writing
116 121 portable signal/threaded code. If any user is an expert on this topic
117 122 and can suggest a better solution, I would love to hear about it. In
118 123 the IPython sources, look at the Shell.py module, and in particular at
119 124 the runcode() method.
120 125
121 126 REGULAR OPTIONS
122 127 After the above threading options have been given, regular options can
123 128 follow in any order. All options can be abbreviated to their shortest
124 129 non-ambiguous form and are case-sensitive. One or two dashes can be
125 130 used. Some options have an alternate short form, indicated after a |.
126 131
127 132 Most options can also be set from your ipythonrc configuration file.
128 133 See the provided examples for assistance. Options given on the comman-
129 134 dline override the values set in the ipythonrc file.
130 135
131 136 All options with a [no] prepended can be specified in negated form
132 137 (using -nooption instead of -option) to turn the feature off.
133 138
134 139 -h, --help
135 140 Show summary of options.
136 141
137 142 -pylab This can only be given as the first option passed to IPython (it
138 143 will have no effect in any other position). It adds special sup-
139 144 port for the matplotlib library (http://matplotlib.source-
140 145 forge.net), allowing interactive usage of any of its backends as
141 146 defined in the user’s .matplotlibrc file. It automatically
142 147 activates GTK or WX threading for IPyhton if the choice of mat-
143 148 plotlib backend requires it. It also modifies the @run command
144 149 to correctly execute (without blocking) any matplotlib-based
145 150 script which calls show() at the end.
146 151
147 152 -autocall <val>
148 153 Make IPython automatically call any callable object even if you
149 154 didn't type explicit parentheses. For example, 'str 43' becomes
150 155 'str(43)' automatically. The value can be '0' to disable the
151 156 feature, '1' for 'smart' autocall, where it is not applied if
152 157 there are no more arguments on the line, and '2' for 'full'
153 158 autocall, where all callable objects are automatically called
154 159 (even if no arguments are present). The default is '1'.
155 160
156 161 -[no]autoindent
157 162 Turn automatic indentation on/off.
158 163
159 164 -[no]automagic
160 165 Make magic commands automatic (without needing their first char-
161 166 acter to be %). Type %magic at the IPython prompt for more
162 167 information.
163 168
164 169 -[no]autoedit_syntax
165 170 When a syntax error occurs after editing a file, automatically
166 171 open the file to the trouble causing line for convenient fixing.
167 172
168 173 -[no]banner
169 174 Print the intial information banner (default on).
170 175
171 176 -c <command>
172 177 Execute the given command string, and set sys.argv to [’c’].
173 178 This is similar to the -c option in the normal Python inter-
174 179 preter.
175 180
176 181 -cache_size|cs <n>
177 182 Size of the output cache (maximum number of entries to hold in
178 183 memory). The default is 1000, you can change it permanently in
179 184 your config file. Setting it to 0 completely disables the
180 185 caching system, and the minimum value accepted is 20 (if you
181 186 provide a value less than 20, it is reset to 0 and a warning is
182 187 issued). This limit is defined because otherwise you’ll spend
183 188 more time re-flushing a too small cache than working.
184 189
185 190 -classic|cl
186 191 Gives IPython a similar feel to the classic Python prompt.
187 192
188 193 -colors <scheme>
189 194 Color scheme for prompts and exception reporting. Currently
190 195 implemented: NoColor, Linux, and LightBG.
191 196
192 197 -[no]color_info
193 198 IPython can display information about objects via a set of func-
194 199 tions, and optionally can use colors for this, syntax highlight-
195 200 ing source code and various other elements. However, because
196 201 this information is passed through a pager (like ’less’) and
197 202 many pagers get confused with color codes, this option is off by
198 203 default. You can test it and turn it on permanently in your
199 204 ipythonrc file if it works for you. As a reference, the ’less’
200 205 pager supplied with Mandrake 8.2 works ok, but that in RedHat
201 206 7.2 doesn’t.
202 207
203 208 Test it and turn it on permanently if it works with your system.
204 209 The magic function @color_info allows you to toggle this inter-
205 210 actively for testing.
206 211
207 212 -[no]confirm_exit
208 213 Set to confirm when you try to exit IPython with an EOF (Con-
209 214 trol-D in Unix, Control-Z/Enter in Windows). Note that using the
210 215 magic functions @Exit or @Quit you can force a direct exit,
211 216 bypassing any confirmation.
212 217
213 218 -[no]debug
214 219 Show information about the loading process. Very useful to pin
215 220 down problems with your configuration files or to get details
216 221 about session restores.
217 222
218 223 -[no]deep_reload
219 224 IPython can use the deep_reload module which reloads changes in
220 225 modules recursively (it replaces the reload() function, so you
221 226 don’t need to change anything to use it). deep_reload() forces a
222 227 full reload of modules whose code may have changed, which the
223 228 default reload() function does not.
224 229
225 230 When deep_reload is off, IPython will use the normal reload(),
226 231 but deep_reload will still be available as dreload(). This fea-
227 232 ture is off by default [which means that you have both normal
228 233 reload() and dreload()].
229 234
230 235 -editor <name>
231 236 Which editor to use with the @edit command. By default, IPython
232 237 will honor your EDITOR environment variable (if not set, vi is
233 238 the Unix default and notepad the Windows one). Since this editor
234 239 is invoked on the fly by IPython and is meant for editing small
235 240 code snippets, you may want to use a small, lightweight editor
236 241 here (in case your default EDITOR is something like Emacs).
237 242
238 243 -ipythondir <name>
239 244 The name of your IPython configuration directory IPYTHONDIR.
240 245 This can also be specified through the environment variable
241 246 IPYTHONDIR.
242 247
243 248 -log|l Generate a log file of all input. The file is named
244 249 ipython_log.py in your current directory (which prevents logs
245 250 from multiple IPython sessions from trampling each other). You
246 251 can use this to later restore a session by loading your logfile
247 252 as a file to be executed with option -logplay (see below).
248 253
249 254 -logfile|lf
250 255 Specify the name of your logfile.
251 256
252 257 -logplay|lp
253 258 Replay a previous log. For restoring a session as close as pos-
254 259 sible to the state you left it in, use this option (don’t just
255 260 run the logfile). With -logplay, IPython will try to reconstruct
256 261 the previous working environment in full, not just execute the
257 262 commands in the logfile.
258 263 When a session is restored, logging is automatically turned on
259 264 again with the name of the logfile it was invoked with (it is
260 265 read from the log header). So once you’ve turned logging on for
261 266 a session, you can quit IPython and reload it as many times as
262 267 you want and it will continue to log its history and restore
263 268 from the beginning every time.
264 269
265 270 Caveats: there are limitations in this option. The history vari-
266 271 ables _i*,_* and _dh don’t get restored properly. In the future
267 272 we will try to implement full session saving by writing and
268 273 retrieving a failed because of inherent limitations of Python’s
269 274 Pickle module, so this may have to wait.
270 275
271 276 -[no]messages
272 277 Print messages which IPython collects about its startup process
273 278 (default on).
274 279
275 280 -[no]pdb
276 281 Automatically call the pdb debugger after every uncaught excep-
277 282 tion. If you are used to debugging using pdb, this puts you
278 283 automatically inside of it after any call (either in IPython or
279 284 in code called by it) which triggers an exception which goes
280 285 uncaught.
281 286
282 287 -[no]pprint
283 288 IPython can optionally use the pprint (pretty printer) module
284 289 for displaying results. pprint tends to give a nicer display of
285 290 nested data structures. If you like it, you can turn it on per-
286 291 manently in your config file (default off).
287 292
288 293 -profile|p <name>
289 294 Assume that your config file is ipythonrc-<name> (looks in cur-
290 295 rent dir first, then in IPYTHONDIR). This is a quick way to keep
291 296 and load multiple config files for different tasks, especially
292 297 if you use the include option of config files. You can keep a
293 298 basic IPYTHONDIR/ipythonrc file and then have other ’profiles’
294 299 which include this one and load extra things for particular
295 300 tasks. For example:
296 301
297 302 1) $HOME/.ipython/ipythonrc : load basic things you always want.
298 303 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-
299 304 related modules.
300 305 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
301 306 plotting modules.
302 307
303 308 Since it is possible to create an endless loop by having circu-
304 309 lar file inclusions, IPython will stop if it reaches 15 recur-
305 310 sive inclusions.
306 311
307 312 -prompt_in1|pi1 <string>
308 313 Specify the string used for input prompts. Note that if you are
309 314 using numbered prompts, the number is represented with a ’\#’ in
310 315 the string. Don’t forget to quote strings with spaces embedded
311 316 in them. Default: ’In [\#]:’.
312 317
313 318 Most bash-like escapes can be used to customize IPython’s
314 319 prompts, as well as a few additional ones which are IPython-spe-
315 320 cific. All valid prompt escapes are described in detail in the
316 321 Customization section of the IPython HTML/PDF manual.
317 322
318 323 -prompt_in2|pi2 <string>
319 324 Similar to the previous option, but used for the continuation
320 325 prompts. The special sequence ’\D’ is similar to ’\#’, but with
321 326 all digits replaced dots (so you can have your continuation
322 327 prompt aligned with your input prompt). Default: ’ .\D.:’
323 328 (note three spaces at the start for alignment with ’In [\#]’).
324 329
325 330 -prompt_out|po <string>
326 331 String used for output prompts, also uses numbers like
327 332 prompt_in1. Default: ’Out[\#]:’.
328 333
329 334 -quick Start in bare bones mode (no config file loaded).
330 335
331 336 -rcfile <name>
332 337 Name of your IPython resource configuration file. normally
333 338 IPython loads ipythonrc (from current directory) or
334 339 IPYTHONDIR/ipythonrc. If the loading of your config file fails,
335 340 IPython starts with a bare bones configuration (no modules
336 341 loaded at all).
337 342
338 343 -[no]readline
339 344 Use the readline library, which is needed to support name com-
340 345 pletion and command history, among other things. It is enabled
341 346 by default, but may cause problems for users of X/Emacs in
342 347 Python comint or shell buffers.
343 348
344 349 Note that emacs ’eterm’ buffers (opened with M-x term) support
345 350 IPython’s readline and syntax coloring fine, only ’emacs’ (M-x
346 351 shell and C-c !) buffers do not.
347 352
348 353 -screen_length|sl <n>
349 354 Number of lines of your screen. This is used to control print-
350 355 ing of very long strings. Strings longer than this number of
351 356 lines will be sent through a pager instead of directly printed.
352 357
353 358 The default value for this is 0, which means IPython will auto-
354 359 detect your screen size every time it needs to print certain
355 360 potentially long strings (this doesn’t change the behavior of
356 361 the ’print’ keyword, it’s only triggered internally). If for
357 362 some reason this isn’t working well (it needs curses support),
358 363 specify it yourself. Otherwise don’t change the default.
359 364
360 365 -separate_in|si <string>
361 366 Separator before input prompts. Default ’0.
362 367
363 368 -separate_out|so <string>
364 369 Separator before output prompts. Default: 0 (nothing).
365 370
366 371 -separate_out2|so2 <string>
367 372 Separator after output prompts. Default: 0 (nothing).
368 373
369 374 -nosep Shorthand for ’-separate_in 0 -separate_out 0 -separate_out2 0’.
370 375 Simply removes all input/output separators.
371 376
372 377 -upgrade
373 378 Allows you to upgrade your IPYTHONDIR configuration when you
374 379 install a new version of IPython. Since new versions may
375 380 include new command lines options or example files, this copies
376 381 updated ipythonrc-type files. However, it backs up (with a .old
377 382 extension) all files which it overwrites so that you can merge
378 383 back any custimizations you might have in your personal files.
379 384
380 385 -Version
381 386 Print version information and exit.
382 387
388 -wxversion <string>
389 Select a specific version of wxPython (used in conjunction with
390 -wthread). Requires the wxversion module, part of recent
391 wxPython distributions.
392
383 393 -xmode <modename>
384 394 Mode for exception reporting. The valid modes are Plain, Con-
385 395 text, and Verbose.
386 396
387 397 - Plain: similar to python’s normal traceback printing.
388 398
389 399 - Context: prints 5 lines of context source code around each
390 400 line in the traceback.
391 401
392 402 - Verbose: similar to Context, but additionally prints the vari-
393 403 ables currently visible where the exception happened (shortening
394 404 their strings if too long). This can potentially be very slow,
395 405 if you happen to have a huge data structure whose string repre-
396 406 sentation is complex to compute. Your computer may appear to
397 407 freeze for a while with cpu usage at 100%. If this occurs, you
398 408 can cancel the traceback with Ctrl-C (maybe hitting it more than
399 409 once).
400 410
401 411
402 412 EMBEDDING
403 413 It is possible to start an IPython instance inside your own Python pro-
404 414 grams. In the documentation example files there are some illustrations
405 415 on how to do this.
406 416
407 417 This feature allows you to evalutate dynamically the state of your
408 418 code, operate with your variables, analyze them, etc. Note however
409 419 that any changes you make to values while in the shell do NOT propagate
410 420 back to the running code, so it is safe to modify your values because
411 421 you won’t break your code in bizarre ways by doing so.
412 422 """
413 423
414 424 cmd_line_usage = __doc__
415 425
416 426 #---------------------------------------------------------------------------
417 427 interactive_usage = """
418 428 IPython -- An enhanced Interactive Python
419 429 =========================================
420 430
421 431 IPython offers a combination of convenient shell features, special commands
422 432 and a history mechanism for both input (command history) and output (results
423 433 caching, similar to Mathematica). It is intended to be a fully compatible
424 434 replacement for the standard Python interpreter, while offering vastly
425 435 improved functionality and flexibility.
426 436
427 437 At your system command line, type 'ipython -help' to see the command line
428 438 options available. This document only describes interactive features.
429 439
430 440 Warning: IPython relies on the existence of a global variable called __IP which
431 441 controls the shell itself. If you redefine __IP to anything, bizarre behavior
432 442 will quickly occur.
433 443
434 444 MAIN FEATURES
435 445
436 446 * Access to the standard Python help. As of Python 2.1, a help system is
437 447 available with access to object docstrings and the Python manuals. Simply
438 448 type 'help' (no quotes) to access it.
439 449
440 450 * Magic commands: type %magic for information on the magic subsystem.
441 451
442 452 * System command aliases, via the %alias command or the ipythonrc config file.
443 453
444 454 * Dynamic object information:
445 455
446 456 Typing ?word or word? prints detailed information about an object. If
447 457 certain strings in the object are too long (docstrings, code, etc.) they get
448 458 snipped in the center for brevity.
449 459
450 460 Typing ??word or word?? gives access to the full information without
451 461 snipping long strings. Long strings are sent to the screen through the less
452 462 pager if longer than the screen, printed otherwise.
453 463
454 464 The ?/?? system gives access to the full source code for any object (if
455 465 available), shows function prototypes and other useful information.
456 466
457 467 If you just want to see an object's docstring, type '%pdoc object' (without
458 468 quotes, and without % if you have automagic on).
459 469
460 470 Both %pdoc and ?/?? give you access to documentation even on things which are
461 471 not explicitely defined. Try for example typing {}.get? or after import os,
462 472 type os.path.abspath??. The magic functions %pdef, %source and %file operate
463 473 similarly.
464 474
465 475 * Completion in the local namespace, by typing TAB at the prompt.
466 476
467 477 At any time, hitting tab will complete any available python commands or
468 478 variable names, and show you a list of the possible completions if there's
469 479 no unambiguous one. It will also complete filenames in the current directory.
470 480
471 481 This feature requires the readline and rlcomplete modules, so it won't work
472 482 if your Python lacks readline support (such as under Windows).
473 483
474 484 * Search previous command history in two ways (also requires readline):
475 485
476 486 - Start typing, and then use Ctrl-p (previous,up) and Ctrl-n (next,down) to
477 487 search through only the history items that match what you've typed so
478 488 far. If you use Ctrl-p/Ctrl-n at a blank prompt, they just behave like
479 489 normal arrow keys.
480 490
481 491 - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches
482 492 your history for lines that match what you've typed so far, completing as
483 493 much as it can.
484 494
485 495 * Persistent command history across sessions (readline required).
486 496
487 497 * Logging of input with the ability to save and restore a working session.
488 498
489 499 * System escape with !. Typing !ls will run 'ls' in the current directory.
490 500
491 501 * The reload command does a 'deep' reload of a module: changes made to the
492 502 module since you imported will actually be available without having to exit.
493 503
494 504 * Verbose and colored exception traceback printouts. See the magic xmode and
495 505 xcolor functions for details (just type %magic).
496 506
497 507 * Input caching system:
498 508
499 509 IPython offers numbered prompts (In/Out) with input and output caching. All
500 510 input is saved and can be retrieved as variables (besides the usual arrow
501 511 key recall).
502 512
503 513 The following GLOBAL variables always exist (so don't overwrite them!):
504 514 _i: stores previous input.
505 515 _ii: next previous.
506 516 _iii: next-next previous.
507 517 _ih : a list of all input _ih[n] is the input from line n.
508 518
509 519 Additionally, global variables named _i<n> are dynamically created (<n>
510 520 being the prompt counter), such that _i<n> == _ih[<n>]
511 521
512 522 For example, what you typed at prompt 14 is available as _i14 and _ih[14].
513 523
514 524 You can create macros which contain multiple input lines from this history,
515 525 for later re-execution, with the %macro function.
516 526
517 527 The history function %hist allows you to see any part of your input history
518 528 by printing a range of the _i variables. Note that inputs which contain
519 529 magic functions (%) appear in the history with a prepended comment. This is
520 530 because they aren't really valid Python code, so you can't exec them.
521 531
522 532 * Output caching system:
523 533
524 534 For output that is returned from actions, a system similar to the input
525 535 cache exists but using _ instead of _i. Only actions that produce a result
526 536 (NOT assignments, for example) are cached. If you are familiar with
527 537 Mathematica, IPython's _ variables behave exactly like Mathematica's %
528 538 variables.
529 539
530 540 The following GLOBAL variables always exist (so don't overwrite them!):
531 541 _ (one underscore): previous output.
532 542 __ (two underscores): next previous.
533 543 ___ (three underscores): next-next previous.
534 544
535 545 Global variables named _<n> are dynamically created (<n> being the prompt
536 546 counter), such that the result of output <n> is always available as _<n>.
537 547
538 548 Finally, a global dictionary named _oh exists with entries for all lines
539 549 which generated output.
540 550
541 551 * Directory history:
542 552
543 553 Your history of visited directories is kept in the global list _dh, and the
544 554 magic %cd command can be used to go to any entry in that list.
545 555
546 556 * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython)
547 557
548 558 1. Auto-parentheses
549 559 Callable objects (i.e. functions, methods, etc) can be invoked like
550 560 this (notice the commas between the arguments):
551 561 >>> callable_ob arg1, arg2, arg3
552 562 and the input will be translated to this:
553 563 --> callable_ob(arg1, arg2, arg3)
554 564 You can force auto-parentheses by using '/' as the first character
555 565 of a line. For example:
556 566 >>> /globals # becomes 'globals()'
557 567 Note that the '/' MUST be the first character on the line! This
558 568 won't work:
559 569 >>> print /globals # syntax error
560 570
561 571 In most cases the automatic algorithm should work, so you should
562 572 rarely need to explicitly invoke /. One notable exception is if you
563 573 are trying to call a function with a list of tuples as arguments (the
564 574 parenthesis will confuse IPython):
565 575 In [1]: zip (1,2,3),(4,5,6) # won't work
566 576 but this will work:
567 577 In [2]: /zip (1,2,3),(4,5,6)
568 578 ------> zip ((1,2,3),(4,5,6))
569 579 Out[2]= [(1, 4), (2, 5), (3, 6)]
570 580
571 581 IPython tells you that it has altered your command line by
572 582 displaying the new command line preceded by -->. e.g.:
573 583 In [18]: callable list
574 584 -------> callable (list)
575 585
576 586 2. Auto-Quoting
577 587 You can force auto-quoting of a function's arguments by using ',' as
578 588 the first character of a line. For example:
579 589 >>> ,my_function /home/me # becomes my_function("/home/me")
580 590
581 591 If you use ';' instead, the whole argument is quoted as a single
582 592 string (while ',' splits on whitespace):
583 593 >>> ,my_function a b c # becomes my_function("a","b","c")
584 594 >>> ;my_function a b c # becomes my_function("a b c")
585 595
586 596 Note that the ',' MUST be the first character on the line! This
587 597 won't work:
588 598 >>> x = ,my_function /home/me # syntax error
589 599 """
@@ -1,4794 +1,4799 b''
1 1 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2 2
3 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
4 version selection (new -wxversion command line and ipythonrc
5 parameter). Patch contributed by Arnd Baecker
6 <arnd.baecker-AT-web.de>.
7
3 8 * IPython/iplib.py (embed_mainloop): fix tab-completion in
4 9 embedded instances, for variables defined at the interactive
5 10 prompt of the embedded ipython. Reported by Arnd.
6 11
7 12 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
8 13 it can be used as a (stateful) toggle, or with a direct parameter.
9 14
10 15 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
11 16 could be triggered in certain cases and cause the traceback
12 17 printer not to work.
13 18
14 19 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
15 20
16 21 * IPython/iplib.py (_should_recompile): Small fix, closes
17 22 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
18 23
19 24 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
20 25
21 26 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
22 27 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
23 28 Moad for help with tracking it down.
24 29
25 30 * IPython/iplib.py (handle_auto): fix autocall handling for
26 31 objects which support BOTH __getitem__ and __call__ (so that f [x]
27 32 is left alone, instead of becoming f([x]) automatically).
28 33
29 34 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
30 35 Ville's patch.
31 36
32 37 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
33 38
34 39 * IPython/iplib.py (handle_auto): changed autocall semantics to
35 40 include 'smart' mode, where the autocall transformation is NOT
36 41 applied if there are no arguments on the line. This allows you to
37 42 just type 'foo' if foo is a callable to see its internal form,
38 43 instead of having it called with no arguments (typically a
39 44 mistake). The old 'full' autocall still exists: for that, you
40 45 need to set the 'autocall' parameter to 2 in your ipythonrc file.
41 46
42 47 * IPython/completer.py (Completer.attr_matches): add
43 48 tab-completion support for Enthoughts' traits. After a report by
44 49 Arnd and a patch by Prabhu.
45 50
46 51 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
47 52
48 53 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
49 54 Schmolck's patch to fix inspect.getinnerframes().
50 55
51 56 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
52 57 for embedded instances, regarding handling of namespaces and items
53 58 added to the __builtin__ one. Multiple embedded instances and
54 59 recursive embeddings should work better now (though I'm not sure
55 60 I've got all the corner cases fixed, that code is a bit of a brain
56 61 twister).
57 62
58 63 * IPython/Magic.py (magic_edit): added support to edit in-memory
59 64 macros (automatically creates the necessary temp files). %edit
60 65 also doesn't return the file contents anymore, it's just noise.
61 66
62 67 * IPython/completer.py (Completer.attr_matches): revert change to
63 68 complete only on attributes listed in __all__. I realized it
64 69 cripples the tab-completion system as a tool for exploring the
65 70 internals of unknown libraries (it renders any non-__all__
66 71 attribute off-limits). I got bit by this when trying to see
67 72 something inside the dis module.
68 73
69 74 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
70 75
71 76 * IPython/iplib.py (InteractiveShell.__init__): add .meta
72 77 namespace for users and extension writers to hold data in. This
73 78 follows the discussion in
74 79 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
75 80
76 81 * IPython/completer.py (IPCompleter.complete): small patch to help
77 82 tab-completion under Emacs, after a suggestion by John Barnard
78 83 <barnarj-AT-ccf.org>.
79 84
80 85 * IPython/Magic.py (Magic.extract_input_slices): added support for
81 86 the slice notation in magics to use N-M to represent numbers N...M
82 87 (closed endpoints). This is used by %macro and %save.
83 88
84 89 * IPython/completer.py (Completer.attr_matches): for modules which
85 90 define __all__, complete only on those. After a patch by Jeffrey
86 91 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
87 92 speed up this routine.
88 93
89 94 * IPython/Logger.py (Logger.log): fix a history handling bug. I
90 95 don't know if this is the end of it, but the behavior now is
91 96 certainly much more correct. Note that coupled with macros,
92 97 slightly surprising (at first) behavior may occur: a macro will in
93 98 general expand to multiple lines of input, so upon exiting, the
94 99 in/out counters will both be bumped by the corresponding amount
95 100 (as if the macro's contents had been typed interactively). Typing
96 101 %hist will reveal the intermediate (silently processed) lines.
97 102
98 103 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
99 104 pickle to fail (%run was overwriting __main__ and not restoring
100 105 it, but pickle relies on __main__ to operate).
101 106
102 107 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
103 108 using properties, but forgot to make the main InteractiveShell
104 109 class a new-style class. Properties fail silently, and
105 110 misteriously, with old-style class (getters work, but
106 111 setters don't do anything).
107 112
108 113 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
109 114
110 115 * IPython/Magic.py (magic_history): fix history reporting bug (I
111 116 know some nasties are still there, I just can't seem to find a
112 117 reproducible test case to track them down; the input history is
113 118 falling out of sync...)
114 119
115 120 * IPython/iplib.py (handle_shell_escape): fix bug where both
116 121 aliases and system accesses where broken for indented code (such
117 122 as loops).
118 123
119 124 * IPython/genutils.py (shell): fix small but critical bug for
120 125 win32 system access.
121 126
122 127 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
123 128
124 129 * IPython/iplib.py (showtraceback): remove use of the
125 130 sys.last_{type/value/traceback} structures, which are non
126 131 thread-safe.
127 132 (_prefilter): change control flow to ensure that we NEVER
128 133 introspect objects when autocall is off. This will guarantee that
129 134 having an input line of the form 'x.y', where access to attribute
130 135 'y' has side effects, doesn't trigger the side effect TWICE. It
131 136 is important to note that, with autocall on, these side effects
132 137 can still happen.
133 138 (ipsystem): new builtin, to complete the ip{magic/alias/system}
134 139 trio. IPython offers these three kinds of special calls which are
135 140 not python code, and it's a good thing to have their call method
136 141 be accessible as pure python functions (not just special syntax at
137 142 the command line). It gives us a better internal implementation
138 143 structure, as well as exposing these for user scripting more
139 144 cleanly.
140 145
141 146 * IPython/macro.py (Macro.__init__): moved macros to a standalone
142 147 file. Now that they'll be more likely to be used with the
143 148 persistance system (%store), I want to make sure their module path
144 149 doesn't change in the future, so that we don't break things for
145 150 users' persisted data.
146 151
147 152 * IPython/iplib.py (autoindent_update): move indentation
148 153 management into the _text_ processing loop, not the keyboard
149 154 interactive one. This is necessary to correctly process non-typed
150 155 multiline input (such as macros).
151 156
152 157 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
153 158 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
154 159 which was producing problems in the resulting manual.
155 160 (magic_whos): improve reporting of instances (show their class,
156 161 instead of simply printing 'instance' which isn't terribly
157 162 informative).
158 163
159 164 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
160 165 (minor mods) to support network shares under win32.
161 166
162 167 * IPython/winconsole.py (get_console_size): add new winconsole
163 168 module and fixes to page_dumb() to improve its behavior under
164 169 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
165 170
166 171 * IPython/Magic.py (Macro): simplified Macro class to just
167 172 subclass list. We've had only 2.2 compatibility for a very long
168 173 time, yet I was still avoiding subclassing the builtin types. No
169 174 more (I'm also starting to use properties, though I won't shift to
170 175 2.3-specific features quite yet).
171 176 (magic_store): added Ville's patch for lightweight variable
172 177 persistence, after a request on the user list by Matt Wilkie
173 178 <maphew-AT-gmail.com>. The new %store magic's docstring has full
174 179 details.
175 180
176 181 * IPython/iplib.py (InteractiveShell.post_config_initialization):
177 182 changed the default logfile name from 'ipython.log' to
178 183 'ipython_log.py'. These logs are real python files, and now that
179 184 we have much better multiline support, people are more likely to
180 185 want to use them as such. Might as well name them correctly.
181 186
182 187 * IPython/Magic.py: substantial cleanup. While we can't stop
183 188 using magics as mixins, due to the existing customizations 'out
184 189 there' which rely on the mixin naming conventions, at least I
185 190 cleaned out all cross-class name usage. So once we are OK with
186 191 breaking compatibility, the two systems can be separated.
187 192
188 193 * IPython/Logger.py: major cleanup. This one is NOT a mixin
189 194 anymore, and the class is a fair bit less hideous as well. New
190 195 features were also introduced: timestamping of input, and logging
191 196 of output results. These are user-visible with the -t and -o
192 197 options to %logstart. Closes
193 198 http://www.scipy.net/roundup/ipython/issue11 and a request by
194 199 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
195 200
196 201 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
197 202
198 203 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
199 204 better hadnle backslashes in paths. See the thread 'More Windows
200 205 questions part 2 - \/ characters revisited' on the iypthon user
201 206 list:
202 207 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
203 208
204 209 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
205 210
206 211 (InteractiveShell.__init__): change threaded shells to not use the
207 212 ipython crash handler. This was causing more problems than not,
208 213 as exceptions in the main thread (GUI code, typically) would
209 214 always show up as a 'crash', when they really weren't.
210 215
211 216 The colors and exception mode commands (%colors/%xmode) have been
212 217 synchronized to also take this into account, so users can get
213 218 verbose exceptions for their threaded code as well. I also added
214 219 support for activating pdb inside this exception handler as well,
215 220 so now GUI authors can use IPython's enhanced pdb at runtime.
216 221
217 222 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
218 223 true by default, and add it to the shipped ipythonrc file. Since
219 224 this asks the user before proceeding, I think it's OK to make it
220 225 true by default.
221 226
222 227 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
223 228 of the previous special-casing of input in the eval loop. I think
224 229 this is cleaner, as they really are commands and shouldn't have
225 230 a special role in the middle of the core code.
226 231
227 232 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
228 233
229 234 * IPython/iplib.py (edit_syntax_error): added support for
230 235 automatically reopening the editor if the file had a syntax error
231 236 in it. Thanks to scottt who provided the patch at:
232 237 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
233 238 version committed).
234 239
235 240 * IPython/iplib.py (handle_normal): add suport for multi-line
236 241 input with emtpy lines. This fixes
237 242 http://www.scipy.net/roundup/ipython/issue43 and a similar
238 243 discussion on the user list.
239 244
240 245 WARNING: a behavior change is necessarily introduced to support
241 246 blank lines: now a single blank line with whitespace does NOT
242 247 break the input loop, which means that when autoindent is on, by
243 248 default hitting return on the next (indented) line does NOT exit.
244 249
245 250 Instead, to exit a multiline input you can either have:
246 251
247 252 - TWO whitespace lines (just hit return again), or
248 253 - a single whitespace line of a different length than provided
249 254 by the autoindent (add or remove a space).
250 255
251 256 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
252 257 module to better organize all readline-related functionality.
253 258 I've deleted FlexCompleter and put all completion clases here.
254 259
255 260 * IPython/iplib.py (raw_input): improve indentation management.
256 261 It is now possible to paste indented code with autoindent on, and
257 262 the code is interpreted correctly (though it still looks bad on
258 263 screen, due to the line-oriented nature of ipython).
259 264 (MagicCompleter.complete): change behavior so that a TAB key on an
260 265 otherwise empty line actually inserts a tab, instead of completing
261 266 on the entire global namespace. This makes it easier to use the
262 267 TAB key for indentation. After a request by Hans Meine
263 268 <hans_meine-AT-gmx.net>
264 269 (_prefilter): add support so that typing plain 'exit' or 'quit'
265 270 does a sensible thing. Originally I tried to deviate as little as
266 271 possible from the default python behavior, but even that one may
267 272 change in this direction (thread on python-dev to that effect).
268 273 Regardless, ipython should do the right thing even if CPython's
269 274 '>>>' prompt doesn't.
270 275 (InteractiveShell): removed subclassing code.InteractiveConsole
271 276 class. By now we'd overridden just about all of its methods: I've
272 277 copied the remaining two over, and now ipython is a standalone
273 278 class. This will provide a clearer picture for the chainsaw
274 279 branch refactoring.
275 280
276 281 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
277 282
278 283 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
279 284 failures for objects which break when dir() is called on them.
280 285
281 286 * IPython/FlexCompleter.py (Completer.__init__): Added support for
282 287 distinct local and global namespaces in the completer API. This
283 288 change allows us top properly handle completion with distinct
284 289 scopes, including in embedded instances (this had never really
285 290 worked correctly).
286 291
287 292 Note: this introduces a change in the constructor for
288 293 MagicCompleter, as a new global_namespace parameter is now the
289 294 second argument (the others were bumped one position).
290 295
291 296 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
292 297
293 298 * IPython/iplib.py (embed_mainloop): fix tab-completion in
294 299 embedded instances (which can be done now thanks to Vivian's
295 300 frame-handling fixes for pdb).
296 301 (InteractiveShell.__init__): Fix namespace handling problem in
297 302 embedded instances. We were overwriting __main__ unconditionally,
298 303 and this should only be done for 'full' (non-embedded) IPython;
299 304 embedded instances must respect the caller's __main__. Thanks to
300 305 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
301 306
302 307 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
303 308
304 309 * setup.py: added download_url to setup(). This registers the
305 310 download address at PyPI, which is not only useful to humans
306 311 browsing the site, but is also picked up by setuptools (the Eggs
307 312 machinery). Thanks to Ville and R. Kern for the info/discussion
308 313 on this.
309 314
310 315 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
311 316
312 317 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
313 318 This brings a lot of nice functionality to the pdb mode, which now
314 319 has tab-completion, syntax highlighting, and better stack handling
315 320 than before. Many thanks to Vivian De Smedt
316 321 <vivian-AT-vdesmedt.com> for the original patches.
317 322
318 323 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
319 324
320 325 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
321 326 sequence to consistently accept the banner argument. The
322 327 inconsistency was tripping SAGE, thanks to Gary Zablackis
323 328 <gzabl-AT-yahoo.com> for the report.
324 329
325 330 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
326 331
327 332 * IPython/iplib.py (InteractiveShell.post_config_initialization):
328 333 Fix bug where a naked 'alias' call in the ipythonrc file would
329 334 cause a crash. Bug reported by Jorgen Stenarson.
330 335
331 336 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
332 337
333 338 * IPython/ipmaker.py (make_IPython): cleanups which should improve
334 339 startup time.
335 340
336 341 * IPython/iplib.py (runcode): my globals 'fix' for embedded
337 342 instances had introduced a bug with globals in normal code. Now
338 343 it's working in all cases.
339 344
340 345 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
341 346 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
342 347 has been introduced to set the default case sensitivity of the
343 348 searches. Users can still select either mode at runtime on a
344 349 per-search basis.
345 350
346 351 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
347 352
348 353 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
349 354 attributes in wildcard searches for subclasses. Modified version
350 355 of a patch by Jorgen.
351 356
352 357 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
353 358
354 359 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
355 360 embedded instances. I added a user_global_ns attribute to the
356 361 InteractiveShell class to handle this.
357 362
358 363 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
359 364
360 365 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
361 366 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
362 367 (reported under win32, but may happen also in other platforms).
363 368 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
364 369
365 370 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
366 371
367 372 * IPython/Magic.py (magic_psearch): new support for wildcard
368 373 patterns. Now, typing ?a*b will list all names which begin with a
369 374 and end in b, for example. The %psearch magic has full
370 375 docstrings. Many thanks to Jörgen Stenarson
371 376 <jorgen.stenarson-AT-bostream.nu>, author of the patches
372 377 implementing this functionality.
373 378
374 379 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
375 380
376 381 * Manual: fixed long-standing annoyance of double-dashes (as in
377 382 --prefix=~, for example) being stripped in the HTML version. This
378 383 is a latex2html bug, but a workaround was provided. Many thanks
379 384 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
380 385 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
381 386 rolling. This seemingly small issue had tripped a number of users
382 387 when first installing, so I'm glad to see it gone.
383 388
384 389 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
385 390
386 391 * IPython/Extensions/numeric_formats.py: fix missing import,
387 392 reported by Stephen Walton.
388 393
389 394 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
390 395
391 396 * IPython/demo.py: finish demo module, fully documented now.
392 397
393 398 * IPython/genutils.py (file_read): simple little utility to read a
394 399 file and ensure it's closed afterwards.
395 400
396 401 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
397 402
398 403 * IPython/demo.py (Demo.__init__): added support for individually
399 404 tagging blocks for automatic execution.
400 405
401 406 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
402 407 syntax-highlighted python sources, requested by John.
403 408
404 409 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
405 410
406 411 * IPython/demo.py (Demo.again): fix bug where again() blocks after
407 412 finishing.
408 413
409 414 * IPython/genutils.py (shlex_split): moved from Magic to here,
410 415 where all 2.2 compatibility stuff lives. I needed it for demo.py.
411 416
412 417 * IPython/demo.py (Demo.__init__): added support for silent
413 418 blocks, improved marks as regexps, docstrings written.
414 419 (Demo.__init__): better docstring, added support for sys.argv.
415 420
416 421 * IPython/genutils.py (marquee): little utility used by the demo
417 422 code, handy in general.
418 423
419 424 * IPython/demo.py (Demo.__init__): new class for interactive
420 425 demos. Not documented yet, I just wrote it in a hurry for
421 426 scipy'05. Will docstring later.
422 427
423 428 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
424 429
425 430 * IPython/Shell.py (sigint_handler): Drastic simplification which
426 431 also seems to make Ctrl-C work correctly across threads! This is
427 432 so simple, that I can't beleive I'd missed it before. Needs more
428 433 testing, though.
429 434 (KBINT): Never mind, revert changes. I'm sure I'd tried something
430 435 like this before...
431 436
432 437 * IPython/genutils.py (get_home_dir): add protection against
433 438 non-dirs in win32 registry.
434 439
435 440 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
436 441 bug where dict was mutated while iterating (pysh crash).
437 442
438 443 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
439 444
440 445 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
441 446 spurious newlines added by this routine. After a report by
442 447 F. Mantegazza.
443 448
444 449 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
445 450
446 451 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
447 452 calls. These were a leftover from the GTK 1.x days, and can cause
448 453 problems in certain cases (after a report by John Hunter).
449 454
450 455 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
451 456 os.getcwd() fails at init time. Thanks to patch from David Remahl
452 457 <chmod007-AT-mac.com>.
453 458 (InteractiveShell.__init__): prevent certain special magics from
454 459 being shadowed by aliases. Closes
455 460 http://www.scipy.net/roundup/ipython/issue41.
456 461
457 462 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
458 463
459 464 * IPython/iplib.py (InteractiveShell.complete): Added new
460 465 top-level completion method to expose the completion mechanism
461 466 beyond readline-based environments.
462 467
463 468 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
464 469
465 470 * tools/ipsvnc (svnversion): fix svnversion capture.
466 471
467 472 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
468 473 attribute to self, which was missing. Before, it was set by a
469 474 routine which in certain cases wasn't being called, so the
470 475 instance could end up missing the attribute. This caused a crash.
471 476 Closes http://www.scipy.net/roundup/ipython/issue40.
472 477
473 478 2005-08-16 Fernando Perez <fperez@colorado.edu>
474 479
475 480 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
476 481 contains non-string attribute. Closes
477 482 http://www.scipy.net/roundup/ipython/issue38.
478 483
479 484 2005-08-14 Fernando Perez <fperez@colorado.edu>
480 485
481 486 * tools/ipsvnc: Minor improvements, to add changeset info.
482 487
483 488 2005-08-12 Fernando Perez <fperez@colorado.edu>
484 489
485 490 * IPython/iplib.py (runsource): remove self.code_to_run_src
486 491 attribute. I realized this is nothing more than
487 492 '\n'.join(self.buffer), and having the same data in two different
488 493 places is just asking for synchronization bugs. This may impact
489 494 people who have custom exception handlers, so I need to warn
490 495 ipython-dev about it (F. Mantegazza may use them).
491 496
492 497 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
493 498
494 499 * IPython/genutils.py: fix 2.2 compatibility (generators)
495 500
496 501 2005-07-18 Fernando Perez <fperez@colorado.edu>
497 502
498 503 * IPython/genutils.py (get_home_dir): fix to help users with
499 504 invalid $HOME under win32.
500 505
501 506 2005-07-17 Fernando Perez <fperez@colorado.edu>
502 507
503 508 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
504 509 some old hacks and clean up a bit other routines; code should be
505 510 simpler and a bit faster.
506 511
507 512 * IPython/iplib.py (interact): removed some last-resort attempts
508 513 to survive broken stdout/stderr. That code was only making it
509 514 harder to abstract out the i/o (necessary for gui integration),
510 515 and the crashes it could prevent were extremely rare in practice
511 516 (besides being fully user-induced in a pretty violent manner).
512 517
513 518 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
514 519 Nothing major yet, but the code is simpler to read; this should
515 520 make it easier to do more serious modifications in the future.
516 521
517 522 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
518 523 which broke in .15 (thanks to a report by Ville).
519 524
520 525 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
521 526 be quite correct, I know next to nothing about unicode). This
522 527 will allow unicode strings to be used in prompts, amongst other
523 528 cases. It also will prevent ipython from crashing when unicode
524 529 shows up unexpectedly in many places. If ascii encoding fails, we
525 530 assume utf_8. Currently the encoding is not a user-visible
526 531 setting, though it could be made so if there is demand for it.
527 532
528 533 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
529 534
530 535 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
531 536
532 537 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
533 538
534 539 * IPython/genutils.py: Add 2.2 compatibility here, so all other
535 540 code can work transparently for 2.2/2.3.
536 541
537 542 2005-07-16 Fernando Perez <fperez@colorado.edu>
538 543
539 544 * IPython/ultraTB.py (ExceptionColors): Make a global variable
540 545 out of the color scheme table used for coloring exception
541 546 tracebacks. This allows user code to add new schemes at runtime.
542 547 This is a minimally modified version of the patch at
543 548 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
544 549 for the contribution.
545 550
546 551 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
547 552 slightly modified version of the patch in
548 553 http://www.scipy.net/roundup/ipython/issue34, which also allows me
549 554 to remove the previous try/except solution (which was costlier).
550 555 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
551 556
552 557 2005-06-08 Fernando Perez <fperez@colorado.edu>
553 558
554 559 * IPython/iplib.py (write/write_err): Add methods to abstract all
555 560 I/O a bit more.
556 561
557 562 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
558 563 warning, reported by Aric Hagberg, fix by JD Hunter.
559 564
560 565 2005-06-02 *** Released version 0.6.15
561 566
562 567 2005-06-01 Fernando Perez <fperez@colorado.edu>
563 568
564 569 * IPython/iplib.py (MagicCompleter.file_matches): Fix
565 570 tab-completion of filenames within open-quoted strings. Note that
566 571 this requires that in ~/.ipython/ipythonrc, users change the
567 572 readline delimiters configuration to read:
568 573
569 574 readline_remove_delims -/~
570 575
571 576
572 577 2005-05-31 *** Released version 0.6.14
573 578
574 579 2005-05-29 Fernando Perez <fperez@colorado.edu>
575 580
576 581 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
577 582 with files not on the filesystem. Reported by Eliyahu Sandler
578 583 <eli@gondolin.net>
579 584
580 585 2005-05-22 Fernando Perez <fperez@colorado.edu>
581 586
582 587 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
583 588 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
584 589
585 590 2005-05-19 Fernando Perez <fperez@colorado.edu>
586 591
587 592 * IPython/iplib.py (safe_execfile): close a file which could be
588 593 left open (causing problems in win32, which locks open files).
589 594 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
590 595
591 596 2005-05-18 Fernando Perez <fperez@colorado.edu>
592 597
593 598 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
594 599 keyword arguments correctly to safe_execfile().
595 600
596 601 2005-05-13 Fernando Perez <fperez@colorado.edu>
597 602
598 603 * ipython.1: Added info about Qt to manpage, and threads warning
599 604 to usage page (invoked with --help).
600 605
601 606 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
602 607 new matcher (it goes at the end of the priority list) to do
603 608 tab-completion on named function arguments. Submitted by George
604 609 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
605 610 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
606 611 for more details.
607 612
608 613 * IPython/Magic.py (magic_run): Added new -e flag to ignore
609 614 SystemExit exceptions in the script being run. Thanks to a report
610 615 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
611 616 producing very annoying behavior when running unit tests.
612 617
613 618 2005-05-12 Fernando Perez <fperez@colorado.edu>
614 619
615 620 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
616 621 which I'd broken (again) due to a changed regexp. In the process,
617 622 added ';' as an escape to auto-quote the whole line without
618 623 splitting its arguments. Thanks to a report by Jerry McRae
619 624 <qrs0xyc02-AT-sneakemail.com>.
620 625
621 626 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
622 627 possible crashes caused by a TokenError. Reported by Ed Schofield
623 628 <schofield-AT-ftw.at>.
624 629
625 630 2005-05-06 Fernando Perez <fperez@colorado.edu>
626 631
627 632 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
628 633
629 634 2005-04-29 Fernando Perez <fperez@colorado.edu>
630 635
631 636 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
632 637 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
633 638 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
634 639 which provides support for Qt interactive usage (similar to the
635 640 existing one for WX and GTK). This had been often requested.
636 641
637 642 2005-04-14 *** Released version 0.6.13
638 643
639 644 2005-04-08 Fernando Perez <fperez@colorado.edu>
640 645
641 646 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
642 647 from _ofind, which gets called on almost every input line. Now,
643 648 we only try to get docstrings if they are actually going to be
644 649 used (the overhead of fetching unnecessary docstrings can be
645 650 noticeable for certain objects, such as Pyro proxies).
646 651
647 652 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
648 653 for completers. For some reason I had been passing them the state
649 654 variable, which completers never actually need, and was in
650 655 conflict with the rlcompleter API. Custom completers ONLY need to
651 656 take the text parameter.
652 657
653 658 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
654 659 work correctly in pysh. I've also moved all the logic which used
655 660 to be in pysh.py here, which will prevent problems with future
656 661 upgrades. However, this time I must warn users to update their
657 662 pysh profile to include the line
658 663
659 664 import_all IPython.Extensions.InterpreterExec
660 665
661 666 because otherwise things won't work for them. They MUST also
662 667 delete pysh.py and the line
663 668
664 669 execfile pysh.py
665 670
666 671 from their ipythonrc-pysh.
667 672
668 673 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
669 674 robust in the face of objects whose dir() returns non-strings
670 675 (which it shouldn't, but some broken libs like ITK do). Thanks to
671 676 a patch by John Hunter (implemented differently, though). Also
672 677 minor improvements by using .extend instead of + on lists.
673 678
674 679 * pysh.py:
675 680
676 681 2005-04-06 Fernando Perez <fperez@colorado.edu>
677 682
678 683 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
679 684 by default, so that all users benefit from it. Those who don't
680 685 want it can still turn it off.
681 686
682 687 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
683 688 config file, I'd forgotten about this, so users were getting it
684 689 off by default.
685 690
686 691 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
687 692 consistency. Now magics can be called in multiline statements,
688 693 and python variables can be expanded in magic calls via $var.
689 694 This makes the magic system behave just like aliases or !system
690 695 calls.
691 696
692 697 2005-03-28 Fernando Perez <fperez@colorado.edu>
693 698
694 699 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
695 700 expensive string additions for building command. Add support for
696 701 trailing ';' when autocall is used.
697 702
698 703 2005-03-26 Fernando Perez <fperez@colorado.edu>
699 704
700 705 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
701 706 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
702 707 ipython.el robust against prompts with any number of spaces
703 708 (including 0) after the ':' character.
704 709
705 710 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
706 711 continuation prompt, which misled users to think the line was
707 712 already indented. Closes debian Bug#300847, reported to me by
708 713 Norbert Tretkowski <tretkowski-AT-inittab.de>.
709 714
710 715 2005-03-23 Fernando Perez <fperez@colorado.edu>
711 716
712 717 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
713 718 properly aligned if they have embedded newlines.
714 719
715 720 * IPython/iplib.py (runlines): Add a public method to expose
716 721 IPython's code execution machinery, so that users can run strings
717 722 as if they had been typed at the prompt interactively.
718 723 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
719 724 methods which can call the system shell, but with python variable
720 725 expansion. The three such methods are: __IPYTHON__.system,
721 726 .getoutput and .getoutputerror. These need to be documented in a
722 727 'public API' section (to be written) of the manual.
723 728
724 729 2005-03-20 Fernando Perez <fperez@colorado.edu>
725 730
726 731 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
727 732 for custom exception handling. This is quite powerful, and it
728 733 allows for user-installable exception handlers which can trap
729 734 custom exceptions at runtime and treat them separately from
730 735 IPython's default mechanisms. At the request of Frédéric
731 736 Mantegazza <mantegazza-AT-ill.fr>.
732 737 (InteractiveShell.set_custom_completer): public API function to
733 738 add new completers at runtime.
734 739
735 740 2005-03-19 Fernando Perez <fperez@colorado.edu>
736 741
737 742 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
738 743 allow objects which provide their docstrings via non-standard
739 744 mechanisms (like Pyro proxies) to still be inspected by ipython's
740 745 ? system.
741 746
742 747 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
743 748 automatic capture system. I tried quite hard to make it work
744 749 reliably, and simply failed. I tried many combinations with the
745 750 subprocess module, but eventually nothing worked in all needed
746 751 cases (not blocking stdin for the child, duplicating stdout
747 752 without blocking, etc). The new %sc/%sx still do capture to these
748 753 magical list/string objects which make shell use much more
749 754 conveninent, so not all is lost.
750 755
751 756 XXX - FIX MANUAL for the change above!
752 757
753 758 (runsource): I copied code.py's runsource() into ipython to modify
754 759 it a bit. Now the code object and source to be executed are
755 760 stored in ipython. This makes this info accessible to third-party
756 761 tools, like custom exception handlers. After a request by Frédéric
757 762 Mantegazza <mantegazza-AT-ill.fr>.
758 763
759 764 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
760 765 history-search via readline (like C-p/C-n). I'd wanted this for a
761 766 long time, but only recently found out how to do it. For users
762 767 who already have their ipythonrc files made and want this, just
763 768 add:
764 769
765 770 readline_parse_and_bind "\e[A": history-search-backward
766 771 readline_parse_and_bind "\e[B": history-search-forward
767 772
768 773 2005-03-18 Fernando Perez <fperez@colorado.edu>
769 774
770 775 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
771 776 LSString and SList classes which allow transparent conversions
772 777 between list mode and whitespace-separated string.
773 778 (magic_r): Fix recursion problem in %r.
774 779
775 780 * IPython/genutils.py (LSString): New class to be used for
776 781 automatic storage of the results of all alias/system calls in _o
777 782 and _e (stdout/err). These provide a .l/.list attribute which
778 783 does automatic splitting on newlines. This means that for most
779 784 uses, you'll never need to do capturing of output with %sc/%sx
780 785 anymore, since ipython keeps this always done for you. Note that
781 786 only the LAST results are stored, the _o/e variables are
782 787 overwritten on each call. If you need to save their contents
783 788 further, simply bind them to any other name.
784 789
785 790 2005-03-17 Fernando Perez <fperez@colorado.edu>
786 791
787 792 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
788 793 prompt namespace handling.
789 794
790 795 2005-03-16 Fernando Perez <fperez@colorado.edu>
791 796
792 797 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
793 798 classic prompts to be '>>> ' (final space was missing, and it
794 799 trips the emacs python mode).
795 800 (BasePrompt.__str__): Added safe support for dynamic prompt
796 801 strings. Now you can set your prompt string to be '$x', and the
797 802 value of x will be printed from your interactive namespace. The
798 803 interpolation syntax includes the full Itpl support, so
799 804 ${foo()+x+bar()} is a valid prompt string now, and the function
800 805 calls will be made at runtime.
801 806
802 807 2005-03-15 Fernando Perez <fperez@colorado.edu>
803 808
804 809 * IPython/Magic.py (magic_history): renamed %hist to %history, to
805 810 avoid name clashes in pylab. %hist still works, it just forwards
806 811 the call to %history.
807 812
808 813 2005-03-02 *** Released version 0.6.12
809 814
810 815 2005-03-02 Fernando Perez <fperez@colorado.edu>
811 816
812 817 * IPython/iplib.py (handle_magic): log magic calls properly as
813 818 ipmagic() function calls.
814 819
815 820 * IPython/Magic.py (magic_time): Improved %time to support
816 821 statements and provide wall-clock as well as CPU time.
817 822
818 823 2005-02-27 Fernando Perez <fperez@colorado.edu>
819 824
820 825 * IPython/hooks.py: New hooks module, to expose user-modifiable
821 826 IPython functionality in a clean manner. For now only the editor
822 827 hook is actually written, and other thigns which I intend to turn
823 828 into proper hooks aren't yet there. The display and prefilter
824 829 stuff, for example, should be hooks. But at least now the
825 830 framework is in place, and the rest can be moved here with more
826 831 time later. IPython had had a .hooks variable for a long time for
827 832 this purpose, but I'd never actually used it for anything.
828 833
829 834 2005-02-26 Fernando Perez <fperez@colorado.edu>
830 835
831 836 * IPython/ipmaker.py (make_IPython): make the default ipython
832 837 directory be called _ipython under win32, to follow more the
833 838 naming peculiarities of that platform (where buggy software like
834 839 Visual Sourcesafe breaks with .named directories). Reported by
835 840 Ville Vainio.
836 841
837 842 2005-02-23 Fernando Perez <fperez@colorado.edu>
838 843
839 844 * IPython/iplib.py (InteractiveShell.__init__): removed a few
840 845 auto_aliases for win32 which were causing problems. Users can
841 846 define the ones they personally like.
842 847
843 848 2005-02-21 Fernando Perez <fperez@colorado.edu>
844 849
845 850 * IPython/Magic.py (magic_time): new magic to time execution of
846 851 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
847 852
848 853 2005-02-19 Fernando Perez <fperez@colorado.edu>
849 854
850 855 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
851 856 into keys (for prompts, for example).
852 857
853 858 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
854 859 prompts in case users want them. This introduces a small behavior
855 860 change: ipython does not automatically add a space to all prompts
856 861 anymore. To get the old prompts with a space, users should add it
857 862 manually to their ipythonrc file, so for example prompt_in1 should
858 863 now read 'In [\#]: ' instead of 'In [\#]:'.
859 864 (BasePrompt.__init__): New option prompts_pad_left (only in rc
860 865 file) to control left-padding of secondary prompts.
861 866
862 867 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
863 868 the profiler can't be imported. Fix for Debian, which removed
864 869 profile.py because of License issues. I applied a slightly
865 870 modified version of the original Debian patch at
866 871 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
867 872
868 873 2005-02-17 Fernando Perez <fperez@colorado.edu>
869 874
870 875 * IPython/genutils.py (native_line_ends): Fix bug which would
871 876 cause improper line-ends under win32 b/c I was not opening files
872 877 in binary mode. Bug report and fix thanks to Ville.
873 878
874 879 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
875 880 trying to catch spurious foo[1] autocalls. My fix actually broke
876 881 ',/' autoquote/call with explicit escape (bad regexp).
877 882
878 883 2005-02-15 *** Released version 0.6.11
879 884
880 885 2005-02-14 Fernando Perez <fperez@colorado.edu>
881 886
882 887 * IPython/background_jobs.py: New background job management
883 888 subsystem. This is implemented via a new set of classes, and
884 889 IPython now provides a builtin 'jobs' object for background job
885 890 execution. A convenience %bg magic serves as a lightweight
886 891 frontend for starting the more common type of calls. This was
887 892 inspired by discussions with B. Granger and the BackgroundCommand
888 893 class described in the book Python Scripting for Computational
889 894 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
890 895 (although ultimately no code from this text was used, as IPython's
891 896 system is a separate implementation).
892 897
893 898 * IPython/iplib.py (MagicCompleter.python_matches): add new option
894 899 to control the completion of single/double underscore names
895 900 separately. As documented in the example ipytonrc file, the
896 901 readline_omit__names variable can now be set to 2, to omit even
897 902 single underscore names. Thanks to a patch by Brian Wong
898 903 <BrianWong-AT-AirgoNetworks.Com>.
899 904 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
900 905 be autocalled as foo([1]) if foo were callable. A problem for
901 906 things which are both callable and implement __getitem__.
902 907 (init_readline): Fix autoindentation for win32. Thanks to a patch
903 908 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
904 909
905 910 2005-02-12 Fernando Perez <fperez@colorado.edu>
906 911
907 912 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
908 913 which I had written long ago to sort out user error messages which
909 914 may occur during startup. This seemed like a good idea initially,
910 915 but it has proven a disaster in retrospect. I don't want to
911 916 change much code for now, so my fix is to set the internal 'debug'
912 917 flag to true everywhere, whose only job was precisely to control
913 918 this subsystem. This closes issue 28 (as well as avoiding all
914 919 sorts of strange hangups which occur from time to time).
915 920
916 921 2005-02-07 Fernando Perez <fperez@colorado.edu>
917 922
918 923 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
919 924 previous call produced a syntax error.
920 925
921 926 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
922 927 classes without constructor.
923 928
924 929 2005-02-06 Fernando Perez <fperez@colorado.edu>
925 930
926 931 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
927 932 completions with the results of each matcher, so we return results
928 933 to the user from all namespaces. This breaks with ipython
929 934 tradition, but I think it's a nicer behavior. Now you get all
930 935 possible completions listed, from all possible namespaces (python,
931 936 filesystem, magics...) After a request by John Hunter
932 937 <jdhunter-AT-nitace.bsd.uchicago.edu>.
933 938
934 939 2005-02-05 Fernando Perez <fperez@colorado.edu>
935 940
936 941 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
937 942 the call had quote characters in it (the quotes were stripped).
938 943
939 944 2005-01-31 Fernando Perez <fperez@colorado.edu>
940 945
941 946 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
942 947 Itpl.itpl() to make the code more robust against psyco
943 948 optimizations.
944 949
945 950 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
946 951 of causing an exception. Quicker, cleaner.
947 952
948 953 2005-01-28 Fernando Perez <fperez@colorado.edu>
949 954
950 955 * scripts/ipython_win_post_install.py (install): hardcode
951 956 sys.prefix+'python.exe' as the executable path. It turns out that
952 957 during the post-installation run, sys.executable resolves to the
953 958 name of the binary installer! I should report this as a distutils
954 959 bug, I think. I updated the .10 release with this tiny fix, to
955 960 avoid annoying the lists further.
956 961
957 962 2005-01-27 *** Released version 0.6.10
958 963
959 964 2005-01-27 Fernando Perez <fperez@colorado.edu>
960 965
961 966 * IPython/numutils.py (norm): Added 'inf' as optional name for
962 967 L-infinity norm, included references to mathworld.com for vector
963 968 norm definitions.
964 969 (amin/amax): added amin/amax for array min/max. Similar to what
965 970 pylab ships with after the recent reorganization of names.
966 971 (spike/spike_odd): removed deprecated spike/spike_odd functions.
967 972
968 973 * ipython.el: committed Alex's recent fixes and improvements.
969 974 Tested with python-mode from CVS, and it looks excellent. Since
970 975 python-mode hasn't released anything in a while, I'm temporarily
971 976 putting a copy of today's CVS (v 4.70) of python-mode in:
972 977 http://ipython.scipy.org/tmp/python-mode.el
973 978
974 979 * scripts/ipython_win_post_install.py (install): Win32 fix to use
975 980 sys.executable for the executable name, instead of assuming it's
976 981 called 'python.exe' (the post-installer would have produced broken
977 982 setups on systems with a differently named python binary).
978 983
979 984 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
980 985 references to os.linesep, to make the code more
981 986 platform-independent. This is also part of the win32 coloring
982 987 fixes.
983 988
984 989 * IPython/genutils.py (page_dumb): Remove attempts to chop long
985 990 lines, which actually cause coloring bugs because the length of
986 991 the line is very difficult to correctly compute with embedded
987 992 escapes. This was the source of all the coloring problems under
988 993 Win32. I think that _finally_, Win32 users have a properly
989 994 working ipython in all respects. This would never have happened
990 995 if not for Gary Bishop and Viktor Ransmayr's great help and work.
991 996
992 997 2005-01-26 *** Released version 0.6.9
993 998
994 999 2005-01-25 Fernando Perez <fperez@colorado.edu>
995 1000
996 1001 * setup.py: finally, we have a true Windows installer, thanks to
997 1002 the excellent work of Viktor Ransmayr
998 1003 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
999 1004 Windows users. The setup routine is quite a bit cleaner thanks to
1000 1005 this, and the post-install script uses the proper functions to
1001 1006 allow a clean de-installation using the standard Windows Control
1002 1007 Panel.
1003 1008
1004 1009 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1005 1010 environment variable under all OSes (including win32) if
1006 1011 available. This will give consistency to win32 users who have set
1007 1012 this variable for any reason. If os.environ['HOME'] fails, the
1008 1013 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1009 1014
1010 1015 2005-01-24 Fernando Perez <fperez@colorado.edu>
1011 1016
1012 1017 * IPython/numutils.py (empty_like): add empty_like(), similar to
1013 1018 zeros_like() but taking advantage of the new empty() Numeric routine.
1014 1019
1015 1020 2005-01-23 *** Released version 0.6.8
1016 1021
1017 1022 2005-01-22 Fernando Perez <fperez@colorado.edu>
1018 1023
1019 1024 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1020 1025 automatic show() calls. After discussing things with JDH, it
1021 1026 turns out there are too many corner cases where this can go wrong.
1022 1027 It's best not to try to be 'too smart', and simply have ipython
1023 1028 reproduce as much as possible the default behavior of a normal
1024 1029 python shell.
1025 1030
1026 1031 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1027 1032 line-splitting regexp and _prefilter() to avoid calling getattr()
1028 1033 on assignments. This closes
1029 1034 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1030 1035 readline uses getattr(), so a simple <TAB> keypress is still
1031 1036 enough to trigger getattr() calls on an object.
1032 1037
1033 1038 2005-01-21 Fernando Perez <fperez@colorado.edu>
1034 1039
1035 1040 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1036 1041 docstring under pylab so it doesn't mask the original.
1037 1042
1038 1043 2005-01-21 *** Released version 0.6.7
1039 1044
1040 1045 2005-01-21 Fernando Perez <fperez@colorado.edu>
1041 1046
1042 1047 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1043 1048 signal handling for win32 users in multithreaded mode.
1044 1049
1045 1050 2005-01-17 Fernando Perez <fperez@colorado.edu>
1046 1051
1047 1052 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1048 1053 instances with no __init__. After a crash report by Norbert Nemec
1049 1054 <Norbert-AT-nemec-online.de>.
1050 1055
1051 1056 2005-01-14 Fernando Perez <fperez@colorado.edu>
1052 1057
1053 1058 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1054 1059 names for verbose exceptions, when multiple dotted names and the
1055 1060 'parent' object were present on the same line.
1056 1061
1057 1062 2005-01-11 Fernando Perez <fperez@colorado.edu>
1058 1063
1059 1064 * IPython/genutils.py (flag_calls): new utility to trap and flag
1060 1065 calls in functions. I need it to clean up matplotlib support.
1061 1066 Also removed some deprecated code in genutils.
1062 1067
1063 1068 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1064 1069 that matplotlib scripts called with %run, which don't call show()
1065 1070 themselves, still have their plotting windows open.
1066 1071
1067 1072 2005-01-05 Fernando Perez <fperez@colorado.edu>
1068 1073
1069 1074 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1070 1075 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1071 1076
1072 1077 2004-12-19 Fernando Perez <fperez@colorado.edu>
1073 1078
1074 1079 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1075 1080 parent_runcode, which was an eyesore. The same result can be
1076 1081 obtained with Python's regular superclass mechanisms.
1077 1082
1078 1083 2004-12-17 Fernando Perez <fperez@colorado.edu>
1079 1084
1080 1085 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1081 1086 reported by Prabhu.
1082 1087 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1083 1088 sys.stderr) instead of explicitly calling sys.stderr. This helps
1084 1089 maintain our I/O abstractions clean, for future GUI embeddings.
1085 1090
1086 1091 * IPython/genutils.py (info): added new utility for sys.stderr
1087 1092 unified info message handling (thin wrapper around warn()).
1088 1093
1089 1094 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1090 1095 composite (dotted) names on verbose exceptions.
1091 1096 (VerboseTB.nullrepr): harden against another kind of errors which
1092 1097 Python's inspect module can trigger, and which were crashing
1093 1098 IPython. Thanks to a report by Marco Lombardi
1094 1099 <mlombard-AT-ma010192.hq.eso.org>.
1095 1100
1096 1101 2004-12-13 *** Released version 0.6.6
1097 1102
1098 1103 2004-12-12 Fernando Perez <fperez@colorado.edu>
1099 1104
1100 1105 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1101 1106 generated by pygtk upon initialization if it was built without
1102 1107 threads (for matplotlib users). After a crash reported by
1103 1108 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1104 1109
1105 1110 * IPython/ipmaker.py (make_IPython): fix small bug in the
1106 1111 import_some parameter for multiple imports.
1107 1112
1108 1113 * IPython/iplib.py (ipmagic): simplified the interface of
1109 1114 ipmagic() to take a single string argument, just as it would be
1110 1115 typed at the IPython cmd line.
1111 1116 (ipalias): Added new ipalias() with an interface identical to
1112 1117 ipmagic(). This completes exposing a pure python interface to the
1113 1118 alias and magic system, which can be used in loops or more complex
1114 1119 code where IPython's automatic line mangling is not active.
1115 1120
1116 1121 * IPython/genutils.py (timing): changed interface of timing to
1117 1122 simply run code once, which is the most common case. timings()
1118 1123 remains unchanged, for the cases where you want multiple runs.
1119 1124
1120 1125 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1121 1126 bug where Python2.2 crashes with exec'ing code which does not end
1122 1127 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1123 1128 before.
1124 1129
1125 1130 2004-12-10 Fernando Perez <fperez@colorado.edu>
1126 1131
1127 1132 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1128 1133 -t to -T, to accomodate the new -t flag in %run (the %run and
1129 1134 %prun options are kind of intermixed, and it's not easy to change
1130 1135 this with the limitations of python's getopt).
1131 1136
1132 1137 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1133 1138 the execution of scripts. It's not as fine-tuned as timeit.py,
1134 1139 but it works from inside ipython (and under 2.2, which lacks
1135 1140 timeit.py). Optionally a number of runs > 1 can be given for
1136 1141 timing very short-running code.
1137 1142
1138 1143 * IPython/genutils.py (uniq_stable): new routine which returns a
1139 1144 list of unique elements in any iterable, but in stable order of
1140 1145 appearance. I needed this for the ultraTB fixes, and it's a handy
1141 1146 utility.
1142 1147
1143 1148 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1144 1149 dotted names in Verbose exceptions. This had been broken since
1145 1150 the very start, now x.y will properly be printed in a Verbose
1146 1151 traceback, instead of x being shown and y appearing always as an
1147 1152 'undefined global'. Getting this to work was a bit tricky,
1148 1153 because by default python tokenizers are stateless. Saved by
1149 1154 python's ability to easily add a bit of state to an arbitrary
1150 1155 function (without needing to build a full-blown callable object).
1151 1156
1152 1157 Also big cleanup of this code, which had horrendous runtime
1153 1158 lookups of zillions of attributes for colorization. Moved all
1154 1159 this code into a few templates, which make it cleaner and quicker.
1155 1160
1156 1161 Printout quality was also improved for Verbose exceptions: one
1157 1162 variable per line, and memory addresses are printed (this can be
1158 1163 quite handy in nasty debugging situations, which is what Verbose
1159 1164 is for).
1160 1165
1161 1166 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1162 1167 the command line as scripts to be loaded by embedded instances.
1163 1168 Doing so has the potential for an infinite recursion if there are
1164 1169 exceptions thrown in the process. This fixes a strange crash
1165 1170 reported by Philippe MULLER <muller-AT-irit.fr>.
1166 1171
1167 1172 2004-12-09 Fernando Perez <fperez@colorado.edu>
1168 1173
1169 1174 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1170 1175 to reflect new names in matplotlib, which now expose the
1171 1176 matlab-compatible interface via a pylab module instead of the
1172 1177 'matlab' name. The new code is backwards compatible, so users of
1173 1178 all matplotlib versions are OK. Patch by J. Hunter.
1174 1179
1175 1180 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1176 1181 of __init__ docstrings for instances (class docstrings are already
1177 1182 automatically printed). Instances with customized docstrings
1178 1183 (indep. of the class) are also recognized and all 3 separate
1179 1184 docstrings are printed (instance, class, constructor). After some
1180 1185 comments/suggestions by J. Hunter.
1181 1186
1182 1187 2004-12-05 Fernando Perez <fperez@colorado.edu>
1183 1188
1184 1189 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1185 1190 warnings when tab-completion fails and triggers an exception.
1186 1191
1187 1192 2004-12-03 Fernando Perez <fperez@colorado.edu>
1188 1193
1189 1194 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1190 1195 be triggered when using 'run -p'. An incorrect option flag was
1191 1196 being set ('d' instead of 'D').
1192 1197 (manpage): fix missing escaped \- sign.
1193 1198
1194 1199 2004-11-30 *** Released version 0.6.5
1195 1200
1196 1201 2004-11-30 Fernando Perez <fperez@colorado.edu>
1197 1202
1198 1203 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1199 1204 setting with -d option.
1200 1205
1201 1206 * setup.py (docfiles): Fix problem where the doc glob I was using
1202 1207 was COMPLETELY BROKEN. It was giving the right files by pure
1203 1208 accident, but failed once I tried to include ipython.el. Note:
1204 1209 glob() does NOT allow you to do exclusion on multiple endings!
1205 1210
1206 1211 2004-11-29 Fernando Perez <fperez@colorado.edu>
1207 1212
1208 1213 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1209 1214 the manpage as the source. Better formatting & consistency.
1210 1215
1211 1216 * IPython/Magic.py (magic_run): Added new -d option, to run
1212 1217 scripts under the control of the python pdb debugger. Note that
1213 1218 this required changing the %prun option -d to -D, to avoid a clash
1214 1219 (since %run must pass options to %prun, and getopt is too dumb to
1215 1220 handle options with string values with embedded spaces). Thanks
1216 1221 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1217 1222 (magic_who_ls): added type matching to %who and %whos, so that one
1218 1223 can filter their output to only include variables of certain
1219 1224 types. Another suggestion by Matthew.
1220 1225 (magic_whos): Added memory summaries in kb and Mb for arrays.
1221 1226 (magic_who): Improve formatting (break lines every 9 vars).
1222 1227
1223 1228 2004-11-28 Fernando Perez <fperez@colorado.edu>
1224 1229
1225 1230 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1226 1231 cache when empty lines were present.
1227 1232
1228 1233 2004-11-24 Fernando Perez <fperez@colorado.edu>
1229 1234
1230 1235 * IPython/usage.py (__doc__): document the re-activated threading
1231 1236 options for WX and GTK.
1232 1237
1233 1238 2004-11-23 Fernando Perez <fperez@colorado.edu>
1234 1239
1235 1240 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1236 1241 the -wthread and -gthread options, along with a new -tk one to try
1237 1242 and coordinate Tk threading with wx/gtk. The tk support is very
1238 1243 platform dependent, since it seems to require Tcl and Tk to be
1239 1244 built with threads (Fedora1/2 appears NOT to have it, but in
1240 1245 Prabhu's Debian boxes it works OK). But even with some Tk
1241 1246 limitations, this is a great improvement.
1242 1247
1243 1248 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1244 1249 info in user prompts. Patch by Prabhu.
1245 1250
1246 1251 2004-11-18 Fernando Perez <fperez@colorado.edu>
1247 1252
1248 1253 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1249 1254 EOFErrors and bail, to avoid infinite loops if a non-terminating
1250 1255 file is fed into ipython. Patch submitted in issue 19 by user,
1251 1256 many thanks.
1252 1257
1253 1258 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1254 1259 autoquote/parens in continuation prompts, which can cause lots of
1255 1260 problems. Closes roundup issue 20.
1256 1261
1257 1262 2004-11-17 Fernando Perez <fperez@colorado.edu>
1258 1263
1259 1264 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1260 1265 reported as debian bug #280505. I'm not sure my local changelog
1261 1266 entry has the proper debian format (Jack?).
1262 1267
1263 1268 2004-11-08 *** Released version 0.6.4
1264 1269
1265 1270 2004-11-08 Fernando Perez <fperez@colorado.edu>
1266 1271
1267 1272 * IPython/iplib.py (init_readline): Fix exit message for Windows
1268 1273 when readline is active. Thanks to a report by Eric Jones
1269 1274 <eric-AT-enthought.com>.
1270 1275
1271 1276 2004-11-07 Fernando Perez <fperez@colorado.edu>
1272 1277
1273 1278 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1274 1279 sometimes seen by win2k/cygwin users.
1275 1280
1276 1281 2004-11-06 Fernando Perez <fperez@colorado.edu>
1277 1282
1278 1283 * IPython/iplib.py (interact): Change the handling of %Exit from
1279 1284 trying to propagate a SystemExit to an internal ipython flag.
1280 1285 This is less elegant than using Python's exception mechanism, but
1281 1286 I can't get that to work reliably with threads, so under -pylab
1282 1287 %Exit was hanging IPython. Cross-thread exception handling is
1283 1288 really a bitch. Thaks to a bug report by Stephen Walton
1284 1289 <stephen.walton-AT-csun.edu>.
1285 1290
1286 1291 2004-11-04 Fernando Perez <fperez@colorado.edu>
1287 1292
1288 1293 * IPython/iplib.py (raw_input_original): store a pointer to the
1289 1294 true raw_input to harden against code which can modify it
1290 1295 (wx.py.PyShell does this and would otherwise crash ipython).
1291 1296 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1292 1297
1293 1298 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1294 1299 Ctrl-C problem, which does not mess up the input line.
1295 1300
1296 1301 2004-11-03 Fernando Perez <fperez@colorado.edu>
1297 1302
1298 1303 * IPython/Release.py: Changed licensing to BSD, in all files.
1299 1304 (name): lowercase name for tarball/RPM release.
1300 1305
1301 1306 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1302 1307 use throughout ipython.
1303 1308
1304 1309 * IPython/Magic.py (Magic._ofind): Switch to using the new
1305 1310 OInspect.getdoc() function.
1306 1311
1307 1312 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1308 1313 of the line currently being canceled via Ctrl-C. It's extremely
1309 1314 ugly, but I don't know how to do it better (the problem is one of
1310 1315 handling cross-thread exceptions).
1311 1316
1312 1317 2004-10-28 Fernando Perez <fperez@colorado.edu>
1313 1318
1314 1319 * IPython/Shell.py (signal_handler): add signal handlers to trap
1315 1320 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1316 1321 report by Francesc Alted.
1317 1322
1318 1323 2004-10-21 Fernando Perez <fperez@colorado.edu>
1319 1324
1320 1325 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1321 1326 to % for pysh syntax extensions.
1322 1327
1323 1328 2004-10-09 Fernando Perez <fperez@colorado.edu>
1324 1329
1325 1330 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1326 1331 arrays to print a more useful summary, without calling str(arr).
1327 1332 This avoids the problem of extremely lengthy computations which
1328 1333 occur if arr is large, and appear to the user as a system lockup
1329 1334 with 100% cpu activity. After a suggestion by Kristian Sandberg
1330 1335 <Kristian.Sandberg@colorado.edu>.
1331 1336 (Magic.__init__): fix bug in global magic escapes not being
1332 1337 correctly set.
1333 1338
1334 1339 2004-10-08 Fernando Perez <fperez@colorado.edu>
1335 1340
1336 1341 * IPython/Magic.py (__license__): change to absolute imports of
1337 1342 ipython's own internal packages, to start adapting to the absolute
1338 1343 import requirement of PEP-328.
1339 1344
1340 1345 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1341 1346 files, and standardize author/license marks through the Release
1342 1347 module instead of having per/file stuff (except for files with
1343 1348 particular licenses, like the MIT/PSF-licensed codes).
1344 1349
1345 1350 * IPython/Debugger.py: remove dead code for python 2.1
1346 1351
1347 1352 2004-10-04 Fernando Perez <fperez@colorado.edu>
1348 1353
1349 1354 * IPython/iplib.py (ipmagic): New function for accessing magics
1350 1355 via a normal python function call.
1351 1356
1352 1357 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1353 1358 from '@' to '%', to accomodate the new @decorator syntax of python
1354 1359 2.4.
1355 1360
1356 1361 2004-09-29 Fernando Perez <fperez@colorado.edu>
1357 1362
1358 1363 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1359 1364 matplotlib.use to prevent running scripts which try to switch
1360 1365 interactive backends from within ipython. This will just crash
1361 1366 the python interpreter, so we can't allow it (but a detailed error
1362 1367 is given to the user).
1363 1368
1364 1369 2004-09-28 Fernando Perez <fperez@colorado.edu>
1365 1370
1366 1371 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1367 1372 matplotlib-related fixes so that using @run with non-matplotlib
1368 1373 scripts doesn't pop up spurious plot windows. This requires
1369 1374 matplotlib >= 0.63, where I had to make some changes as well.
1370 1375
1371 1376 * IPython/ipmaker.py (make_IPython): update version requirement to
1372 1377 python 2.2.
1373 1378
1374 1379 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1375 1380 banner arg for embedded customization.
1376 1381
1377 1382 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1378 1383 explicit uses of __IP as the IPython's instance name. Now things
1379 1384 are properly handled via the shell.name value. The actual code
1380 1385 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1381 1386 is much better than before. I'll clean things completely when the
1382 1387 magic stuff gets a real overhaul.
1383 1388
1384 1389 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1385 1390 minor changes to debian dir.
1386 1391
1387 1392 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1388 1393 pointer to the shell itself in the interactive namespace even when
1389 1394 a user-supplied dict is provided. This is needed for embedding
1390 1395 purposes (found by tests with Michel Sanner).
1391 1396
1392 1397 2004-09-27 Fernando Perez <fperez@colorado.edu>
1393 1398
1394 1399 * IPython/UserConfig/ipythonrc: remove []{} from
1395 1400 readline_remove_delims, so that things like [modname.<TAB> do
1396 1401 proper completion. This disables [].TAB, but that's a less common
1397 1402 case than module names in list comprehensions, for example.
1398 1403 Thanks to a report by Andrea Riciputi.
1399 1404
1400 1405 2004-09-09 Fernando Perez <fperez@colorado.edu>
1401 1406
1402 1407 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1403 1408 blocking problems in win32 and osx. Fix by John.
1404 1409
1405 1410 2004-09-08 Fernando Perez <fperez@colorado.edu>
1406 1411
1407 1412 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1408 1413 for Win32 and OSX. Fix by John Hunter.
1409 1414
1410 1415 2004-08-30 *** Released version 0.6.3
1411 1416
1412 1417 2004-08-30 Fernando Perez <fperez@colorado.edu>
1413 1418
1414 1419 * setup.py (isfile): Add manpages to list of dependent files to be
1415 1420 updated.
1416 1421
1417 1422 2004-08-27 Fernando Perez <fperez@colorado.edu>
1418 1423
1419 1424 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1420 1425 for now. They don't really work with standalone WX/GTK code
1421 1426 (though matplotlib IS working fine with both of those backends).
1422 1427 This will neeed much more testing. I disabled most things with
1423 1428 comments, so turning it back on later should be pretty easy.
1424 1429
1425 1430 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1426 1431 autocalling of expressions like r'foo', by modifying the line
1427 1432 split regexp. Closes
1428 1433 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1429 1434 Riley <ipythonbugs-AT-sabi.net>.
1430 1435 (InteractiveShell.mainloop): honor --nobanner with banner
1431 1436 extensions.
1432 1437
1433 1438 * IPython/Shell.py: Significant refactoring of all classes, so
1434 1439 that we can really support ALL matplotlib backends and threading
1435 1440 models (John spotted a bug with Tk which required this). Now we
1436 1441 should support single-threaded, WX-threads and GTK-threads, both
1437 1442 for generic code and for matplotlib.
1438 1443
1439 1444 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1440 1445 -pylab, to simplify things for users. Will also remove the pylab
1441 1446 profile, since now all of matplotlib configuration is directly
1442 1447 handled here. This also reduces startup time.
1443 1448
1444 1449 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1445 1450 shell wasn't being correctly called. Also in IPShellWX.
1446 1451
1447 1452 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1448 1453 fine-tune banner.
1449 1454
1450 1455 * IPython/numutils.py (spike): Deprecate these spike functions,
1451 1456 delete (long deprecated) gnuplot_exec handler.
1452 1457
1453 1458 2004-08-26 Fernando Perez <fperez@colorado.edu>
1454 1459
1455 1460 * ipython.1: Update for threading options, plus some others which
1456 1461 were missing.
1457 1462
1458 1463 * IPython/ipmaker.py (__call__): Added -wthread option for
1459 1464 wxpython thread handling. Make sure threading options are only
1460 1465 valid at the command line.
1461 1466
1462 1467 * scripts/ipython: moved shell selection into a factory function
1463 1468 in Shell.py, to keep the starter script to a minimum.
1464 1469
1465 1470 2004-08-25 Fernando Perez <fperez@colorado.edu>
1466 1471
1467 1472 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1468 1473 John. Along with some recent changes he made to matplotlib, the
1469 1474 next versions of both systems should work very well together.
1470 1475
1471 1476 2004-08-24 Fernando Perez <fperez@colorado.edu>
1472 1477
1473 1478 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1474 1479 tried to switch the profiling to using hotshot, but I'm getting
1475 1480 strange errors from prof.runctx() there. I may be misreading the
1476 1481 docs, but it looks weird. For now the profiling code will
1477 1482 continue to use the standard profiler.
1478 1483
1479 1484 2004-08-23 Fernando Perez <fperez@colorado.edu>
1480 1485
1481 1486 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1482 1487 threaded shell, by John Hunter. It's not quite ready yet, but
1483 1488 close.
1484 1489
1485 1490 2004-08-22 Fernando Perez <fperez@colorado.edu>
1486 1491
1487 1492 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1488 1493 in Magic and ultraTB.
1489 1494
1490 1495 * ipython.1: document threading options in manpage.
1491 1496
1492 1497 * scripts/ipython: Changed name of -thread option to -gthread,
1493 1498 since this is GTK specific. I want to leave the door open for a
1494 1499 -wthread option for WX, which will most likely be necessary. This
1495 1500 change affects usage and ipmaker as well.
1496 1501
1497 1502 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1498 1503 handle the matplotlib shell issues. Code by John Hunter
1499 1504 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1500 1505 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1501 1506 broken (and disabled for end users) for now, but it puts the
1502 1507 infrastructure in place.
1503 1508
1504 1509 2004-08-21 Fernando Perez <fperez@colorado.edu>
1505 1510
1506 1511 * ipythonrc-pylab: Add matplotlib support.
1507 1512
1508 1513 * matplotlib_config.py: new files for matplotlib support, part of
1509 1514 the pylab profile.
1510 1515
1511 1516 * IPython/usage.py (__doc__): documented the threading options.
1512 1517
1513 1518 2004-08-20 Fernando Perez <fperez@colorado.edu>
1514 1519
1515 1520 * ipython: Modified the main calling routine to handle the -thread
1516 1521 and -mpthread options. This needs to be done as a top-level hack,
1517 1522 because it determines which class to instantiate for IPython
1518 1523 itself.
1519 1524
1520 1525 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1521 1526 classes to support multithreaded GTK operation without blocking,
1522 1527 and matplotlib with all backends. This is a lot of still very
1523 1528 experimental code, and threads are tricky. So it may still have a
1524 1529 few rough edges... This code owes a lot to
1525 1530 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1526 1531 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1527 1532 to John Hunter for all the matplotlib work.
1528 1533
1529 1534 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1530 1535 options for gtk thread and matplotlib support.
1531 1536
1532 1537 2004-08-16 Fernando Perez <fperez@colorado.edu>
1533 1538
1534 1539 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1535 1540 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1536 1541 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1537 1542
1538 1543 2004-08-11 Fernando Perez <fperez@colorado.edu>
1539 1544
1540 1545 * setup.py (isfile): Fix build so documentation gets updated for
1541 1546 rpms (it was only done for .tgz builds).
1542 1547
1543 1548 2004-08-10 Fernando Perez <fperez@colorado.edu>
1544 1549
1545 1550 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1546 1551
1547 1552 * iplib.py : Silence syntax error exceptions in tab-completion.
1548 1553
1549 1554 2004-08-05 Fernando Perez <fperez@colorado.edu>
1550 1555
1551 1556 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1552 1557 'color off' mark for continuation prompts. This was causing long
1553 1558 continuation lines to mis-wrap.
1554 1559
1555 1560 2004-08-01 Fernando Perez <fperez@colorado.edu>
1556 1561
1557 1562 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1558 1563 for building ipython to be a parameter. All this is necessary
1559 1564 right now to have a multithreaded version, but this insane
1560 1565 non-design will be cleaned up soon. For now, it's a hack that
1561 1566 works.
1562 1567
1563 1568 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1564 1569 args in various places. No bugs so far, but it's a dangerous
1565 1570 practice.
1566 1571
1567 1572 2004-07-31 Fernando Perez <fperez@colorado.edu>
1568 1573
1569 1574 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1570 1575 fix completion of files with dots in their names under most
1571 1576 profiles (pysh was OK because the completion order is different).
1572 1577
1573 1578 2004-07-27 Fernando Perez <fperez@colorado.edu>
1574 1579
1575 1580 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1576 1581 keywords manually, b/c the one in keyword.py was removed in python
1577 1582 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1578 1583 This is NOT a bug under python 2.3 and earlier.
1579 1584
1580 1585 2004-07-26 Fernando Perez <fperez@colorado.edu>
1581 1586
1582 1587 * IPython/ultraTB.py (VerboseTB.text): Add another
1583 1588 linecache.checkcache() call to try to prevent inspect.py from
1584 1589 crashing under python 2.3. I think this fixes
1585 1590 http://www.scipy.net/roundup/ipython/issue17.
1586 1591
1587 1592 2004-07-26 *** Released version 0.6.2
1588 1593
1589 1594 2004-07-26 Fernando Perez <fperez@colorado.edu>
1590 1595
1591 1596 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1592 1597 fail for any number.
1593 1598 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1594 1599 empty bookmarks.
1595 1600
1596 1601 2004-07-26 *** Released version 0.6.1
1597 1602
1598 1603 2004-07-26 Fernando Perez <fperez@colorado.edu>
1599 1604
1600 1605 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1601 1606
1602 1607 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1603 1608 escaping '()[]{}' in filenames.
1604 1609
1605 1610 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1606 1611 Python 2.2 users who lack a proper shlex.split.
1607 1612
1608 1613 2004-07-19 Fernando Perez <fperez@colorado.edu>
1609 1614
1610 1615 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1611 1616 for reading readline's init file. I follow the normal chain:
1612 1617 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1613 1618 report by Mike Heeter. This closes
1614 1619 http://www.scipy.net/roundup/ipython/issue16.
1615 1620
1616 1621 2004-07-18 Fernando Perez <fperez@colorado.edu>
1617 1622
1618 1623 * IPython/iplib.py (__init__): Add better handling of '\' under
1619 1624 Win32 for filenames. After a patch by Ville.
1620 1625
1621 1626 2004-07-17 Fernando Perez <fperez@colorado.edu>
1622 1627
1623 1628 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1624 1629 autocalling would be triggered for 'foo is bar' if foo is
1625 1630 callable. I also cleaned up the autocall detection code to use a
1626 1631 regexp, which is faster. Bug reported by Alexander Schmolck.
1627 1632
1628 1633 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1629 1634 '?' in them would confuse the help system. Reported by Alex
1630 1635 Schmolck.
1631 1636
1632 1637 2004-07-16 Fernando Perez <fperez@colorado.edu>
1633 1638
1634 1639 * IPython/GnuplotInteractive.py (__all__): added plot2.
1635 1640
1636 1641 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1637 1642 plotting dictionaries, lists or tuples of 1d arrays.
1638 1643
1639 1644 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1640 1645 optimizations.
1641 1646
1642 1647 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1643 1648 the information which was there from Janko's original IPP code:
1644 1649
1645 1650 03.05.99 20:53 porto.ifm.uni-kiel.de
1646 1651 --Started changelog.
1647 1652 --make clear do what it say it does
1648 1653 --added pretty output of lines from inputcache
1649 1654 --Made Logger a mixin class, simplifies handling of switches
1650 1655 --Added own completer class. .string<TAB> expands to last history
1651 1656 line which starts with string. The new expansion is also present
1652 1657 with Ctrl-r from the readline library. But this shows, who this
1653 1658 can be done for other cases.
1654 1659 --Added convention that all shell functions should accept a
1655 1660 parameter_string This opens the door for different behaviour for
1656 1661 each function. @cd is a good example of this.
1657 1662
1658 1663 04.05.99 12:12 porto.ifm.uni-kiel.de
1659 1664 --added logfile rotation
1660 1665 --added new mainloop method which freezes first the namespace
1661 1666
1662 1667 07.05.99 21:24 porto.ifm.uni-kiel.de
1663 1668 --added the docreader classes. Now there is a help system.
1664 1669 -This is only a first try. Currently it's not easy to put new
1665 1670 stuff in the indices. But this is the way to go. Info would be
1666 1671 better, but HTML is every where and not everybody has an info
1667 1672 system installed and it's not so easy to change html-docs to info.
1668 1673 --added global logfile option
1669 1674 --there is now a hook for object inspection method pinfo needs to
1670 1675 be provided for this. Can be reached by two '??'.
1671 1676
1672 1677 08.05.99 20:51 porto.ifm.uni-kiel.de
1673 1678 --added a README
1674 1679 --bug in rc file. Something has changed so functions in the rc
1675 1680 file need to reference the shell and not self. Not clear if it's a
1676 1681 bug or feature.
1677 1682 --changed rc file for new behavior
1678 1683
1679 1684 2004-07-15 Fernando Perez <fperez@colorado.edu>
1680 1685
1681 1686 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1682 1687 cache was falling out of sync in bizarre manners when multi-line
1683 1688 input was present. Minor optimizations and cleanup.
1684 1689
1685 1690 (Logger): Remove old Changelog info for cleanup. This is the
1686 1691 information which was there from Janko's original code:
1687 1692
1688 1693 Changes to Logger: - made the default log filename a parameter
1689 1694
1690 1695 - put a check for lines beginning with !@? in log(). Needed
1691 1696 (even if the handlers properly log their lines) for mid-session
1692 1697 logging activation to work properly. Without this, lines logged
1693 1698 in mid session, which get read from the cache, would end up
1694 1699 'bare' (with !@? in the open) in the log. Now they are caught
1695 1700 and prepended with a #.
1696 1701
1697 1702 * IPython/iplib.py (InteractiveShell.init_readline): added check
1698 1703 in case MagicCompleter fails to be defined, so we don't crash.
1699 1704
1700 1705 2004-07-13 Fernando Perez <fperez@colorado.edu>
1701 1706
1702 1707 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1703 1708 of EPS if the requested filename ends in '.eps'.
1704 1709
1705 1710 2004-07-04 Fernando Perez <fperez@colorado.edu>
1706 1711
1707 1712 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1708 1713 escaping of quotes when calling the shell.
1709 1714
1710 1715 2004-07-02 Fernando Perez <fperez@colorado.edu>
1711 1716
1712 1717 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1713 1718 gettext not working because we were clobbering '_'. Fixes
1714 1719 http://www.scipy.net/roundup/ipython/issue6.
1715 1720
1716 1721 2004-07-01 Fernando Perez <fperez@colorado.edu>
1717 1722
1718 1723 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1719 1724 into @cd. Patch by Ville.
1720 1725
1721 1726 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1722 1727 new function to store things after ipmaker runs. Patch by Ville.
1723 1728 Eventually this will go away once ipmaker is removed and the class
1724 1729 gets cleaned up, but for now it's ok. Key functionality here is
1725 1730 the addition of the persistent storage mechanism, a dict for
1726 1731 keeping data across sessions (for now just bookmarks, but more can
1727 1732 be implemented later).
1728 1733
1729 1734 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1730 1735 persistent across sections. Patch by Ville, I modified it
1731 1736 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1732 1737 added a '-l' option to list all bookmarks.
1733 1738
1734 1739 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1735 1740 center for cleanup. Registered with atexit.register(). I moved
1736 1741 here the old exit_cleanup(). After a patch by Ville.
1737 1742
1738 1743 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1739 1744 characters in the hacked shlex_split for python 2.2.
1740 1745
1741 1746 * IPython/iplib.py (file_matches): more fixes to filenames with
1742 1747 whitespace in them. It's not perfect, but limitations in python's
1743 1748 readline make it impossible to go further.
1744 1749
1745 1750 2004-06-29 Fernando Perez <fperez@colorado.edu>
1746 1751
1747 1752 * IPython/iplib.py (file_matches): escape whitespace correctly in
1748 1753 filename completions. Bug reported by Ville.
1749 1754
1750 1755 2004-06-28 Fernando Perez <fperez@colorado.edu>
1751 1756
1752 1757 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1753 1758 the history file will be called 'history-PROFNAME' (or just
1754 1759 'history' if no profile is loaded). I was getting annoyed at
1755 1760 getting my Numerical work history clobbered by pysh sessions.
1756 1761
1757 1762 * IPython/iplib.py (InteractiveShell.__init__): Internal
1758 1763 getoutputerror() function so that we can honor the system_verbose
1759 1764 flag for _all_ system calls. I also added escaping of #
1760 1765 characters here to avoid confusing Itpl.
1761 1766
1762 1767 * IPython/Magic.py (shlex_split): removed call to shell in
1763 1768 parse_options and replaced it with shlex.split(). The annoying
1764 1769 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1765 1770 to backport it from 2.3, with several frail hacks (the shlex
1766 1771 module is rather limited in 2.2). Thanks to a suggestion by Ville
1767 1772 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1768 1773 problem.
1769 1774
1770 1775 (Magic.magic_system_verbose): new toggle to print the actual
1771 1776 system calls made by ipython. Mainly for debugging purposes.
1772 1777
1773 1778 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1774 1779 doesn't support persistence. Reported (and fix suggested) by
1775 1780 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1776 1781
1777 1782 2004-06-26 Fernando Perez <fperez@colorado.edu>
1778 1783
1779 1784 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1780 1785 continue prompts.
1781 1786
1782 1787 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1783 1788 function (basically a big docstring) and a few more things here to
1784 1789 speedup startup. pysh.py is now very lightweight. We want because
1785 1790 it gets execfile'd, while InterpreterExec gets imported, so
1786 1791 byte-compilation saves time.
1787 1792
1788 1793 2004-06-25 Fernando Perez <fperez@colorado.edu>
1789 1794
1790 1795 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1791 1796 -NUM', which was recently broken.
1792 1797
1793 1798 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1794 1799 in multi-line input (but not !!, which doesn't make sense there).
1795 1800
1796 1801 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1797 1802 It's just too useful, and people can turn it off in the less
1798 1803 common cases where it's a problem.
1799 1804
1800 1805 2004-06-24 Fernando Perez <fperez@colorado.edu>
1801 1806
1802 1807 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1803 1808 special syntaxes (like alias calling) is now allied in multi-line
1804 1809 input. This is still _very_ experimental, but it's necessary for
1805 1810 efficient shell usage combining python looping syntax with system
1806 1811 calls. For now it's restricted to aliases, I don't think it
1807 1812 really even makes sense to have this for magics.
1808 1813
1809 1814 2004-06-23 Fernando Perez <fperez@colorado.edu>
1810 1815
1811 1816 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1812 1817 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1813 1818
1814 1819 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1815 1820 extensions under Windows (after code sent by Gary Bishop). The
1816 1821 extensions considered 'executable' are stored in IPython's rc
1817 1822 structure as win_exec_ext.
1818 1823
1819 1824 * IPython/genutils.py (shell): new function, like system() but
1820 1825 without return value. Very useful for interactive shell work.
1821 1826
1822 1827 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1823 1828 delete aliases.
1824 1829
1825 1830 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1826 1831 sure that the alias table doesn't contain python keywords.
1827 1832
1828 1833 2004-06-21 Fernando Perez <fperez@colorado.edu>
1829 1834
1830 1835 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1831 1836 non-existent items are found in $PATH. Reported by Thorsten.
1832 1837
1833 1838 2004-06-20 Fernando Perez <fperez@colorado.edu>
1834 1839
1835 1840 * IPython/iplib.py (complete): modified the completer so that the
1836 1841 order of priorities can be easily changed at runtime.
1837 1842
1838 1843 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1839 1844 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1840 1845
1841 1846 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1842 1847 expand Python variables prepended with $ in all system calls. The
1843 1848 same was done to InteractiveShell.handle_shell_escape. Now all
1844 1849 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1845 1850 expansion of python variables and expressions according to the
1846 1851 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1847 1852
1848 1853 Though PEP-215 has been rejected, a similar (but simpler) one
1849 1854 seems like it will go into Python 2.4, PEP-292 -
1850 1855 http://www.python.org/peps/pep-0292.html.
1851 1856
1852 1857 I'll keep the full syntax of PEP-215, since IPython has since the
1853 1858 start used Ka-Ping Yee's reference implementation discussed there
1854 1859 (Itpl), and I actually like the powerful semantics it offers.
1855 1860
1856 1861 In order to access normal shell variables, the $ has to be escaped
1857 1862 via an extra $. For example:
1858 1863
1859 1864 In [7]: PATH='a python variable'
1860 1865
1861 1866 In [8]: !echo $PATH
1862 1867 a python variable
1863 1868
1864 1869 In [9]: !echo $$PATH
1865 1870 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1866 1871
1867 1872 (Magic.parse_options): escape $ so the shell doesn't evaluate
1868 1873 things prematurely.
1869 1874
1870 1875 * IPython/iplib.py (InteractiveShell.call_alias): added the
1871 1876 ability for aliases to expand python variables via $.
1872 1877
1873 1878 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1874 1879 system, now there's a @rehash/@rehashx pair of magics. These work
1875 1880 like the csh rehash command, and can be invoked at any time. They
1876 1881 build a table of aliases to everything in the user's $PATH
1877 1882 (@rehash uses everything, @rehashx is slower but only adds
1878 1883 executable files). With this, the pysh.py-based shell profile can
1879 1884 now simply call rehash upon startup, and full access to all
1880 1885 programs in the user's path is obtained.
1881 1886
1882 1887 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1883 1888 functionality is now fully in place. I removed the old dynamic
1884 1889 code generation based approach, in favor of a much lighter one
1885 1890 based on a simple dict. The advantage is that this allows me to
1886 1891 now have thousands of aliases with negligible cost (unthinkable
1887 1892 with the old system).
1888 1893
1889 1894 2004-06-19 Fernando Perez <fperez@colorado.edu>
1890 1895
1891 1896 * IPython/iplib.py (__init__): extended MagicCompleter class to
1892 1897 also complete (last in priority) on user aliases.
1893 1898
1894 1899 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1895 1900 call to eval.
1896 1901 (ItplNS.__init__): Added a new class which functions like Itpl,
1897 1902 but allows configuring the namespace for the evaluation to occur
1898 1903 in.
1899 1904
1900 1905 2004-06-18 Fernando Perez <fperez@colorado.edu>
1901 1906
1902 1907 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1903 1908 better message when 'exit' or 'quit' are typed (a common newbie
1904 1909 confusion).
1905 1910
1906 1911 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1907 1912 check for Windows users.
1908 1913
1909 1914 * IPython/iplib.py (InteractiveShell.user_setup): removed
1910 1915 disabling of colors for Windows. I'll test at runtime and issue a
1911 1916 warning if Gary's readline isn't found, as to nudge users to
1912 1917 download it.
1913 1918
1914 1919 2004-06-16 Fernando Perez <fperez@colorado.edu>
1915 1920
1916 1921 * IPython/genutils.py (Stream.__init__): changed to print errors
1917 1922 to sys.stderr. I had a circular dependency here. Now it's
1918 1923 possible to run ipython as IDLE's shell (consider this pre-alpha,
1919 1924 since true stdout things end up in the starting terminal instead
1920 1925 of IDLE's out).
1921 1926
1922 1927 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1923 1928 users who haven't # updated their prompt_in2 definitions. Remove
1924 1929 eventually.
1925 1930 (multiple_replace): added credit to original ASPN recipe.
1926 1931
1927 1932 2004-06-15 Fernando Perez <fperez@colorado.edu>
1928 1933
1929 1934 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1930 1935 list of auto-defined aliases.
1931 1936
1932 1937 2004-06-13 Fernando Perez <fperez@colorado.edu>
1933 1938
1934 1939 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1935 1940 install was really requested (so setup.py can be used for other
1936 1941 things under Windows).
1937 1942
1938 1943 2004-06-10 Fernando Perez <fperez@colorado.edu>
1939 1944
1940 1945 * IPython/Logger.py (Logger.create_log): Manually remove any old
1941 1946 backup, since os.remove may fail under Windows. Fixes bug
1942 1947 reported by Thorsten.
1943 1948
1944 1949 2004-06-09 Fernando Perez <fperez@colorado.edu>
1945 1950
1946 1951 * examples/example-embed.py: fixed all references to %n (replaced
1947 1952 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1948 1953 for all examples and the manual as well.
1949 1954
1950 1955 2004-06-08 Fernando Perez <fperez@colorado.edu>
1951 1956
1952 1957 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1953 1958 alignment and color management. All 3 prompt subsystems now
1954 1959 inherit from BasePrompt.
1955 1960
1956 1961 * tools/release: updates for windows installer build and tag rpms
1957 1962 with python version (since paths are fixed).
1958 1963
1959 1964 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1960 1965 which will become eventually obsolete. Also fixed the default
1961 1966 prompt_in2 to use \D, so at least new users start with the correct
1962 1967 defaults.
1963 1968 WARNING: Users with existing ipythonrc files will need to apply
1964 1969 this fix manually!
1965 1970
1966 1971 * setup.py: make windows installer (.exe). This is finally the
1967 1972 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1968 1973 which I hadn't included because it required Python 2.3 (or recent
1969 1974 distutils).
1970 1975
1971 1976 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1972 1977 usage of new '\D' escape.
1973 1978
1974 1979 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1975 1980 lacks os.getuid())
1976 1981 (CachedOutput.set_colors): Added the ability to turn coloring
1977 1982 on/off with @colors even for manually defined prompt colors. It
1978 1983 uses a nasty global, but it works safely and via the generic color
1979 1984 handling mechanism.
1980 1985 (Prompt2.__init__): Introduced new escape '\D' for continuation
1981 1986 prompts. It represents the counter ('\#') as dots.
1982 1987 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1983 1988 need to update their ipythonrc files and replace '%n' with '\D' in
1984 1989 their prompt_in2 settings everywhere. Sorry, but there's
1985 1990 otherwise no clean way to get all prompts to properly align. The
1986 1991 ipythonrc shipped with IPython has been updated.
1987 1992
1988 1993 2004-06-07 Fernando Perez <fperez@colorado.edu>
1989 1994
1990 1995 * setup.py (isfile): Pass local_icons option to latex2html, so the
1991 1996 resulting HTML file is self-contained. Thanks to
1992 1997 dryice-AT-liu.com.cn for the tip.
1993 1998
1994 1999 * pysh.py: I created a new profile 'shell', which implements a
1995 2000 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1996 2001 system shell, nor will it become one anytime soon. It's mainly
1997 2002 meant to illustrate the use of the new flexible bash-like prompts.
1998 2003 I guess it could be used by hardy souls for true shell management,
1999 2004 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2000 2005 profile. This uses the InterpreterExec extension provided by
2001 2006 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2002 2007
2003 2008 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2004 2009 auto-align itself with the length of the previous input prompt
2005 2010 (taking into account the invisible color escapes).
2006 2011 (CachedOutput.__init__): Large restructuring of this class. Now
2007 2012 all three prompts (primary1, primary2, output) are proper objects,
2008 2013 managed by the 'parent' CachedOutput class. The code is still a
2009 2014 bit hackish (all prompts share state via a pointer to the cache),
2010 2015 but it's overall far cleaner than before.
2011 2016
2012 2017 * IPython/genutils.py (getoutputerror): modified to add verbose,
2013 2018 debug and header options. This makes the interface of all getout*
2014 2019 functions uniform.
2015 2020 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2016 2021
2017 2022 * IPython/Magic.py (Magic.default_option): added a function to
2018 2023 allow registering default options for any magic command. This
2019 2024 makes it easy to have profiles which customize the magics globally
2020 2025 for a certain use. The values set through this function are
2021 2026 picked up by the parse_options() method, which all magics should
2022 2027 use to parse their options.
2023 2028
2024 2029 * IPython/genutils.py (warn): modified the warnings framework to
2025 2030 use the Term I/O class. I'm trying to slowly unify all of
2026 2031 IPython's I/O operations to pass through Term.
2027 2032
2028 2033 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2029 2034 the secondary prompt to correctly match the length of the primary
2030 2035 one for any prompt. Now multi-line code will properly line up
2031 2036 even for path dependent prompts, such as the new ones available
2032 2037 via the prompt_specials.
2033 2038
2034 2039 2004-06-06 Fernando Perez <fperez@colorado.edu>
2035 2040
2036 2041 * IPython/Prompts.py (prompt_specials): Added the ability to have
2037 2042 bash-like special sequences in the prompts, which get
2038 2043 automatically expanded. Things like hostname, current working
2039 2044 directory and username are implemented already, but it's easy to
2040 2045 add more in the future. Thanks to a patch by W.J. van der Laan
2041 2046 <gnufnork-AT-hetdigitalegat.nl>
2042 2047 (prompt_specials): Added color support for prompt strings, so
2043 2048 users can define arbitrary color setups for their prompts.
2044 2049
2045 2050 2004-06-05 Fernando Perez <fperez@colorado.edu>
2046 2051
2047 2052 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2048 2053 code to load Gary Bishop's readline and configure it
2049 2054 automatically. Thanks to Gary for help on this.
2050 2055
2051 2056 2004-06-01 Fernando Perez <fperez@colorado.edu>
2052 2057
2053 2058 * IPython/Logger.py (Logger.create_log): fix bug for logging
2054 2059 with no filename (previous fix was incomplete).
2055 2060
2056 2061 2004-05-25 Fernando Perez <fperez@colorado.edu>
2057 2062
2058 2063 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2059 2064 parens would get passed to the shell.
2060 2065
2061 2066 2004-05-20 Fernando Perez <fperez@colorado.edu>
2062 2067
2063 2068 * IPython/Magic.py (Magic.magic_prun): changed default profile
2064 2069 sort order to 'time' (the more common profiling need).
2065 2070
2066 2071 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2067 2072 so that source code shown is guaranteed in sync with the file on
2068 2073 disk (also changed in psource). Similar fix to the one for
2069 2074 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2070 2075 <yann.ledu-AT-noos.fr>.
2071 2076
2072 2077 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2073 2078 with a single option would not be correctly parsed. Closes
2074 2079 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2075 2080 introduced in 0.6.0 (on 2004-05-06).
2076 2081
2077 2082 2004-05-13 *** Released version 0.6.0
2078 2083
2079 2084 2004-05-13 Fernando Perez <fperez@colorado.edu>
2080 2085
2081 2086 * debian/: Added debian/ directory to CVS, so that debian support
2082 2087 is publicly accessible. The debian package is maintained by Jack
2083 2088 Moffit <jack-AT-xiph.org>.
2084 2089
2085 2090 * Documentation: included the notes about an ipython-based system
2086 2091 shell (the hypothetical 'pysh') into the new_design.pdf document,
2087 2092 so that these ideas get distributed to users along with the
2088 2093 official documentation.
2089 2094
2090 2095 2004-05-10 Fernando Perez <fperez@colorado.edu>
2091 2096
2092 2097 * IPython/Logger.py (Logger.create_log): fix recently introduced
2093 2098 bug (misindented line) where logstart would fail when not given an
2094 2099 explicit filename.
2095 2100
2096 2101 2004-05-09 Fernando Perez <fperez@colorado.edu>
2097 2102
2098 2103 * IPython/Magic.py (Magic.parse_options): skip system call when
2099 2104 there are no options to look for. Faster, cleaner for the common
2100 2105 case.
2101 2106
2102 2107 * Documentation: many updates to the manual: describing Windows
2103 2108 support better, Gnuplot updates, credits, misc small stuff. Also
2104 2109 updated the new_design doc a bit.
2105 2110
2106 2111 2004-05-06 *** Released version 0.6.0.rc1
2107 2112
2108 2113 2004-05-06 Fernando Perez <fperez@colorado.edu>
2109 2114
2110 2115 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2111 2116 operations to use the vastly more efficient list/''.join() method.
2112 2117 (FormattedTB.text): Fix
2113 2118 http://www.scipy.net/roundup/ipython/issue12 - exception source
2114 2119 extract not updated after reload. Thanks to Mike Salib
2115 2120 <msalib-AT-mit.edu> for pinning the source of the problem.
2116 2121 Fortunately, the solution works inside ipython and doesn't require
2117 2122 any changes to python proper.
2118 2123
2119 2124 * IPython/Magic.py (Magic.parse_options): Improved to process the
2120 2125 argument list as a true shell would (by actually using the
2121 2126 underlying system shell). This way, all @magics automatically get
2122 2127 shell expansion for variables. Thanks to a comment by Alex
2123 2128 Schmolck.
2124 2129
2125 2130 2004-04-04 Fernando Perez <fperez@colorado.edu>
2126 2131
2127 2132 * IPython/iplib.py (InteractiveShell.interact): Added a special
2128 2133 trap for a debugger quit exception, which is basically impossible
2129 2134 to handle by normal mechanisms, given what pdb does to the stack.
2130 2135 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2131 2136
2132 2137 2004-04-03 Fernando Perez <fperez@colorado.edu>
2133 2138
2134 2139 * IPython/genutils.py (Term): Standardized the names of the Term
2135 2140 class streams to cin/cout/cerr, following C++ naming conventions
2136 2141 (I can't use in/out/err because 'in' is not a valid attribute
2137 2142 name).
2138 2143
2139 2144 * IPython/iplib.py (InteractiveShell.interact): don't increment
2140 2145 the prompt if there's no user input. By Daniel 'Dang' Griffith
2141 2146 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2142 2147 Francois Pinard.
2143 2148
2144 2149 2004-04-02 Fernando Perez <fperez@colorado.edu>
2145 2150
2146 2151 * IPython/genutils.py (Stream.__init__): Modified to survive at
2147 2152 least importing in contexts where stdin/out/err aren't true file
2148 2153 objects, such as PyCrust (they lack fileno() and mode). However,
2149 2154 the recovery facilities which rely on these things existing will
2150 2155 not work.
2151 2156
2152 2157 2004-04-01 Fernando Perez <fperez@colorado.edu>
2153 2158
2154 2159 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2155 2160 use the new getoutputerror() function, so it properly
2156 2161 distinguishes stdout/err.
2157 2162
2158 2163 * IPython/genutils.py (getoutputerror): added a function to
2159 2164 capture separately the standard output and error of a command.
2160 2165 After a comment from dang on the mailing lists. This code is
2161 2166 basically a modified version of commands.getstatusoutput(), from
2162 2167 the standard library.
2163 2168
2164 2169 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2165 2170 '!!' as a special syntax (shorthand) to access @sx.
2166 2171
2167 2172 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2168 2173 command and return its output as a list split on '\n'.
2169 2174
2170 2175 2004-03-31 Fernando Perez <fperez@colorado.edu>
2171 2176
2172 2177 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2173 2178 method to dictionaries used as FakeModule instances if they lack
2174 2179 it. At least pydoc in python2.3 breaks for runtime-defined
2175 2180 functions without this hack. At some point I need to _really_
2176 2181 understand what FakeModule is doing, because it's a gross hack.
2177 2182 But it solves Arnd's problem for now...
2178 2183
2179 2184 2004-02-27 Fernando Perez <fperez@colorado.edu>
2180 2185
2181 2186 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2182 2187 mode would behave erratically. Also increased the number of
2183 2188 possible logs in rotate mod to 999. Thanks to Rod Holland
2184 2189 <rhh@StructureLABS.com> for the report and fixes.
2185 2190
2186 2191 2004-02-26 Fernando Perez <fperez@colorado.edu>
2187 2192
2188 2193 * IPython/genutils.py (page): Check that the curses module really
2189 2194 has the initscr attribute before trying to use it. For some
2190 2195 reason, the Solaris curses module is missing this. I think this
2191 2196 should be considered a Solaris python bug, but I'm not sure.
2192 2197
2193 2198 2004-01-17 Fernando Perez <fperez@colorado.edu>
2194 2199
2195 2200 * IPython/genutils.py (Stream.__init__): Changes to try to make
2196 2201 ipython robust against stdin/out/err being closed by the user.
2197 2202 This is 'user error' (and blocks a normal python session, at least
2198 2203 the stdout case). However, Ipython should be able to survive such
2199 2204 instances of abuse as gracefully as possible. To simplify the
2200 2205 coding and maintain compatibility with Gary Bishop's Term
2201 2206 contributions, I've made use of classmethods for this. I think
2202 2207 this introduces a dependency on python 2.2.
2203 2208
2204 2209 2004-01-13 Fernando Perez <fperez@colorado.edu>
2205 2210
2206 2211 * IPython/numutils.py (exp_safe): simplified the code a bit and
2207 2212 removed the need for importing the kinds module altogether.
2208 2213
2209 2214 2004-01-06 Fernando Perez <fperez@colorado.edu>
2210 2215
2211 2216 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2212 2217 a magic function instead, after some community feedback. No
2213 2218 special syntax will exist for it, but its name is deliberately
2214 2219 very short.
2215 2220
2216 2221 2003-12-20 Fernando Perez <fperez@colorado.edu>
2217 2222
2218 2223 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2219 2224 new functionality, to automagically assign the result of a shell
2220 2225 command to a variable. I'll solicit some community feedback on
2221 2226 this before making it permanent.
2222 2227
2223 2228 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2224 2229 requested about callables for which inspect couldn't obtain a
2225 2230 proper argspec. Thanks to a crash report sent by Etienne
2226 2231 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2227 2232
2228 2233 2003-12-09 Fernando Perez <fperez@colorado.edu>
2229 2234
2230 2235 * IPython/genutils.py (page): patch for the pager to work across
2231 2236 various versions of Windows. By Gary Bishop.
2232 2237
2233 2238 2003-12-04 Fernando Perez <fperez@colorado.edu>
2234 2239
2235 2240 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2236 2241 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2237 2242 While I tested this and it looks ok, there may still be corner
2238 2243 cases I've missed.
2239 2244
2240 2245 2003-12-01 Fernando Perez <fperez@colorado.edu>
2241 2246
2242 2247 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2243 2248 where a line like 'p,q=1,2' would fail because the automagic
2244 2249 system would be triggered for @p.
2245 2250
2246 2251 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2247 2252 cleanups, code unmodified.
2248 2253
2249 2254 * IPython/genutils.py (Term): added a class for IPython to handle
2250 2255 output. In most cases it will just be a proxy for stdout/err, but
2251 2256 having this allows modifications to be made for some platforms,
2252 2257 such as handling color escapes under Windows. All of this code
2253 2258 was contributed by Gary Bishop, with minor modifications by me.
2254 2259 The actual changes affect many files.
2255 2260
2256 2261 2003-11-30 Fernando Perez <fperez@colorado.edu>
2257 2262
2258 2263 * IPython/iplib.py (file_matches): new completion code, courtesy
2259 2264 of Jeff Collins. This enables filename completion again under
2260 2265 python 2.3, which disabled it at the C level.
2261 2266
2262 2267 2003-11-11 Fernando Perez <fperez@colorado.edu>
2263 2268
2264 2269 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2265 2270 for Numeric.array(map(...)), but often convenient.
2266 2271
2267 2272 2003-11-05 Fernando Perez <fperez@colorado.edu>
2268 2273
2269 2274 * IPython/numutils.py (frange): Changed a call from int() to
2270 2275 int(round()) to prevent a problem reported with arange() in the
2271 2276 numpy list.
2272 2277
2273 2278 2003-10-06 Fernando Perez <fperez@colorado.edu>
2274 2279
2275 2280 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2276 2281 prevent crashes if sys lacks an argv attribute (it happens with
2277 2282 embedded interpreters which build a bare-bones sys module).
2278 2283 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2279 2284
2280 2285 2003-09-24 Fernando Perez <fperez@colorado.edu>
2281 2286
2282 2287 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2283 2288 to protect against poorly written user objects where __getattr__
2284 2289 raises exceptions other than AttributeError. Thanks to a bug
2285 2290 report by Oliver Sander <osander-AT-gmx.de>.
2286 2291
2287 2292 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2288 2293 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2289 2294
2290 2295 2003-09-09 Fernando Perez <fperez@colorado.edu>
2291 2296
2292 2297 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2293 2298 unpacking a list whith a callable as first element would
2294 2299 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2295 2300 Collins.
2296 2301
2297 2302 2003-08-25 *** Released version 0.5.0
2298 2303
2299 2304 2003-08-22 Fernando Perez <fperez@colorado.edu>
2300 2305
2301 2306 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2302 2307 improperly defined user exceptions. Thanks to feedback from Mark
2303 2308 Russell <mrussell-AT-verio.net>.
2304 2309
2305 2310 2003-08-20 Fernando Perez <fperez@colorado.edu>
2306 2311
2307 2312 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2308 2313 printing so that it would print multi-line string forms starting
2309 2314 with a new line. This way the formatting is better respected for
2310 2315 objects which work hard to make nice string forms.
2311 2316
2312 2317 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2313 2318 autocall would overtake data access for objects with both
2314 2319 __getitem__ and __call__.
2315 2320
2316 2321 2003-08-19 *** Released version 0.5.0-rc1
2317 2322
2318 2323 2003-08-19 Fernando Perez <fperez@colorado.edu>
2319 2324
2320 2325 * IPython/deep_reload.py (load_tail): single tiny change here
2321 2326 seems to fix the long-standing bug of dreload() failing to work
2322 2327 for dotted names. But this module is pretty tricky, so I may have
2323 2328 missed some subtlety. Needs more testing!.
2324 2329
2325 2330 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2326 2331 exceptions which have badly implemented __str__ methods.
2327 2332 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2328 2333 which I've been getting reports about from Python 2.3 users. I
2329 2334 wish I had a simple test case to reproduce the problem, so I could
2330 2335 either write a cleaner workaround or file a bug report if
2331 2336 necessary.
2332 2337
2333 2338 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2334 2339 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2335 2340 a bug report by Tjabo Kloppenburg.
2336 2341
2337 2342 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2338 2343 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2339 2344 seems rather unstable. Thanks to a bug report by Tjabo
2340 2345 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2341 2346
2342 2347 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2343 2348 this out soon because of the critical fixes in the inner loop for
2344 2349 generators.
2345 2350
2346 2351 * IPython/Magic.py (Magic.getargspec): removed. This (and
2347 2352 _get_def) have been obsoleted by OInspect for a long time, I
2348 2353 hadn't noticed that they were dead code.
2349 2354 (Magic._ofind): restored _ofind functionality for a few literals
2350 2355 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2351 2356 for things like "hello".capitalize?, since that would require a
2352 2357 potentially dangerous eval() again.
2353 2358
2354 2359 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2355 2360 logic a bit more to clean up the escapes handling and minimize the
2356 2361 use of _ofind to only necessary cases. The interactive 'feel' of
2357 2362 IPython should have improved quite a bit with the changes in
2358 2363 _prefilter and _ofind (besides being far safer than before).
2359 2364
2360 2365 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2361 2366 obscure, never reported). Edit would fail to find the object to
2362 2367 edit under some circumstances.
2363 2368 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2364 2369 which were causing double-calling of generators. Those eval calls
2365 2370 were _very_ dangerous, since code with side effects could be
2366 2371 triggered. As they say, 'eval is evil'... These were the
2367 2372 nastiest evals in IPython. Besides, _ofind is now far simpler,
2368 2373 and it should also be quite a bit faster. Its use of inspect is
2369 2374 also safer, so perhaps some of the inspect-related crashes I've
2370 2375 seen lately with Python 2.3 might be taken care of. That will
2371 2376 need more testing.
2372 2377
2373 2378 2003-08-17 Fernando Perez <fperez@colorado.edu>
2374 2379
2375 2380 * IPython/iplib.py (InteractiveShell._prefilter): significant
2376 2381 simplifications to the logic for handling user escapes. Faster
2377 2382 and simpler code.
2378 2383
2379 2384 2003-08-14 Fernando Perez <fperez@colorado.edu>
2380 2385
2381 2386 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2382 2387 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2383 2388 but it should be quite a bit faster. And the recursive version
2384 2389 generated O(log N) intermediate storage for all rank>1 arrays,
2385 2390 even if they were contiguous.
2386 2391 (l1norm): Added this function.
2387 2392 (norm): Added this function for arbitrary norms (including
2388 2393 l-infinity). l1 and l2 are still special cases for convenience
2389 2394 and speed.
2390 2395
2391 2396 2003-08-03 Fernando Perez <fperez@colorado.edu>
2392 2397
2393 2398 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2394 2399 exceptions, which now raise PendingDeprecationWarnings in Python
2395 2400 2.3. There were some in Magic and some in Gnuplot2.
2396 2401
2397 2402 2003-06-30 Fernando Perez <fperez@colorado.edu>
2398 2403
2399 2404 * IPython/genutils.py (page): modified to call curses only for
2400 2405 terminals where TERM=='xterm'. After problems under many other
2401 2406 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2402 2407
2403 2408 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2404 2409 would be triggered when readline was absent. This was just an old
2405 2410 debugging statement I'd forgotten to take out.
2406 2411
2407 2412 2003-06-20 Fernando Perez <fperez@colorado.edu>
2408 2413
2409 2414 * IPython/genutils.py (clock): modified to return only user time
2410 2415 (not counting system time), after a discussion on scipy. While
2411 2416 system time may be a useful quantity occasionally, it may much
2412 2417 more easily be skewed by occasional swapping or other similar
2413 2418 activity.
2414 2419
2415 2420 2003-06-05 Fernando Perez <fperez@colorado.edu>
2416 2421
2417 2422 * IPython/numutils.py (identity): new function, for building
2418 2423 arbitrary rank Kronecker deltas (mostly backwards compatible with
2419 2424 Numeric.identity)
2420 2425
2421 2426 2003-06-03 Fernando Perez <fperez@colorado.edu>
2422 2427
2423 2428 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2424 2429 arguments passed to magics with spaces, to allow trailing '\' to
2425 2430 work normally (mainly for Windows users).
2426 2431
2427 2432 2003-05-29 Fernando Perez <fperez@colorado.edu>
2428 2433
2429 2434 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2430 2435 instead of pydoc.help. This fixes a bizarre behavior where
2431 2436 printing '%s' % locals() would trigger the help system. Now
2432 2437 ipython behaves like normal python does.
2433 2438
2434 2439 Note that if one does 'from pydoc import help', the bizarre
2435 2440 behavior returns, but this will also happen in normal python, so
2436 2441 it's not an ipython bug anymore (it has to do with how pydoc.help
2437 2442 is implemented).
2438 2443
2439 2444 2003-05-22 Fernando Perez <fperez@colorado.edu>
2440 2445
2441 2446 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2442 2447 return [] instead of None when nothing matches, also match to end
2443 2448 of line. Patch by Gary Bishop.
2444 2449
2445 2450 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2446 2451 protection as before, for files passed on the command line. This
2447 2452 prevents the CrashHandler from kicking in if user files call into
2448 2453 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2449 2454 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2450 2455
2451 2456 2003-05-20 *** Released version 0.4.0
2452 2457
2453 2458 2003-05-20 Fernando Perez <fperez@colorado.edu>
2454 2459
2455 2460 * setup.py: added support for manpages. It's a bit hackish b/c of
2456 2461 a bug in the way the bdist_rpm distutils target handles gzipped
2457 2462 manpages, but it works. After a patch by Jack.
2458 2463
2459 2464 2003-05-19 Fernando Perez <fperez@colorado.edu>
2460 2465
2461 2466 * IPython/numutils.py: added a mockup of the kinds module, since
2462 2467 it was recently removed from Numeric. This way, numutils will
2463 2468 work for all users even if they are missing kinds.
2464 2469
2465 2470 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2466 2471 failure, which can occur with SWIG-wrapped extensions. After a
2467 2472 crash report from Prabhu.
2468 2473
2469 2474 2003-05-16 Fernando Perez <fperez@colorado.edu>
2470 2475
2471 2476 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2472 2477 protect ipython from user code which may call directly
2473 2478 sys.excepthook (this looks like an ipython crash to the user, even
2474 2479 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2475 2480 This is especially important to help users of WxWindows, but may
2476 2481 also be useful in other cases.
2477 2482
2478 2483 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2479 2484 an optional tb_offset to be specified, and to preserve exception
2480 2485 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2481 2486
2482 2487 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2483 2488
2484 2489 2003-05-15 Fernando Perez <fperez@colorado.edu>
2485 2490
2486 2491 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2487 2492 installing for a new user under Windows.
2488 2493
2489 2494 2003-05-12 Fernando Perez <fperez@colorado.edu>
2490 2495
2491 2496 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2492 2497 handler for Emacs comint-based lines. Currently it doesn't do
2493 2498 much (but importantly, it doesn't update the history cache). In
2494 2499 the future it may be expanded if Alex needs more functionality
2495 2500 there.
2496 2501
2497 2502 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2498 2503 info to crash reports.
2499 2504
2500 2505 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2501 2506 just like Python's -c. Also fixed crash with invalid -color
2502 2507 option value at startup. Thanks to Will French
2503 2508 <wfrench-AT-bestweb.net> for the bug report.
2504 2509
2505 2510 2003-05-09 Fernando Perez <fperez@colorado.edu>
2506 2511
2507 2512 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2508 2513 to EvalDict (it's a mapping, after all) and simplified its code
2509 2514 quite a bit, after a nice discussion on c.l.py where Gustavo
2510 2515 Córdova <gcordova-AT-sismex.com> suggested the new version.
2511 2516
2512 2517 2003-04-30 Fernando Perez <fperez@colorado.edu>
2513 2518
2514 2519 * IPython/genutils.py (timings_out): modified it to reduce its
2515 2520 overhead in the common reps==1 case.
2516 2521
2517 2522 2003-04-29 Fernando Perez <fperez@colorado.edu>
2518 2523
2519 2524 * IPython/genutils.py (timings_out): Modified to use the resource
2520 2525 module, which avoids the wraparound problems of time.clock().
2521 2526
2522 2527 2003-04-17 *** Released version 0.2.15pre4
2523 2528
2524 2529 2003-04-17 Fernando Perez <fperez@colorado.edu>
2525 2530
2526 2531 * setup.py (scriptfiles): Split windows-specific stuff over to a
2527 2532 separate file, in an attempt to have a Windows GUI installer.
2528 2533 That didn't work, but part of the groundwork is done.
2529 2534
2530 2535 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2531 2536 indent/unindent with 4 spaces. Particularly useful in combination
2532 2537 with the new auto-indent option.
2533 2538
2534 2539 2003-04-16 Fernando Perez <fperez@colorado.edu>
2535 2540
2536 2541 * IPython/Magic.py: various replacements of self.rc for
2537 2542 self.shell.rc. A lot more remains to be done to fully disentangle
2538 2543 this class from the main Shell class.
2539 2544
2540 2545 * IPython/GnuplotRuntime.py: added checks for mouse support so
2541 2546 that we don't try to enable it if the current gnuplot doesn't
2542 2547 really support it. Also added checks so that we don't try to
2543 2548 enable persist under Windows (where Gnuplot doesn't recognize the
2544 2549 option).
2545 2550
2546 2551 * IPython/iplib.py (InteractiveShell.interact): Added optional
2547 2552 auto-indenting code, after a patch by King C. Shu
2548 2553 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2549 2554 get along well with pasting indented code. If I ever figure out
2550 2555 how to make that part go well, it will become on by default.
2551 2556
2552 2557 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2553 2558 crash ipython if there was an unmatched '%' in the user's prompt
2554 2559 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2555 2560
2556 2561 * IPython/iplib.py (InteractiveShell.interact): removed the
2557 2562 ability to ask the user whether he wants to crash or not at the
2558 2563 'last line' exception handler. Calling functions at that point
2559 2564 changes the stack, and the error reports would have incorrect
2560 2565 tracebacks.
2561 2566
2562 2567 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2563 2568 pass through a peger a pretty-printed form of any object. After a
2564 2569 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2565 2570
2566 2571 2003-04-14 Fernando Perez <fperez@colorado.edu>
2567 2572
2568 2573 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2569 2574 all files in ~ would be modified at first install (instead of
2570 2575 ~/.ipython). This could be potentially disastrous, as the
2571 2576 modification (make line-endings native) could damage binary files.
2572 2577
2573 2578 2003-04-10 Fernando Perez <fperez@colorado.edu>
2574 2579
2575 2580 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2576 2581 handle only lines which are invalid python. This now means that
2577 2582 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2578 2583 for the bug report.
2579 2584
2580 2585 2003-04-01 Fernando Perez <fperez@colorado.edu>
2581 2586
2582 2587 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2583 2588 where failing to set sys.last_traceback would crash pdb.pm().
2584 2589 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2585 2590 report.
2586 2591
2587 2592 2003-03-25 Fernando Perez <fperez@colorado.edu>
2588 2593
2589 2594 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2590 2595 before printing it (it had a lot of spurious blank lines at the
2591 2596 end).
2592 2597
2593 2598 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2594 2599 output would be sent 21 times! Obviously people don't use this
2595 2600 too often, or I would have heard about it.
2596 2601
2597 2602 2003-03-24 Fernando Perez <fperez@colorado.edu>
2598 2603
2599 2604 * setup.py (scriptfiles): renamed the data_files parameter from
2600 2605 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2601 2606 for the patch.
2602 2607
2603 2608 2003-03-20 Fernando Perez <fperez@colorado.edu>
2604 2609
2605 2610 * IPython/genutils.py (error): added error() and fatal()
2606 2611 functions.
2607 2612
2608 2613 2003-03-18 *** Released version 0.2.15pre3
2609 2614
2610 2615 2003-03-18 Fernando Perez <fperez@colorado.edu>
2611 2616
2612 2617 * setupext/install_data_ext.py
2613 2618 (install_data_ext.initialize_options): Class contributed by Jack
2614 2619 Moffit for fixing the old distutils hack. He is sending this to
2615 2620 the distutils folks so in the future we may not need it as a
2616 2621 private fix.
2617 2622
2618 2623 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2619 2624 changes for Debian packaging. See his patch for full details.
2620 2625 The old distutils hack of making the ipythonrc* files carry a
2621 2626 bogus .py extension is gone, at last. Examples were moved to a
2622 2627 separate subdir under doc/, and the separate executable scripts
2623 2628 now live in their own directory. Overall a great cleanup. The
2624 2629 manual was updated to use the new files, and setup.py has been
2625 2630 fixed for this setup.
2626 2631
2627 2632 * IPython/PyColorize.py (Parser.usage): made non-executable and
2628 2633 created a pycolor wrapper around it to be included as a script.
2629 2634
2630 2635 2003-03-12 *** Released version 0.2.15pre2
2631 2636
2632 2637 2003-03-12 Fernando Perez <fperez@colorado.edu>
2633 2638
2634 2639 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2635 2640 long-standing problem with garbage characters in some terminals.
2636 2641 The issue was really that the \001 and \002 escapes must _only_ be
2637 2642 passed to input prompts (which call readline), but _never_ to
2638 2643 normal text to be printed on screen. I changed ColorANSI to have
2639 2644 two classes: TermColors and InputTermColors, each with the
2640 2645 appropriate escapes for input prompts or normal text. The code in
2641 2646 Prompts.py got slightly more complicated, but this very old and
2642 2647 annoying bug is finally fixed.
2643 2648
2644 2649 All the credit for nailing down the real origin of this problem
2645 2650 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2646 2651 *Many* thanks to him for spending quite a bit of effort on this.
2647 2652
2648 2653 2003-03-05 *** Released version 0.2.15pre1
2649 2654
2650 2655 2003-03-03 Fernando Perez <fperez@colorado.edu>
2651 2656
2652 2657 * IPython/FakeModule.py: Moved the former _FakeModule to a
2653 2658 separate file, because it's also needed by Magic (to fix a similar
2654 2659 pickle-related issue in @run).
2655 2660
2656 2661 2003-03-02 Fernando Perez <fperez@colorado.edu>
2657 2662
2658 2663 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2659 2664 the autocall option at runtime.
2660 2665 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2661 2666 across Magic.py to start separating Magic from InteractiveShell.
2662 2667 (Magic._ofind): Fixed to return proper namespace for dotted
2663 2668 names. Before, a dotted name would always return 'not currently
2664 2669 defined', because it would find the 'parent'. s.x would be found,
2665 2670 but since 'x' isn't defined by itself, it would get confused.
2666 2671 (Magic.magic_run): Fixed pickling problems reported by Ralf
2667 2672 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2668 2673 that I'd used when Mike Heeter reported similar issues at the
2669 2674 top-level, but now for @run. It boils down to injecting the
2670 2675 namespace where code is being executed with something that looks
2671 2676 enough like a module to fool pickle.dump(). Since a pickle stores
2672 2677 a named reference to the importing module, we need this for
2673 2678 pickles to save something sensible.
2674 2679
2675 2680 * IPython/ipmaker.py (make_IPython): added an autocall option.
2676 2681
2677 2682 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2678 2683 the auto-eval code. Now autocalling is an option, and the code is
2679 2684 also vastly safer. There is no more eval() involved at all.
2680 2685
2681 2686 2003-03-01 Fernando Perez <fperez@colorado.edu>
2682 2687
2683 2688 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2684 2689 dict with named keys instead of a tuple.
2685 2690
2686 2691 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2687 2692
2688 2693 * setup.py (make_shortcut): Fixed message about directories
2689 2694 created during Windows installation (the directories were ok, just
2690 2695 the printed message was misleading). Thanks to Chris Liechti
2691 2696 <cliechti-AT-gmx.net> for the heads up.
2692 2697
2693 2698 2003-02-21 Fernando Perez <fperez@colorado.edu>
2694 2699
2695 2700 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2696 2701 of ValueError exception when checking for auto-execution. This
2697 2702 one is raised by things like Numeric arrays arr.flat when the
2698 2703 array is non-contiguous.
2699 2704
2700 2705 2003-01-31 Fernando Perez <fperez@colorado.edu>
2701 2706
2702 2707 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2703 2708 not return any value at all (even though the command would get
2704 2709 executed).
2705 2710 (xsys): Flush stdout right after printing the command to ensure
2706 2711 proper ordering of commands and command output in the total
2707 2712 output.
2708 2713 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2709 2714 system/getoutput as defaults. The old ones are kept for
2710 2715 compatibility reasons, so no code which uses this library needs
2711 2716 changing.
2712 2717
2713 2718 2003-01-27 *** Released version 0.2.14
2714 2719
2715 2720 2003-01-25 Fernando Perez <fperez@colorado.edu>
2716 2721
2717 2722 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2718 2723 functions defined in previous edit sessions could not be re-edited
2719 2724 (because the temp files were immediately removed). Now temp files
2720 2725 are removed only at IPython's exit.
2721 2726 (Magic.magic_run): Improved @run to perform shell-like expansions
2722 2727 on its arguments (~users and $VARS). With this, @run becomes more
2723 2728 like a normal command-line.
2724 2729
2725 2730 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2726 2731 bugs related to embedding and cleaned up that code. A fairly
2727 2732 important one was the impossibility to access the global namespace
2728 2733 through the embedded IPython (only local variables were visible).
2729 2734
2730 2735 2003-01-14 Fernando Perez <fperez@colorado.edu>
2731 2736
2732 2737 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2733 2738 auto-calling to be a bit more conservative. Now it doesn't get
2734 2739 triggered if any of '!=()<>' are in the rest of the input line, to
2735 2740 allow comparing callables. Thanks to Alex for the heads up.
2736 2741
2737 2742 2003-01-07 Fernando Perez <fperez@colorado.edu>
2738 2743
2739 2744 * IPython/genutils.py (page): fixed estimation of the number of
2740 2745 lines in a string to be paged to simply count newlines. This
2741 2746 prevents over-guessing due to embedded escape sequences. A better
2742 2747 long-term solution would involve stripping out the control chars
2743 2748 for the count, but it's potentially so expensive I just don't
2744 2749 think it's worth doing.
2745 2750
2746 2751 2002-12-19 *** Released version 0.2.14pre50
2747 2752
2748 2753 2002-12-19 Fernando Perez <fperez@colorado.edu>
2749 2754
2750 2755 * tools/release (version): Changed release scripts to inform
2751 2756 Andrea and build a NEWS file with a list of recent changes.
2752 2757
2753 2758 * IPython/ColorANSI.py (__all__): changed terminal detection
2754 2759 code. Seems to work better for xterms without breaking
2755 2760 konsole. Will need more testing to determine if WinXP and Mac OSX
2756 2761 also work ok.
2757 2762
2758 2763 2002-12-18 *** Released version 0.2.14pre49
2759 2764
2760 2765 2002-12-18 Fernando Perez <fperez@colorado.edu>
2761 2766
2762 2767 * Docs: added new info about Mac OSX, from Andrea.
2763 2768
2764 2769 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2765 2770 allow direct plotting of python strings whose format is the same
2766 2771 of gnuplot data files.
2767 2772
2768 2773 2002-12-16 Fernando Perez <fperez@colorado.edu>
2769 2774
2770 2775 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2771 2776 value of exit question to be acknowledged.
2772 2777
2773 2778 2002-12-03 Fernando Perez <fperez@colorado.edu>
2774 2779
2775 2780 * IPython/ipmaker.py: removed generators, which had been added
2776 2781 by mistake in an earlier debugging run. This was causing trouble
2777 2782 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2778 2783 for pointing this out.
2779 2784
2780 2785 2002-11-17 Fernando Perez <fperez@colorado.edu>
2781 2786
2782 2787 * Manual: updated the Gnuplot section.
2783 2788
2784 2789 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2785 2790 a much better split of what goes in Runtime and what goes in
2786 2791 Interactive.
2787 2792
2788 2793 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2789 2794 being imported from iplib.
2790 2795
2791 2796 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2792 2797 for command-passing. Now the global Gnuplot instance is called
2793 2798 'gp' instead of 'g', which was really a far too fragile and
2794 2799 common name.
2795 2800
2796 2801 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2797 2802 bounding boxes generated by Gnuplot for square plots.
2798 2803
2799 2804 * IPython/genutils.py (popkey): new function added. I should
2800 2805 suggest this on c.l.py as a dict method, it seems useful.
2801 2806
2802 2807 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2803 2808 to transparently handle PostScript generation. MUCH better than
2804 2809 the previous plot_eps/replot_eps (which I removed now). The code
2805 2810 is also fairly clean and well documented now (including
2806 2811 docstrings).
2807 2812
2808 2813 2002-11-13 Fernando Perez <fperez@colorado.edu>
2809 2814
2810 2815 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2811 2816 (inconsistent with options).
2812 2817
2813 2818 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2814 2819 manually disabled, I don't know why. Fixed it.
2815 2820 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2816 2821 eps output.
2817 2822
2818 2823 2002-11-12 Fernando Perez <fperez@colorado.edu>
2819 2824
2820 2825 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2821 2826 don't propagate up to caller. Fixes crash reported by François
2822 2827 Pinard.
2823 2828
2824 2829 2002-11-09 Fernando Perez <fperez@colorado.edu>
2825 2830
2826 2831 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2827 2832 history file for new users.
2828 2833 (make_IPython): fixed bug where initial install would leave the
2829 2834 user running in the .ipython dir.
2830 2835 (make_IPython): fixed bug where config dir .ipython would be
2831 2836 created regardless of the given -ipythondir option. Thanks to Cory
2832 2837 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2833 2838
2834 2839 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2835 2840 type confirmations. Will need to use it in all of IPython's code
2836 2841 consistently.
2837 2842
2838 2843 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2839 2844 context to print 31 lines instead of the default 5. This will make
2840 2845 the crash reports extremely detailed in case the problem is in
2841 2846 libraries I don't have access to.
2842 2847
2843 2848 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2844 2849 line of defense' code to still crash, but giving users fair
2845 2850 warning. I don't want internal errors to go unreported: if there's
2846 2851 an internal problem, IPython should crash and generate a full
2847 2852 report.
2848 2853
2849 2854 2002-11-08 Fernando Perez <fperez@colorado.edu>
2850 2855
2851 2856 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2852 2857 otherwise uncaught exceptions which can appear if people set
2853 2858 sys.stdout to something badly broken. Thanks to a crash report
2854 2859 from henni-AT-mail.brainbot.com.
2855 2860
2856 2861 2002-11-04 Fernando Perez <fperez@colorado.edu>
2857 2862
2858 2863 * IPython/iplib.py (InteractiveShell.interact): added
2859 2864 __IPYTHON__active to the builtins. It's a flag which goes on when
2860 2865 the interaction starts and goes off again when it stops. This
2861 2866 allows embedding code to detect being inside IPython. Before this
2862 2867 was done via __IPYTHON__, but that only shows that an IPython
2863 2868 instance has been created.
2864 2869
2865 2870 * IPython/Magic.py (Magic.magic_env): I realized that in a
2866 2871 UserDict, instance.data holds the data as a normal dict. So I
2867 2872 modified @env to return os.environ.data instead of rebuilding a
2868 2873 dict by hand.
2869 2874
2870 2875 2002-11-02 Fernando Perez <fperez@colorado.edu>
2871 2876
2872 2877 * IPython/genutils.py (warn): changed so that level 1 prints no
2873 2878 header. Level 2 is now the default (with 'WARNING' header, as
2874 2879 before). I think I tracked all places where changes were needed in
2875 2880 IPython, but outside code using the old level numbering may have
2876 2881 broken.
2877 2882
2878 2883 * IPython/iplib.py (InteractiveShell.runcode): added this to
2879 2884 handle the tracebacks in SystemExit traps correctly. The previous
2880 2885 code (through interact) was printing more of the stack than
2881 2886 necessary, showing IPython internal code to the user.
2882 2887
2883 2888 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2884 2889 default. Now that the default at the confirmation prompt is yes,
2885 2890 it's not so intrusive. François' argument that ipython sessions
2886 2891 tend to be complex enough not to lose them from an accidental C-d,
2887 2892 is a valid one.
2888 2893
2889 2894 * IPython/iplib.py (InteractiveShell.interact): added a
2890 2895 showtraceback() call to the SystemExit trap, and modified the exit
2891 2896 confirmation to have yes as the default.
2892 2897
2893 2898 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2894 2899 this file. It's been gone from the code for a long time, this was
2895 2900 simply leftover junk.
2896 2901
2897 2902 2002-11-01 Fernando Perez <fperez@colorado.edu>
2898 2903
2899 2904 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2900 2905 added. If set, IPython now traps EOF and asks for
2901 2906 confirmation. After a request by François Pinard.
2902 2907
2903 2908 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2904 2909 of @abort, and with a new (better) mechanism for handling the
2905 2910 exceptions.
2906 2911
2907 2912 2002-10-27 Fernando Perez <fperez@colorado.edu>
2908 2913
2909 2914 * IPython/usage.py (__doc__): updated the --help information and
2910 2915 the ipythonrc file to indicate that -log generates
2911 2916 ./ipython.log. Also fixed the corresponding info in @logstart.
2912 2917 This and several other fixes in the manuals thanks to reports by
2913 2918 François Pinard <pinard-AT-iro.umontreal.ca>.
2914 2919
2915 2920 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2916 2921 refer to @logstart (instead of @log, which doesn't exist).
2917 2922
2918 2923 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2919 2924 AttributeError crash. Thanks to Christopher Armstrong
2920 2925 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2921 2926 introduced recently (in 0.2.14pre37) with the fix to the eval
2922 2927 problem mentioned below.
2923 2928
2924 2929 2002-10-17 Fernando Perez <fperez@colorado.edu>
2925 2930
2926 2931 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2927 2932 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2928 2933
2929 2934 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2930 2935 this function to fix a problem reported by Alex Schmolck. He saw
2931 2936 it with list comprehensions and generators, which were getting
2932 2937 called twice. The real problem was an 'eval' call in testing for
2933 2938 automagic which was evaluating the input line silently.
2934 2939
2935 2940 This is a potentially very nasty bug, if the input has side
2936 2941 effects which must not be repeated. The code is much cleaner now,
2937 2942 without any blanket 'except' left and with a regexp test for
2938 2943 actual function names.
2939 2944
2940 2945 But an eval remains, which I'm not fully comfortable with. I just
2941 2946 don't know how to find out if an expression could be a callable in
2942 2947 the user's namespace without doing an eval on the string. However
2943 2948 that string is now much more strictly checked so that no code
2944 2949 slips by, so the eval should only happen for things that can
2945 2950 really be only function/method names.
2946 2951
2947 2952 2002-10-15 Fernando Perez <fperez@colorado.edu>
2948 2953
2949 2954 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2950 2955 OSX information to main manual, removed README_Mac_OSX file from
2951 2956 distribution. Also updated credits for recent additions.
2952 2957
2953 2958 2002-10-10 Fernando Perez <fperez@colorado.edu>
2954 2959
2955 2960 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2956 2961 terminal-related issues. Many thanks to Andrea Riciputi
2957 2962 <andrea.riciputi-AT-libero.it> for writing it.
2958 2963
2959 2964 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2960 2965 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2961 2966
2962 2967 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2963 2968 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2964 2969 <syver-en-AT-online.no> who both submitted patches for this problem.
2965 2970
2966 2971 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2967 2972 global embedding to make sure that things don't overwrite user
2968 2973 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2969 2974
2970 2975 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2971 2976 compatibility. Thanks to Hayden Callow
2972 2977 <h.callow-AT-elec.canterbury.ac.nz>
2973 2978
2974 2979 2002-10-04 Fernando Perez <fperez@colorado.edu>
2975 2980
2976 2981 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2977 2982 Gnuplot.File objects.
2978 2983
2979 2984 2002-07-23 Fernando Perez <fperez@colorado.edu>
2980 2985
2981 2986 * IPython/genutils.py (timing): Added timings() and timing() for
2982 2987 quick access to the most commonly needed data, the execution
2983 2988 times. Old timing() renamed to timings_out().
2984 2989
2985 2990 2002-07-18 Fernando Perez <fperez@colorado.edu>
2986 2991
2987 2992 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2988 2993 bug with nested instances disrupting the parent's tab completion.
2989 2994
2990 2995 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2991 2996 all_completions code to begin the emacs integration.
2992 2997
2993 2998 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2994 2999 argument to allow titling individual arrays when plotting.
2995 3000
2996 3001 2002-07-15 Fernando Perez <fperez@colorado.edu>
2997 3002
2998 3003 * setup.py (make_shortcut): changed to retrieve the value of
2999 3004 'Program Files' directory from the registry (this value changes in
3000 3005 non-english versions of Windows). Thanks to Thomas Fanslau
3001 3006 <tfanslau-AT-gmx.de> for the report.
3002 3007
3003 3008 2002-07-10 Fernando Perez <fperez@colorado.edu>
3004 3009
3005 3010 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3006 3011 a bug in pdb, which crashes if a line with only whitespace is
3007 3012 entered. Bug report submitted to sourceforge.
3008 3013
3009 3014 2002-07-09 Fernando Perez <fperez@colorado.edu>
3010 3015
3011 3016 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3012 3017 reporting exceptions (it's a bug in inspect.py, I just set a
3013 3018 workaround).
3014 3019
3015 3020 2002-07-08 Fernando Perez <fperez@colorado.edu>
3016 3021
3017 3022 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3018 3023 __IPYTHON__ in __builtins__ to show up in user_ns.
3019 3024
3020 3025 2002-07-03 Fernando Perez <fperez@colorado.edu>
3021 3026
3022 3027 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3023 3028 name from @gp_set_instance to @gp_set_default.
3024 3029
3025 3030 * IPython/ipmaker.py (make_IPython): default editor value set to
3026 3031 '0' (a string), to match the rc file. Otherwise will crash when
3027 3032 .strip() is called on it.
3028 3033
3029 3034
3030 3035 2002-06-28 Fernando Perez <fperez@colorado.edu>
3031 3036
3032 3037 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3033 3038 of files in current directory when a file is executed via
3034 3039 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3035 3040
3036 3041 * setup.py (manfiles): fix for rpm builds, submitted by RA
3037 3042 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3038 3043
3039 3044 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3040 3045 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3041 3046 string!). A. Schmolck caught this one.
3042 3047
3043 3048 2002-06-27 Fernando Perez <fperez@colorado.edu>
3044 3049
3045 3050 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3046 3051 defined files at the cmd line. __name__ wasn't being set to
3047 3052 __main__.
3048 3053
3049 3054 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3050 3055 regular lists and tuples besides Numeric arrays.
3051 3056
3052 3057 * IPython/Prompts.py (CachedOutput.__call__): Added output
3053 3058 supression for input ending with ';'. Similar to Mathematica and
3054 3059 Matlab. The _* vars and Out[] list are still updated, just like
3055 3060 Mathematica behaves.
3056 3061
3057 3062 2002-06-25 Fernando Perez <fperez@colorado.edu>
3058 3063
3059 3064 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3060 3065 .ini extensions for profiels under Windows.
3061 3066
3062 3067 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3063 3068 string form. Fix contributed by Alexander Schmolck
3064 3069 <a.schmolck-AT-gmx.net>
3065 3070
3066 3071 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3067 3072 pre-configured Gnuplot instance.
3068 3073
3069 3074 2002-06-21 Fernando Perez <fperez@colorado.edu>
3070 3075
3071 3076 * IPython/numutils.py (exp_safe): new function, works around the
3072 3077 underflow problems in Numeric.
3073 3078 (log2): New fn. Safe log in base 2: returns exact integer answer
3074 3079 for exact integer powers of 2.
3075 3080
3076 3081 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3077 3082 properly.
3078 3083
3079 3084 2002-06-20 Fernando Perez <fperez@colorado.edu>
3080 3085
3081 3086 * IPython/genutils.py (timing): new function like
3082 3087 Mathematica's. Similar to time_test, but returns more info.
3083 3088
3084 3089 2002-06-18 Fernando Perez <fperez@colorado.edu>
3085 3090
3086 3091 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3087 3092 according to Mike Heeter's suggestions.
3088 3093
3089 3094 2002-06-16 Fernando Perez <fperez@colorado.edu>
3090 3095
3091 3096 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3092 3097 system. GnuplotMagic is gone as a user-directory option. New files
3093 3098 make it easier to use all the gnuplot stuff both from external
3094 3099 programs as well as from IPython. Had to rewrite part of
3095 3100 hardcopy() b/c of a strange bug: often the ps files simply don't
3096 3101 get created, and require a repeat of the command (often several
3097 3102 times).
3098 3103
3099 3104 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3100 3105 resolve output channel at call time, so that if sys.stderr has
3101 3106 been redirected by user this gets honored.
3102 3107
3103 3108 2002-06-13 Fernando Perez <fperez@colorado.edu>
3104 3109
3105 3110 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3106 3111 IPShell. Kept a copy with the old names to avoid breaking people's
3107 3112 embedded code.
3108 3113
3109 3114 * IPython/ipython: simplified it to the bare minimum after
3110 3115 Holger's suggestions. Added info about how to use it in
3111 3116 PYTHONSTARTUP.
3112 3117
3113 3118 * IPython/Shell.py (IPythonShell): changed the options passing
3114 3119 from a string with funky %s replacements to a straight list. Maybe
3115 3120 a bit more typing, but it follows sys.argv conventions, so there's
3116 3121 less special-casing to remember.
3117 3122
3118 3123 2002-06-12 Fernando Perez <fperez@colorado.edu>
3119 3124
3120 3125 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3121 3126 command. Thanks to a suggestion by Mike Heeter.
3122 3127 (Magic.magic_pfile): added behavior to look at filenames if given
3123 3128 arg is not a defined object.
3124 3129 (Magic.magic_save): New @save function to save code snippets. Also
3125 3130 a Mike Heeter idea.
3126 3131
3127 3132 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3128 3133 plot() and replot(). Much more convenient now, especially for
3129 3134 interactive use.
3130 3135
3131 3136 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3132 3137 filenames.
3133 3138
3134 3139 2002-06-02 Fernando Perez <fperez@colorado.edu>
3135 3140
3136 3141 * IPython/Struct.py (Struct.__init__): modified to admit
3137 3142 initialization via another struct.
3138 3143
3139 3144 * IPython/genutils.py (SystemExec.__init__): New stateful
3140 3145 interface to xsys and bq. Useful for writing system scripts.
3141 3146
3142 3147 2002-05-30 Fernando Perez <fperez@colorado.edu>
3143 3148
3144 3149 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3145 3150 documents. This will make the user download smaller (it's getting
3146 3151 too big).
3147 3152
3148 3153 2002-05-29 Fernando Perez <fperez@colorado.edu>
3149 3154
3150 3155 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3151 3156 fix problems with shelve and pickle. Seems to work, but I don't
3152 3157 know if corner cases break it. Thanks to Mike Heeter
3153 3158 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3154 3159
3155 3160 2002-05-24 Fernando Perez <fperez@colorado.edu>
3156 3161
3157 3162 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3158 3163 macros having broken.
3159 3164
3160 3165 2002-05-21 Fernando Perez <fperez@colorado.edu>
3161 3166
3162 3167 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3163 3168 introduced logging bug: all history before logging started was
3164 3169 being written one character per line! This came from the redesign
3165 3170 of the input history as a special list which slices to strings,
3166 3171 not to lists.
3167 3172
3168 3173 2002-05-20 Fernando Perez <fperez@colorado.edu>
3169 3174
3170 3175 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3171 3176 be an attribute of all classes in this module. The design of these
3172 3177 classes needs some serious overhauling.
3173 3178
3174 3179 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3175 3180 which was ignoring '_' in option names.
3176 3181
3177 3182 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3178 3183 'Verbose_novars' to 'Context' and made it the new default. It's a
3179 3184 bit more readable and also safer than verbose.
3180 3185
3181 3186 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3182 3187 triple-quoted strings.
3183 3188
3184 3189 * IPython/OInspect.py (__all__): new module exposing the object
3185 3190 introspection facilities. Now the corresponding magics are dummy
3186 3191 wrappers around this. Having this module will make it much easier
3187 3192 to put these functions into our modified pdb.
3188 3193 This new object inspector system uses the new colorizing module,
3189 3194 so source code and other things are nicely syntax highlighted.
3190 3195
3191 3196 2002-05-18 Fernando Perez <fperez@colorado.edu>
3192 3197
3193 3198 * IPython/ColorANSI.py: Split the coloring tools into a separate
3194 3199 module so I can use them in other code easier (they were part of
3195 3200 ultraTB).
3196 3201
3197 3202 2002-05-17 Fernando Perez <fperez@colorado.edu>
3198 3203
3199 3204 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3200 3205 fixed it to set the global 'g' also to the called instance, as
3201 3206 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3202 3207 user's 'g' variables).
3203 3208
3204 3209 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3205 3210 global variables (aliases to _ih,_oh) so that users which expect
3206 3211 In[5] or Out[7] to work aren't unpleasantly surprised.
3207 3212 (InputList.__getslice__): new class to allow executing slices of
3208 3213 input history directly. Very simple class, complements the use of
3209 3214 macros.
3210 3215
3211 3216 2002-05-16 Fernando Perez <fperez@colorado.edu>
3212 3217
3213 3218 * setup.py (docdirbase): make doc directory be just doc/IPython
3214 3219 without version numbers, it will reduce clutter for users.
3215 3220
3216 3221 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3217 3222 execfile call to prevent possible memory leak. See for details:
3218 3223 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3219 3224
3220 3225 2002-05-15 Fernando Perez <fperez@colorado.edu>
3221 3226
3222 3227 * IPython/Magic.py (Magic.magic_psource): made the object
3223 3228 introspection names be more standard: pdoc, pdef, pfile and
3224 3229 psource. They all print/page their output, and it makes
3225 3230 remembering them easier. Kept old names for compatibility as
3226 3231 aliases.
3227 3232
3228 3233 2002-05-14 Fernando Perez <fperez@colorado.edu>
3229 3234
3230 3235 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3231 3236 what the mouse problem was. The trick is to use gnuplot with temp
3232 3237 files and NOT with pipes (for data communication), because having
3233 3238 both pipes and the mouse on is bad news.
3234 3239
3235 3240 2002-05-13 Fernando Perez <fperez@colorado.edu>
3236 3241
3237 3242 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3238 3243 bug. Information would be reported about builtins even when
3239 3244 user-defined functions overrode them.
3240 3245
3241 3246 2002-05-11 Fernando Perez <fperez@colorado.edu>
3242 3247
3243 3248 * IPython/__init__.py (__all__): removed FlexCompleter from
3244 3249 __all__ so that things don't fail in platforms without readline.
3245 3250
3246 3251 2002-05-10 Fernando Perez <fperez@colorado.edu>
3247 3252
3248 3253 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3249 3254 it requires Numeric, effectively making Numeric a dependency for
3250 3255 IPython.
3251 3256
3252 3257 * Released 0.2.13
3253 3258
3254 3259 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3255 3260 profiler interface. Now all the major options from the profiler
3256 3261 module are directly supported in IPython, both for single
3257 3262 expressions (@prun) and for full programs (@run -p).
3258 3263
3259 3264 2002-05-09 Fernando Perez <fperez@colorado.edu>
3260 3265
3261 3266 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3262 3267 magic properly formatted for screen.
3263 3268
3264 3269 * setup.py (make_shortcut): Changed things to put pdf version in
3265 3270 doc/ instead of doc/manual (had to change lyxport a bit).
3266 3271
3267 3272 * IPython/Magic.py (Profile.string_stats): made profile runs go
3268 3273 through pager (they are long and a pager allows searching, saving,
3269 3274 etc.)
3270 3275
3271 3276 2002-05-08 Fernando Perez <fperez@colorado.edu>
3272 3277
3273 3278 * Released 0.2.12
3274 3279
3275 3280 2002-05-06 Fernando Perez <fperez@colorado.edu>
3276 3281
3277 3282 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3278 3283 introduced); 'hist n1 n2' was broken.
3279 3284 (Magic.magic_pdb): added optional on/off arguments to @pdb
3280 3285 (Magic.magic_run): added option -i to @run, which executes code in
3281 3286 the IPython namespace instead of a clean one. Also added @irun as
3282 3287 an alias to @run -i.
3283 3288
3284 3289 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3285 3290 fixed (it didn't really do anything, the namespaces were wrong).
3286 3291
3287 3292 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3288 3293
3289 3294 * IPython/__init__.py (__all__): Fixed package namespace, now
3290 3295 'import IPython' does give access to IPython.<all> as
3291 3296 expected. Also renamed __release__ to Release.
3292 3297
3293 3298 * IPython/Debugger.py (__license__): created new Pdb class which
3294 3299 functions like a drop-in for the normal pdb.Pdb but does NOT
3295 3300 import readline by default. This way it doesn't muck up IPython's
3296 3301 readline handling, and now tab-completion finally works in the
3297 3302 debugger -- sort of. It completes things globally visible, but the
3298 3303 completer doesn't track the stack as pdb walks it. That's a bit
3299 3304 tricky, and I'll have to implement it later.
3300 3305
3301 3306 2002-05-05 Fernando Perez <fperez@colorado.edu>
3302 3307
3303 3308 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3304 3309 magic docstrings when printed via ? (explicit \'s were being
3305 3310 printed).
3306 3311
3307 3312 * IPython/ipmaker.py (make_IPython): fixed namespace
3308 3313 identification bug. Now variables loaded via logs or command-line
3309 3314 files are recognized in the interactive namespace by @who.
3310 3315
3311 3316 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3312 3317 log replay system stemming from the string form of Structs.
3313 3318
3314 3319 * IPython/Magic.py (Macro.__init__): improved macros to properly
3315 3320 handle magic commands in them.
3316 3321 (Magic.magic_logstart): usernames are now expanded so 'logstart
3317 3322 ~/mylog' now works.
3318 3323
3319 3324 * IPython/iplib.py (complete): fixed bug where paths starting with
3320 3325 '/' would be completed as magic names.
3321 3326
3322 3327 2002-05-04 Fernando Perez <fperez@colorado.edu>
3323 3328
3324 3329 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3325 3330 allow running full programs under the profiler's control.
3326 3331
3327 3332 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3328 3333 mode to report exceptions verbosely but without formatting
3329 3334 variables. This addresses the issue of ipython 'freezing' (it's
3330 3335 not frozen, but caught in an expensive formatting loop) when huge
3331 3336 variables are in the context of an exception.
3332 3337 (VerboseTB.text): Added '--->' markers at line where exception was
3333 3338 triggered. Much clearer to read, especially in NoColor modes.
3334 3339
3335 3340 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3336 3341 implemented in reverse when changing to the new parse_options().
3337 3342
3338 3343 2002-05-03 Fernando Perez <fperez@colorado.edu>
3339 3344
3340 3345 * IPython/Magic.py (Magic.parse_options): new function so that
3341 3346 magics can parse options easier.
3342 3347 (Magic.magic_prun): new function similar to profile.run(),
3343 3348 suggested by Chris Hart.
3344 3349 (Magic.magic_cd): fixed behavior so that it only changes if
3345 3350 directory actually is in history.
3346 3351
3347 3352 * IPython/usage.py (__doc__): added information about potential
3348 3353 slowness of Verbose exception mode when there are huge data
3349 3354 structures to be formatted (thanks to Archie Paulson).
3350 3355
3351 3356 * IPython/ipmaker.py (make_IPython): Changed default logging
3352 3357 (when simply called with -log) to use curr_dir/ipython.log in
3353 3358 rotate mode. Fixed crash which was occuring with -log before
3354 3359 (thanks to Jim Boyle).
3355 3360
3356 3361 2002-05-01 Fernando Perez <fperez@colorado.edu>
3357 3362
3358 3363 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3359 3364 was nasty -- though somewhat of a corner case).
3360 3365
3361 3366 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3362 3367 text (was a bug).
3363 3368
3364 3369 2002-04-30 Fernando Perez <fperez@colorado.edu>
3365 3370
3366 3371 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3367 3372 a print after ^D or ^C from the user so that the In[] prompt
3368 3373 doesn't over-run the gnuplot one.
3369 3374
3370 3375 2002-04-29 Fernando Perez <fperez@colorado.edu>
3371 3376
3372 3377 * Released 0.2.10
3373 3378
3374 3379 * IPython/__release__.py (version): get date dynamically.
3375 3380
3376 3381 * Misc. documentation updates thanks to Arnd's comments. Also ran
3377 3382 a full spellcheck on the manual (hadn't been done in a while).
3378 3383
3379 3384 2002-04-27 Fernando Perez <fperez@colorado.edu>
3380 3385
3381 3386 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3382 3387 starting a log in mid-session would reset the input history list.
3383 3388
3384 3389 2002-04-26 Fernando Perez <fperez@colorado.edu>
3385 3390
3386 3391 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3387 3392 all files were being included in an update. Now anything in
3388 3393 UserConfig that matches [A-Za-z]*.py will go (this excludes
3389 3394 __init__.py)
3390 3395
3391 3396 2002-04-25 Fernando Perez <fperez@colorado.edu>
3392 3397
3393 3398 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3394 3399 to __builtins__ so that any form of embedded or imported code can
3395 3400 test for being inside IPython.
3396 3401
3397 3402 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3398 3403 changed to GnuplotMagic because it's now an importable module,
3399 3404 this makes the name follow that of the standard Gnuplot module.
3400 3405 GnuplotMagic can now be loaded at any time in mid-session.
3401 3406
3402 3407 2002-04-24 Fernando Perez <fperez@colorado.edu>
3403 3408
3404 3409 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3405 3410 the globals (IPython has its own namespace) and the
3406 3411 PhysicalQuantity stuff is much better anyway.
3407 3412
3408 3413 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3409 3414 embedding example to standard user directory for
3410 3415 distribution. Also put it in the manual.
3411 3416
3412 3417 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3413 3418 instance as first argument (so it doesn't rely on some obscure
3414 3419 hidden global).
3415 3420
3416 3421 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3417 3422 delimiters. While it prevents ().TAB from working, it allows
3418 3423 completions in open (... expressions. This is by far a more common
3419 3424 case.
3420 3425
3421 3426 2002-04-23 Fernando Perez <fperez@colorado.edu>
3422 3427
3423 3428 * IPython/Extensions/InterpreterPasteInput.py: new
3424 3429 syntax-processing module for pasting lines with >>> or ... at the
3425 3430 start.
3426 3431
3427 3432 * IPython/Extensions/PhysicalQ_Interactive.py
3428 3433 (PhysicalQuantityInteractive.__int__): fixed to work with either
3429 3434 Numeric or math.
3430 3435
3431 3436 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3432 3437 provided profiles. Now we have:
3433 3438 -math -> math module as * and cmath with its own namespace.
3434 3439 -numeric -> Numeric as *, plus gnuplot & grace
3435 3440 -physics -> same as before
3436 3441
3437 3442 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3438 3443 user-defined magics wouldn't be found by @magic if they were
3439 3444 defined as class methods. Also cleaned up the namespace search
3440 3445 logic and the string building (to use %s instead of many repeated
3441 3446 string adds).
3442 3447
3443 3448 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3444 3449 of user-defined magics to operate with class methods (cleaner, in
3445 3450 line with the gnuplot code).
3446 3451
3447 3452 2002-04-22 Fernando Perez <fperez@colorado.edu>
3448 3453
3449 3454 * setup.py: updated dependency list so that manual is updated when
3450 3455 all included files change.
3451 3456
3452 3457 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3453 3458 the delimiter removal option (the fix is ugly right now).
3454 3459
3455 3460 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3456 3461 all of the math profile (quicker loading, no conflict between
3457 3462 g-9.8 and g-gnuplot).
3458 3463
3459 3464 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3460 3465 name of post-mortem files to IPython_crash_report.txt.
3461 3466
3462 3467 * Cleanup/update of the docs. Added all the new readline info and
3463 3468 formatted all lists as 'real lists'.
3464 3469
3465 3470 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3466 3471 tab-completion options, since the full readline parse_and_bind is
3467 3472 now accessible.
3468 3473
3469 3474 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3470 3475 handling of readline options. Now users can specify any string to
3471 3476 be passed to parse_and_bind(), as well as the delimiters to be
3472 3477 removed.
3473 3478 (InteractiveShell.__init__): Added __name__ to the global
3474 3479 namespace so that things like Itpl which rely on its existence
3475 3480 don't crash.
3476 3481 (InteractiveShell._prefilter): Defined the default with a _ so
3477 3482 that prefilter() is easier to override, while the default one
3478 3483 remains available.
3479 3484
3480 3485 2002-04-18 Fernando Perez <fperez@colorado.edu>
3481 3486
3482 3487 * Added information about pdb in the docs.
3483 3488
3484 3489 2002-04-17 Fernando Perez <fperez@colorado.edu>
3485 3490
3486 3491 * IPython/ipmaker.py (make_IPython): added rc_override option to
3487 3492 allow passing config options at creation time which may override
3488 3493 anything set in the config files or command line. This is
3489 3494 particularly useful for configuring embedded instances.
3490 3495
3491 3496 2002-04-15 Fernando Perez <fperez@colorado.edu>
3492 3497
3493 3498 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3494 3499 crash embedded instances because of the input cache falling out of
3495 3500 sync with the output counter.
3496 3501
3497 3502 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3498 3503 mode which calls pdb after an uncaught exception in IPython itself.
3499 3504
3500 3505 2002-04-14 Fernando Perez <fperez@colorado.edu>
3501 3506
3502 3507 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3503 3508 readline, fix it back after each call.
3504 3509
3505 3510 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3506 3511 method to force all access via __call__(), which guarantees that
3507 3512 traceback references are properly deleted.
3508 3513
3509 3514 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3510 3515 improve printing when pprint is in use.
3511 3516
3512 3517 2002-04-13 Fernando Perez <fperez@colorado.edu>
3513 3518
3514 3519 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3515 3520 exceptions aren't caught anymore. If the user triggers one, he
3516 3521 should know why he's doing it and it should go all the way up,
3517 3522 just like any other exception. So now @abort will fully kill the
3518 3523 embedded interpreter and the embedding code (unless that happens
3519 3524 to catch SystemExit).
3520 3525
3521 3526 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3522 3527 and a debugger() method to invoke the interactive pdb debugger
3523 3528 after printing exception information. Also added the corresponding
3524 3529 -pdb option and @pdb magic to control this feature, and updated
3525 3530 the docs. After a suggestion from Christopher Hart
3526 3531 (hart-AT-caltech.edu).
3527 3532
3528 3533 2002-04-12 Fernando Perez <fperez@colorado.edu>
3529 3534
3530 3535 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3531 3536 the exception handlers defined by the user (not the CrashHandler)
3532 3537 so that user exceptions don't trigger an ipython bug report.
3533 3538
3534 3539 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3535 3540 configurable (it should have always been so).
3536 3541
3537 3542 2002-03-26 Fernando Perez <fperez@colorado.edu>
3538 3543
3539 3544 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3540 3545 and there to fix embedding namespace issues. This should all be
3541 3546 done in a more elegant way.
3542 3547
3543 3548 2002-03-25 Fernando Perez <fperez@colorado.edu>
3544 3549
3545 3550 * IPython/genutils.py (get_home_dir): Try to make it work under
3546 3551 win9x also.
3547 3552
3548 3553 2002-03-20 Fernando Perez <fperez@colorado.edu>
3549 3554
3550 3555 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3551 3556 sys.displayhook untouched upon __init__.
3552 3557
3553 3558 2002-03-19 Fernando Perez <fperez@colorado.edu>
3554 3559
3555 3560 * Released 0.2.9 (for embedding bug, basically).
3556 3561
3557 3562 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3558 3563 exceptions so that enclosing shell's state can be restored.
3559 3564
3560 3565 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3561 3566 naming conventions in the .ipython/ dir.
3562 3567
3563 3568 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3564 3569 from delimiters list so filenames with - in them get expanded.
3565 3570
3566 3571 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3567 3572 sys.displayhook not being properly restored after an embedded call.
3568 3573
3569 3574 2002-03-18 Fernando Perez <fperez@colorado.edu>
3570 3575
3571 3576 * Released 0.2.8
3572 3577
3573 3578 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3574 3579 some files weren't being included in a -upgrade.
3575 3580 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3576 3581 on' so that the first tab completes.
3577 3582 (InteractiveShell.handle_magic): fixed bug with spaces around
3578 3583 quotes breaking many magic commands.
3579 3584
3580 3585 * setup.py: added note about ignoring the syntax error messages at
3581 3586 installation.
3582 3587
3583 3588 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3584 3589 streamlining the gnuplot interface, now there's only one magic @gp.
3585 3590
3586 3591 2002-03-17 Fernando Perez <fperez@colorado.edu>
3587 3592
3588 3593 * IPython/UserConfig/magic_gnuplot.py: new name for the
3589 3594 example-magic_pm.py file. Much enhanced system, now with a shell
3590 3595 for communicating directly with gnuplot, one command at a time.
3591 3596
3592 3597 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3593 3598 setting __name__=='__main__'.
3594 3599
3595 3600 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3596 3601 mini-shell for accessing gnuplot from inside ipython. Should
3597 3602 extend it later for grace access too. Inspired by Arnd's
3598 3603 suggestion.
3599 3604
3600 3605 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3601 3606 calling magic functions with () in their arguments. Thanks to Arnd
3602 3607 Baecker for pointing this to me.
3603 3608
3604 3609 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3605 3610 infinitely for integer or complex arrays (only worked with floats).
3606 3611
3607 3612 2002-03-16 Fernando Perez <fperez@colorado.edu>
3608 3613
3609 3614 * setup.py: Merged setup and setup_windows into a single script
3610 3615 which properly handles things for windows users.
3611 3616
3612 3617 2002-03-15 Fernando Perez <fperez@colorado.edu>
3613 3618
3614 3619 * Big change to the manual: now the magics are all automatically
3615 3620 documented. This information is generated from their docstrings
3616 3621 and put in a latex file included by the manual lyx file. This way
3617 3622 we get always up to date information for the magics. The manual
3618 3623 now also has proper version information, also auto-synced.
3619 3624
3620 3625 For this to work, an undocumented --magic_docstrings option was added.
3621 3626
3622 3627 2002-03-13 Fernando Perez <fperez@colorado.edu>
3623 3628
3624 3629 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3625 3630 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3626 3631
3627 3632 2002-03-12 Fernando Perez <fperez@colorado.edu>
3628 3633
3629 3634 * IPython/ultraTB.py (TermColors): changed color escapes again to
3630 3635 fix the (old, reintroduced) line-wrapping bug. Basically, if
3631 3636 \001..\002 aren't given in the color escapes, lines get wrapped
3632 3637 weirdly. But giving those screws up old xterms and emacs terms. So
3633 3638 I added some logic for emacs terms to be ok, but I can't identify old
3634 3639 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3635 3640
3636 3641 2002-03-10 Fernando Perez <fperez@colorado.edu>
3637 3642
3638 3643 * IPython/usage.py (__doc__): Various documentation cleanups and
3639 3644 updates, both in usage docstrings and in the manual.
3640 3645
3641 3646 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3642 3647 handling of caching. Set minimum acceptabe value for having a
3643 3648 cache at 20 values.
3644 3649
3645 3650 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3646 3651 install_first_time function to a method, renamed it and added an
3647 3652 'upgrade' mode. Now people can update their config directory with
3648 3653 a simple command line switch (-upgrade, also new).
3649 3654
3650 3655 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3651 3656 @file (convenient for automagic users under Python >= 2.2).
3652 3657 Removed @files (it seemed more like a plural than an abbrev. of
3653 3658 'file show').
3654 3659
3655 3660 * IPython/iplib.py (install_first_time): Fixed crash if there were
3656 3661 backup files ('~') in .ipython/ install directory.
3657 3662
3658 3663 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3659 3664 system. Things look fine, but these changes are fairly
3660 3665 intrusive. Test them for a few days.
3661 3666
3662 3667 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3663 3668 the prompts system. Now all in/out prompt strings are user
3664 3669 controllable. This is particularly useful for embedding, as one
3665 3670 can tag embedded instances with particular prompts.
3666 3671
3667 3672 Also removed global use of sys.ps1/2, which now allows nested
3668 3673 embeddings without any problems. Added command-line options for
3669 3674 the prompt strings.
3670 3675
3671 3676 2002-03-08 Fernando Perez <fperez@colorado.edu>
3672 3677
3673 3678 * IPython/UserConfig/example-embed-short.py (ipshell): added
3674 3679 example file with the bare minimum code for embedding.
3675 3680
3676 3681 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3677 3682 functionality for the embeddable shell to be activated/deactivated
3678 3683 either globally or at each call.
3679 3684
3680 3685 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3681 3686 rewriting the prompt with '--->' for auto-inputs with proper
3682 3687 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3683 3688 this is handled by the prompts class itself, as it should.
3684 3689
3685 3690 2002-03-05 Fernando Perez <fperez@colorado.edu>
3686 3691
3687 3692 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3688 3693 @logstart to avoid name clashes with the math log function.
3689 3694
3690 3695 * Big updates to X/Emacs section of the manual.
3691 3696
3692 3697 * Removed ipython_emacs. Milan explained to me how to pass
3693 3698 arguments to ipython through Emacs. Some day I'm going to end up
3694 3699 learning some lisp...
3695 3700
3696 3701 2002-03-04 Fernando Perez <fperez@colorado.edu>
3697 3702
3698 3703 * IPython/ipython_emacs: Created script to be used as the
3699 3704 py-python-command Emacs variable so we can pass IPython
3700 3705 parameters. I can't figure out how to tell Emacs directly to pass
3701 3706 parameters to IPython, so a dummy shell script will do it.
3702 3707
3703 3708 Other enhancements made for things to work better under Emacs'
3704 3709 various types of terminals. Many thanks to Milan Zamazal
3705 3710 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3706 3711
3707 3712 2002-03-01 Fernando Perez <fperez@colorado.edu>
3708 3713
3709 3714 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3710 3715 that loading of readline is now optional. This gives better
3711 3716 control to emacs users.
3712 3717
3713 3718 * IPython/ultraTB.py (__date__): Modified color escape sequences
3714 3719 and now things work fine under xterm and in Emacs' term buffers
3715 3720 (though not shell ones). Well, in emacs you get colors, but all
3716 3721 seem to be 'light' colors (no difference between dark and light
3717 3722 ones). But the garbage chars are gone, and also in xterms. It
3718 3723 seems that now I'm using 'cleaner' ansi sequences.
3719 3724
3720 3725 2002-02-21 Fernando Perez <fperez@colorado.edu>
3721 3726
3722 3727 * Released 0.2.7 (mainly to publish the scoping fix).
3723 3728
3724 3729 * IPython/Logger.py (Logger.logstate): added. A corresponding
3725 3730 @logstate magic was created.
3726 3731
3727 3732 * IPython/Magic.py: fixed nested scoping problem under Python
3728 3733 2.1.x (automagic wasn't working).
3729 3734
3730 3735 2002-02-20 Fernando Perez <fperez@colorado.edu>
3731 3736
3732 3737 * Released 0.2.6.
3733 3738
3734 3739 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3735 3740 option so that logs can come out without any headers at all.
3736 3741
3737 3742 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3738 3743 SciPy.
3739 3744
3740 3745 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3741 3746 that embedded IPython calls don't require vars() to be explicitly
3742 3747 passed. Now they are extracted from the caller's frame (code
3743 3748 snatched from Eric Jones' weave). Added better documentation to
3744 3749 the section on embedding and the example file.
3745 3750
3746 3751 * IPython/genutils.py (page): Changed so that under emacs, it just
3747 3752 prints the string. You can then page up and down in the emacs
3748 3753 buffer itself. This is how the builtin help() works.
3749 3754
3750 3755 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3751 3756 macro scoping: macros need to be executed in the user's namespace
3752 3757 to work as if they had been typed by the user.
3753 3758
3754 3759 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3755 3760 execute automatically (no need to type 'exec...'). They then
3756 3761 behave like 'true macros'. The printing system was also modified
3757 3762 for this to work.
3758 3763
3759 3764 2002-02-19 Fernando Perez <fperez@colorado.edu>
3760 3765
3761 3766 * IPython/genutils.py (page_file): new function for paging files
3762 3767 in an OS-independent way. Also necessary for file viewing to work
3763 3768 well inside Emacs buffers.
3764 3769 (page): Added checks for being in an emacs buffer.
3765 3770 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3766 3771 same bug in iplib.
3767 3772
3768 3773 2002-02-18 Fernando Perez <fperez@colorado.edu>
3769 3774
3770 3775 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3771 3776 of readline so that IPython can work inside an Emacs buffer.
3772 3777
3773 3778 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3774 3779 method signatures (they weren't really bugs, but it looks cleaner
3775 3780 and keeps PyChecker happy).
3776 3781
3777 3782 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3778 3783 for implementing various user-defined hooks. Currently only
3779 3784 display is done.
3780 3785
3781 3786 * IPython/Prompts.py (CachedOutput._display): changed display
3782 3787 functions so that they can be dynamically changed by users easily.
3783 3788
3784 3789 * IPython/Extensions/numeric_formats.py (num_display): added an
3785 3790 extension for printing NumPy arrays in flexible manners. It
3786 3791 doesn't do anything yet, but all the structure is in
3787 3792 place. Ultimately the plan is to implement output format control
3788 3793 like in Octave.
3789 3794
3790 3795 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3791 3796 methods are found at run-time by all the automatic machinery.
3792 3797
3793 3798 2002-02-17 Fernando Perez <fperez@colorado.edu>
3794 3799
3795 3800 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3796 3801 whole file a little.
3797 3802
3798 3803 * ToDo: closed this document. Now there's a new_design.lyx
3799 3804 document for all new ideas. Added making a pdf of it for the
3800 3805 end-user distro.
3801 3806
3802 3807 * IPython/Logger.py (Logger.switch_log): Created this to replace
3803 3808 logon() and logoff(). It also fixes a nasty crash reported by
3804 3809 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3805 3810
3806 3811 * IPython/iplib.py (complete): got auto-completion to work with
3807 3812 automagic (I had wanted this for a long time).
3808 3813
3809 3814 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3810 3815 to @file, since file() is now a builtin and clashes with automagic
3811 3816 for @file.
3812 3817
3813 3818 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3814 3819 of this was previously in iplib, which had grown to more than 2000
3815 3820 lines, way too long. No new functionality, but it makes managing
3816 3821 the code a bit easier.
3817 3822
3818 3823 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3819 3824 information to crash reports.
3820 3825
3821 3826 2002-02-12 Fernando Perez <fperez@colorado.edu>
3822 3827
3823 3828 * Released 0.2.5.
3824 3829
3825 3830 2002-02-11 Fernando Perez <fperez@colorado.edu>
3826 3831
3827 3832 * Wrote a relatively complete Windows installer. It puts
3828 3833 everything in place, creates Start Menu entries and fixes the
3829 3834 color issues. Nothing fancy, but it works.
3830 3835
3831 3836 2002-02-10 Fernando Perez <fperez@colorado.edu>
3832 3837
3833 3838 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3834 3839 os.path.expanduser() call so that we can type @run ~/myfile.py and
3835 3840 have thigs work as expected.
3836 3841
3837 3842 * IPython/genutils.py (page): fixed exception handling so things
3838 3843 work both in Unix and Windows correctly. Quitting a pager triggers
3839 3844 an IOError/broken pipe in Unix, and in windows not finding a pager
3840 3845 is also an IOError, so I had to actually look at the return value
3841 3846 of the exception, not just the exception itself. Should be ok now.
3842 3847
3843 3848 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3844 3849 modified to allow case-insensitive color scheme changes.
3845 3850
3846 3851 2002-02-09 Fernando Perez <fperez@colorado.edu>
3847 3852
3848 3853 * IPython/genutils.py (native_line_ends): new function to leave
3849 3854 user config files with os-native line-endings.
3850 3855
3851 3856 * README and manual updates.
3852 3857
3853 3858 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3854 3859 instead of StringType to catch Unicode strings.
3855 3860
3856 3861 * IPython/genutils.py (filefind): fixed bug for paths with
3857 3862 embedded spaces (very common in Windows).
3858 3863
3859 3864 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3860 3865 files under Windows, so that they get automatically associated
3861 3866 with a text editor. Windows makes it a pain to handle
3862 3867 extension-less files.
3863 3868
3864 3869 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3865 3870 warning about readline only occur for Posix. In Windows there's no
3866 3871 way to get readline, so why bother with the warning.
3867 3872
3868 3873 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3869 3874 for __str__ instead of dir(self), since dir() changed in 2.2.
3870 3875
3871 3876 * Ported to Windows! Tested on XP, I suspect it should work fine
3872 3877 on NT/2000, but I don't think it will work on 98 et al. That
3873 3878 series of Windows is such a piece of junk anyway that I won't try
3874 3879 porting it there. The XP port was straightforward, showed a few
3875 3880 bugs here and there (fixed all), in particular some string
3876 3881 handling stuff which required considering Unicode strings (which
3877 3882 Windows uses). This is good, but hasn't been too tested :) No
3878 3883 fancy installer yet, I'll put a note in the manual so people at
3879 3884 least make manually a shortcut.
3880 3885
3881 3886 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3882 3887 into a single one, "colors". This now controls both prompt and
3883 3888 exception color schemes, and can be changed both at startup
3884 3889 (either via command-line switches or via ipythonrc files) and at
3885 3890 runtime, with @colors.
3886 3891 (Magic.magic_run): renamed @prun to @run and removed the old
3887 3892 @run. The two were too similar to warrant keeping both.
3888 3893
3889 3894 2002-02-03 Fernando Perez <fperez@colorado.edu>
3890 3895
3891 3896 * IPython/iplib.py (install_first_time): Added comment on how to
3892 3897 configure the color options for first-time users. Put a <return>
3893 3898 request at the end so that small-terminal users get a chance to
3894 3899 read the startup info.
3895 3900
3896 3901 2002-01-23 Fernando Perez <fperez@colorado.edu>
3897 3902
3898 3903 * IPython/iplib.py (CachedOutput.update): Changed output memory
3899 3904 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3900 3905 input history we still use _i. Did this b/c these variable are
3901 3906 very commonly used in interactive work, so the less we need to
3902 3907 type the better off we are.
3903 3908 (Magic.magic_prun): updated @prun to better handle the namespaces
3904 3909 the file will run in, including a fix for __name__ not being set
3905 3910 before.
3906 3911
3907 3912 2002-01-20 Fernando Perez <fperez@colorado.edu>
3908 3913
3909 3914 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3910 3915 extra garbage for Python 2.2. Need to look more carefully into
3911 3916 this later.
3912 3917
3913 3918 2002-01-19 Fernando Perez <fperez@colorado.edu>
3914 3919
3915 3920 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3916 3921 display SyntaxError exceptions properly formatted when they occur
3917 3922 (they can be triggered by imported code).
3918 3923
3919 3924 2002-01-18 Fernando Perez <fperez@colorado.edu>
3920 3925
3921 3926 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3922 3927 SyntaxError exceptions are reported nicely formatted, instead of
3923 3928 spitting out only offset information as before.
3924 3929 (Magic.magic_prun): Added the @prun function for executing
3925 3930 programs with command line args inside IPython.
3926 3931
3927 3932 2002-01-16 Fernando Perez <fperez@colorado.edu>
3928 3933
3929 3934 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3930 3935 to *not* include the last item given in a range. This brings their
3931 3936 behavior in line with Python's slicing:
3932 3937 a[n1:n2] -> a[n1]...a[n2-1]
3933 3938 It may be a bit less convenient, but I prefer to stick to Python's
3934 3939 conventions *everywhere*, so users never have to wonder.
3935 3940 (Magic.magic_macro): Added @macro function to ease the creation of
3936 3941 macros.
3937 3942
3938 3943 2002-01-05 Fernando Perez <fperez@colorado.edu>
3939 3944
3940 3945 * Released 0.2.4.
3941 3946
3942 3947 * IPython/iplib.py (Magic.magic_pdef):
3943 3948 (InteractiveShell.safe_execfile): report magic lines and error
3944 3949 lines without line numbers so one can easily copy/paste them for
3945 3950 re-execution.
3946 3951
3947 3952 * Updated manual with recent changes.
3948 3953
3949 3954 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3950 3955 docstring printing when class? is called. Very handy for knowing
3951 3956 how to create class instances (as long as __init__ is well
3952 3957 documented, of course :)
3953 3958 (Magic.magic_doc): print both class and constructor docstrings.
3954 3959 (Magic.magic_pdef): give constructor info if passed a class and
3955 3960 __call__ info for callable object instances.
3956 3961
3957 3962 2002-01-04 Fernando Perez <fperez@colorado.edu>
3958 3963
3959 3964 * Made deep_reload() off by default. It doesn't always work
3960 3965 exactly as intended, so it's probably safer to have it off. It's
3961 3966 still available as dreload() anyway, so nothing is lost.
3962 3967
3963 3968 2002-01-02 Fernando Perez <fperez@colorado.edu>
3964 3969
3965 3970 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3966 3971 so I wanted an updated release).
3967 3972
3968 3973 2001-12-27 Fernando Perez <fperez@colorado.edu>
3969 3974
3970 3975 * IPython/iplib.py (InteractiveShell.interact): Added the original
3971 3976 code from 'code.py' for this module in order to change the
3972 3977 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3973 3978 the history cache would break when the user hit Ctrl-C, and
3974 3979 interact() offers no way to add any hooks to it.
3975 3980
3976 3981 2001-12-23 Fernando Perez <fperez@colorado.edu>
3977 3982
3978 3983 * setup.py: added check for 'MANIFEST' before trying to remove
3979 3984 it. Thanks to Sean Reifschneider.
3980 3985
3981 3986 2001-12-22 Fernando Perez <fperez@colorado.edu>
3982 3987
3983 3988 * Released 0.2.2.
3984 3989
3985 3990 * Finished (reasonably) writing the manual. Later will add the
3986 3991 python-standard navigation stylesheets, but for the time being
3987 3992 it's fairly complete. Distribution will include html and pdf
3988 3993 versions.
3989 3994
3990 3995 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3991 3996 (MayaVi author).
3992 3997
3993 3998 2001-12-21 Fernando Perez <fperez@colorado.edu>
3994 3999
3995 4000 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3996 4001 good public release, I think (with the manual and the distutils
3997 4002 installer). The manual can use some work, but that can go
3998 4003 slowly. Otherwise I think it's quite nice for end users. Next
3999 4004 summer, rewrite the guts of it...
4000 4005
4001 4006 * Changed format of ipythonrc files to use whitespace as the
4002 4007 separator instead of an explicit '='. Cleaner.
4003 4008
4004 4009 2001-12-20 Fernando Perez <fperez@colorado.edu>
4005 4010
4006 4011 * Started a manual in LyX. For now it's just a quick merge of the
4007 4012 various internal docstrings and READMEs. Later it may grow into a
4008 4013 nice, full-blown manual.
4009 4014
4010 4015 * Set up a distutils based installer. Installation should now be
4011 4016 trivially simple for end-users.
4012 4017
4013 4018 2001-12-11 Fernando Perez <fperez@colorado.edu>
4014 4019
4015 4020 * Released 0.2.0. First public release, announced it at
4016 4021 comp.lang.python. From now on, just bugfixes...
4017 4022
4018 4023 * Went through all the files, set copyright/license notices and
4019 4024 cleaned up things. Ready for release.
4020 4025
4021 4026 2001-12-10 Fernando Perez <fperez@colorado.edu>
4022 4027
4023 4028 * Changed the first-time installer not to use tarfiles. It's more
4024 4029 robust now and less unix-dependent. Also makes it easier for
4025 4030 people to later upgrade versions.
4026 4031
4027 4032 * Changed @exit to @abort to reflect the fact that it's pretty
4028 4033 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4029 4034 becomes significant only when IPyhton is embedded: in that case,
4030 4035 C-D closes IPython only, but @abort kills the enclosing program
4031 4036 too (unless it had called IPython inside a try catching
4032 4037 SystemExit).
4033 4038
4034 4039 * Created Shell module which exposes the actuall IPython Shell
4035 4040 classes, currently the normal and the embeddable one. This at
4036 4041 least offers a stable interface we won't need to change when
4037 4042 (later) the internals are rewritten. That rewrite will be confined
4038 4043 to iplib and ipmaker, but the Shell interface should remain as is.
4039 4044
4040 4045 * Added embed module which offers an embeddable IPShell object,
4041 4046 useful to fire up IPython *inside* a running program. Great for
4042 4047 debugging or dynamical data analysis.
4043 4048
4044 4049 2001-12-08 Fernando Perez <fperez@colorado.edu>
4045 4050
4046 4051 * Fixed small bug preventing seeing info from methods of defined
4047 4052 objects (incorrect namespace in _ofind()).
4048 4053
4049 4054 * Documentation cleanup. Moved the main usage docstrings to a
4050 4055 separate file, usage.py (cleaner to maintain, and hopefully in the
4051 4056 future some perlpod-like way of producing interactive, man and
4052 4057 html docs out of it will be found).
4053 4058
4054 4059 * Added @profile to see your profile at any time.
4055 4060
4056 4061 * Added @p as an alias for 'print'. It's especially convenient if
4057 4062 using automagic ('p x' prints x).
4058 4063
4059 4064 * Small cleanups and fixes after a pychecker run.
4060 4065
4061 4066 * Changed the @cd command to handle @cd - and @cd -<n> for
4062 4067 visiting any directory in _dh.
4063 4068
4064 4069 * Introduced _dh, a history of visited directories. @dhist prints
4065 4070 it out with numbers.
4066 4071
4067 4072 2001-12-07 Fernando Perez <fperez@colorado.edu>
4068 4073
4069 4074 * Released 0.1.22
4070 4075
4071 4076 * Made initialization a bit more robust against invalid color
4072 4077 options in user input (exit, not traceback-crash).
4073 4078
4074 4079 * Changed the bug crash reporter to write the report only in the
4075 4080 user's .ipython directory. That way IPython won't litter people's
4076 4081 hard disks with crash files all over the place. Also print on
4077 4082 screen the necessary mail command.
4078 4083
4079 4084 * With the new ultraTB, implemented LightBG color scheme for light
4080 4085 background terminals. A lot of people like white backgrounds, so I
4081 4086 guess we should at least give them something readable.
4082 4087
4083 4088 2001-12-06 Fernando Perez <fperez@colorado.edu>
4084 4089
4085 4090 * Modified the structure of ultraTB. Now there's a proper class
4086 4091 for tables of color schemes which allow adding schemes easily and
4087 4092 switching the active scheme without creating a new instance every
4088 4093 time (which was ridiculous). The syntax for creating new schemes
4089 4094 is also cleaner. I think ultraTB is finally done, with a clean
4090 4095 class structure. Names are also much cleaner (now there's proper
4091 4096 color tables, no need for every variable to also have 'color' in
4092 4097 its name).
4093 4098
4094 4099 * Broke down genutils into separate files. Now genutils only
4095 4100 contains utility functions, and classes have been moved to their
4096 4101 own files (they had enough independent functionality to warrant
4097 4102 it): ConfigLoader, OutputTrap, Struct.
4098 4103
4099 4104 2001-12-05 Fernando Perez <fperez@colorado.edu>
4100 4105
4101 4106 * IPython turns 21! Released version 0.1.21, as a candidate for
4102 4107 public consumption. If all goes well, release in a few days.
4103 4108
4104 4109 * Fixed path bug (files in Extensions/ directory wouldn't be found
4105 4110 unless IPython/ was explicitly in sys.path).
4106 4111
4107 4112 * Extended the FlexCompleter class as MagicCompleter to allow
4108 4113 completion of @-starting lines.
4109 4114
4110 4115 * Created __release__.py file as a central repository for release
4111 4116 info that other files can read from.
4112 4117
4113 4118 * Fixed small bug in logging: when logging was turned on in
4114 4119 mid-session, old lines with special meanings (!@?) were being
4115 4120 logged without the prepended comment, which is necessary since
4116 4121 they are not truly valid python syntax. This should make session
4117 4122 restores produce less errors.
4118 4123
4119 4124 * The namespace cleanup forced me to make a FlexCompleter class
4120 4125 which is nothing but a ripoff of rlcompleter, but with selectable
4121 4126 namespace (rlcompleter only works in __main__.__dict__). I'll try
4122 4127 to submit a note to the authors to see if this change can be
4123 4128 incorporated in future rlcompleter releases (Dec.6: done)
4124 4129
4125 4130 * More fixes to namespace handling. It was a mess! Now all
4126 4131 explicit references to __main__.__dict__ are gone (except when
4127 4132 really needed) and everything is handled through the namespace
4128 4133 dicts in the IPython instance. We seem to be getting somewhere
4129 4134 with this, finally...
4130 4135
4131 4136 * Small documentation updates.
4132 4137
4133 4138 * Created the Extensions directory under IPython (with an
4134 4139 __init__.py). Put the PhysicalQ stuff there. This directory should
4135 4140 be used for all special-purpose extensions.
4136 4141
4137 4142 * File renaming:
4138 4143 ipythonlib --> ipmaker
4139 4144 ipplib --> iplib
4140 4145 This makes a bit more sense in terms of what these files actually do.
4141 4146
4142 4147 * Moved all the classes and functions in ipythonlib to ipplib, so
4143 4148 now ipythonlib only has make_IPython(). This will ease up its
4144 4149 splitting in smaller functional chunks later.
4145 4150
4146 4151 * Cleaned up (done, I think) output of @whos. Better column
4147 4152 formatting, and now shows str(var) for as much as it can, which is
4148 4153 typically what one gets with a 'print var'.
4149 4154
4150 4155 2001-12-04 Fernando Perez <fperez@colorado.edu>
4151 4156
4152 4157 * Fixed namespace problems. Now builtin/IPyhton/user names get
4153 4158 properly reported in their namespace. Internal namespace handling
4154 4159 is finally getting decent (not perfect yet, but much better than
4155 4160 the ad-hoc mess we had).
4156 4161
4157 4162 * Removed -exit option. If people just want to run a python
4158 4163 script, that's what the normal interpreter is for. Less
4159 4164 unnecessary options, less chances for bugs.
4160 4165
4161 4166 * Added a crash handler which generates a complete post-mortem if
4162 4167 IPython crashes. This will help a lot in tracking bugs down the
4163 4168 road.
4164 4169
4165 4170 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4166 4171 which were boud to functions being reassigned would bypass the
4167 4172 logger, breaking the sync of _il with the prompt counter. This
4168 4173 would then crash IPython later when a new line was logged.
4169 4174
4170 4175 2001-12-02 Fernando Perez <fperez@colorado.edu>
4171 4176
4172 4177 * Made IPython a package. This means people don't have to clutter
4173 4178 their sys.path with yet another directory. Changed the INSTALL
4174 4179 file accordingly.
4175 4180
4176 4181 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4177 4182 sorts its output (so @who shows it sorted) and @whos formats the
4178 4183 table according to the width of the first column. Nicer, easier to
4179 4184 read. Todo: write a generic table_format() which takes a list of
4180 4185 lists and prints it nicely formatted, with optional row/column
4181 4186 separators and proper padding and justification.
4182 4187
4183 4188 * Released 0.1.20
4184 4189
4185 4190 * Fixed bug in @log which would reverse the inputcache list (a
4186 4191 copy operation was missing).
4187 4192
4188 4193 * Code cleanup. @config was changed to use page(). Better, since
4189 4194 its output is always quite long.
4190 4195
4191 4196 * Itpl is back as a dependency. I was having too many problems
4192 4197 getting the parametric aliases to work reliably, and it's just
4193 4198 easier to code weird string operations with it than playing %()s
4194 4199 games. It's only ~6k, so I don't think it's too big a deal.
4195 4200
4196 4201 * Found (and fixed) a very nasty bug with history. !lines weren't
4197 4202 getting cached, and the out of sync caches would crash
4198 4203 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4199 4204 division of labor a bit better. Bug fixed, cleaner structure.
4200 4205
4201 4206 2001-12-01 Fernando Perez <fperez@colorado.edu>
4202 4207
4203 4208 * Released 0.1.19
4204 4209
4205 4210 * Added option -n to @hist to prevent line number printing. Much
4206 4211 easier to copy/paste code this way.
4207 4212
4208 4213 * Created global _il to hold the input list. Allows easy
4209 4214 re-execution of blocks of code by slicing it (inspired by Janko's
4210 4215 comment on 'macros').
4211 4216
4212 4217 * Small fixes and doc updates.
4213 4218
4214 4219 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4215 4220 much too fragile with automagic. Handles properly multi-line
4216 4221 statements and takes parameters.
4217 4222
4218 4223 2001-11-30 Fernando Perez <fperez@colorado.edu>
4219 4224
4220 4225 * Version 0.1.18 released.
4221 4226
4222 4227 * Fixed nasty namespace bug in initial module imports.
4223 4228
4224 4229 * Added copyright/license notes to all code files (except
4225 4230 DPyGetOpt). For the time being, LGPL. That could change.
4226 4231
4227 4232 * Rewrote a much nicer README, updated INSTALL, cleaned up
4228 4233 ipythonrc-* samples.
4229 4234
4230 4235 * Overall code/documentation cleanup. Basically ready for
4231 4236 release. Only remaining thing: licence decision (LGPL?).
4232 4237
4233 4238 * Converted load_config to a class, ConfigLoader. Now recursion
4234 4239 control is better organized. Doesn't include the same file twice.
4235 4240
4236 4241 2001-11-29 Fernando Perez <fperez@colorado.edu>
4237 4242
4238 4243 * Got input history working. Changed output history variables from
4239 4244 _p to _o so that _i is for input and _o for output. Just cleaner
4240 4245 convention.
4241 4246
4242 4247 * Implemented parametric aliases. This pretty much allows the
4243 4248 alias system to offer full-blown shell convenience, I think.
4244 4249
4245 4250 * Version 0.1.17 released, 0.1.18 opened.
4246 4251
4247 4252 * dot_ipython/ipythonrc (alias): added documentation.
4248 4253 (xcolor): Fixed small bug (xcolors -> xcolor)
4249 4254
4250 4255 * Changed the alias system. Now alias is a magic command to define
4251 4256 aliases just like the shell. Rationale: the builtin magics should
4252 4257 be there for things deeply connected to IPython's
4253 4258 architecture. And this is a much lighter system for what I think
4254 4259 is the really important feature: allowing users to define quickly
4255 4260 magics that will do shell things for them, so they can customize
4256 4261 IPython easily to match their work habits. If someone is really
4257 4262 desperate to have another name for a builtin alias, they can
4258 4263 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4259 4264 works.
4260 4265
4261 4266 2001-11-28 Fernando Perez <fperez@colorado.edu>
4262 4267
4263 4268 * Changed @file so that it opens the source file at the proper
4264 4269 line. Since it uses less, if your EDITOR environment is
4265 4270 configured, typing v will immediately open your editor of choice
4266 4271 right at the line where the object is defined. Not as quick as
4267 4272 having a direct @edit command, but for all intents and purposes it
4268 4273 works. And I don't have to worry about writing @edit to deal with
4269 4274 all the editors, less does that.
4270 4275
4271 4276 * Version 0.1.16 released, 0.1.17 opened.
4272 4277
4273 4278 * Fixed some nasty bugs in the page/page_dumb combo that could
4274 4279 crash IPython.
4275 4280
4276 4281 2001-11-27 Fernando Perez <fperez@colorado.edu>
4277 4282
4278 4283 * Version 0.1.15 released, 0.1.16 opened.
4279 4284
4280 4285 * Finally got ? and ?? to work for undefined things: now it's
4281 4286 possible to type {}.get? and get information about the get method
4282 4287 of dicts, or os.path? even if only os is defined (so technically
4283 4288 os.path isn't). Works at any level. For example, after import os,
4284 4289 os?, os.path?, os.path.abspath? all work. This is great, took some
4285 4290 work in _ofind.
4286 4291
4287 4292 * Fixed more bugs with logging. The sanest way to do it was to add
4288 4293 to @log a 'mode' parameter. Killed two in one shot (this mode
4289 4294 option was a request of Janko's). I think it's finally clean
4290 4295 (famous last words).
4291 4296
4292 4297 * Added a page_dumb() pager which does a decent job of paging on
4293 4298 screen, if better things (like less) aren't available. One less
4294 4299 unix dependency (someday maybe somebody will port this to
4295 4300 windows).
4296 4301
4297 4302 * Fixed problem in magic_log: would lock of logging out if log
4298 4303 creation failed (because it would still think it had succeeded).
4299 4304
4300 4305 * Improved the page() function using curses to auto-detect screen
4301 4306 size. Now it can make a much better decision on whether to print
4302 4307 or page a string. Option screen_length was modified: a value 0
4303 4308 means auto-detect, and that's the default now.
4304 4309
4305 4310 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4306 4311 go out. I'll test it for a few days, then talk to Janko about
4307 4312 licences and announce it.
4308 4313
4309 4314 * Fixed the length of the auto-generated ---> prompt which appears
4310 4315 for auto-parens and auto-quotes. Getting this right isn't trivial,
4311 4316 with all the color escapes, different prompt types and optional
4312 4317 separators. But it seems to be working in all the combinations.
4313 4318
4314 4319 2001-11-26 Fernando Perez <fperez@colorado.edu>
4315 4320
4316 4321 * Wrote a regexp filter to get option types from the option names
4317 4322 string. This eliminates the need to manually keep two duplicate
4318 4323 lists.
4319 4324
4320 4325 * Removed the unneeded check_option_names. Now options are handled
4321 4326 in a much saner manner and it's easy to visually check that things
4322 4327 are ok.
4323 4328
4324 4329 * Updated version numbers on all files I modified to carry a
4325 4330 notice so Janko and Nathan have clear version markers.
4326 4331
4327 4332 * Updated docstring for ultraTB with my changes. I should send
4328 4333 this to Nathan.
4329 4334
4330 4335 * Lots of small fixes. Ran everything through pychecker again.
4331 4336
4332 4337 * Made loading of deep_reload an cmd line option. If it's not too
4333 4338 kosher, now people can just disable it. With -nodeep_reload it's
4334 4339 still available as dreload(), it just won't overwrite reload().
4335 4340
4336 4341 * Moved many options to the no| form (-opt and -noopt
4337 4342 accepted). Cleaner.
4338 4343
4339 4344 * Changed magic_log so that if called with no parameters, it uses
4340 4345 'rotate' mode. That way auto-generated logs aren't automatically
4341 4346 over-written. For normal logs, now a backup is made if it exists
4342 4347 (only 1 level of backups). A new 'backup' mode was added to the
4343 4348 Logger class to support this. This was a request by Janko.
4344 4349
4345 4350 * Added @logoff/@logon to stop/restart an active log.
4346 4351
4347 4352 * Fixed a lot of bugs in log saving/replay. It was pretty
4348 4353 broken. Now special lines (!@,/) appear properly in the command
4349 4354 history after a log replay.
4350 4355
4351 4356 * Tried and failed to implement full session saving via pickle. My
4352 4357 idea was to pickle __main__.__dict__, but modules can't be
4353 4358 pickled. This would be a better alternative to replaying logs, but
4354 4359 seems quite tricky to get to work. Changed -session to be called
4355 4360 -logplay, which more accurately reflects what it does. And if we
4356 4361 ever get real session saving working, -session is now available.
4357 4362
4358 4363 * Implemented color schemes for prompts also. As for tracebacks,
4359 4364 currently only NoColor and Linux are supported. But now the
4360 4365 infrastructure is in place, based on a generic ColorScheme
4361 4366 class. So writing and activating new schemes both for the prompts
4362 4367 and the tracebacks should be straightforward.
4363 4368
4364 4369 * Version 0.1.13 released, 0.1.14 opened.
4365 4370
4366 4371 * Changed handling of options for output cache. Now counter is
4367 4372 hardwired starting at 1 and one specifies the maximum number of
4368 4373 entries *in the outcache* (not the max prompt counter). This is
4369 4374 much better, since many statements won't increase the cache
4370 4375 count. It also eliminated some confusing options, now there's only
4371 4376 one: cache_size.
4372 4377
4373 4378 * Added 'alias' magic function and magic_alias option in the
4374 4379 ipythonrc file. Now the user can easily define whatever names he
4375 4380 wants for the magic functions without having to play weird
4376 4381 namespace games. This gives IPython a real shell-like feel.
4377 4382
4378 4383 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4379 4384 @ or not).
4380 4385
4381 4386 This was one of the last remaining 'visible' bugs (that I know
4382 4387 of). I think if I can clean up the session loading so it works
4383 4388 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4384 4389 about licensing).
4385 4390
4386 4391 2001-11-25 Fernando Perez <fperez@colorado.edu>
4387 4392
4388 4393 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4389 4394 there's a cleaner distinction between what ? and ?? show.
4390 4395
4391 4396 * Added screen_length option. Now the user can define his own
4392 4397 screen size for page() operations.
4393 4398
4394 4399 * Implemented magic shell-like functions with automatic code
4395 4400 generation. Now adding another function is just a matter of adding
4396 4401 an entry to a dict, and the function is dynamically generated at
4397 4402 run-time. Python has some really cool features!
4398 4403
4399 4404 * Renamed many options to cleanup conventions a little. Now all
4400 4405 are lowercase, and only underscores where needed. Also in the code
4401 4406 option name tables are clearer.
4402 4407
4403 4408 * Changed prompts a little. Now input is 'In [n]:' instead of
4404 4409 'In[n]:='. This allows it the numbers to be aligned with the
4405 4410 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4406 4411 Python (it was a Mathematica thing). The '...' continuation prompt
4407 4412 was also changed a little to align better.
4408 4413
4409 4414 * Fixed bug when flushing output cache. Not all _p<n> variables
4410 4415 exist, so their deletion needs to be wrapped in a try:
4411 4416
4412 4417 * Figured out how to properly use inspect.formatargspec() (it
4413 4418 requires the args preceded by *). So I removed all the code from
4414 4419 _get_pdef in Magic, which was just replicating that.
4415 4420
4416 4421 * Added test to prefilter to allow redefining magic function names
4417 4422 as variables. This is ok, since the @ form is always available,
4418 4423 but whe should allow the user to define a variable called 'ls' if
4419 4424 he needs it.
4420 4425
4421 4426 * Moved the ToDo information from README into a separate ToDo.
4422 4427
4423 4428 * General code cleanup and small bugfixes. I think it's close to a
4424 4429 state where it can be released, obviously with a big 'beta'
4425 4430 warning on it.
4426 4431
4427 4432 * Got the magic function split to work. Now all magics are defined
4428 4433 in a separate class. It just organizes things a bit, and now
4429 4434 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4430 4435 was too long).
4431 4436
4432 4437 * Changed @clear to @reset to avoid potential confusions with
4433 4438 the shell command clear. Also renamed @cl to @clear, which does
4434 4439 exactly what people expect it to from their shell experience.
4435 4440
4436 4441 Added a check to the @reset command (since it's so
4437 4442 destructive, it's probably a good idea to ask for confirmation).
4438 4443 But now reset only works for full namespace resetting. Since the
4439 4444 del keyword is already there for deleting a few specific
4440 4445 variables, I don't see the point of having a redundant magic
4441 4446 function for the same task.
4442 4447
4443 4448 2001-11-24 Fernando Perez <fperez@colorado.edu>
4444 4449
4445 4450 * Updated the builtin docs (esp. the ? ones).
4446 4451
4447 4452 * Ran all the code through pychecker. Not terribly impressed with
4448 4453 it: lots of spurious warnings and didn't really find anything of
4449 4454 substance (just a few modules being imported and not used).
4450 4455
4451 4456 * Implemented the new ultraTB functionality into IPython. New
4452 4457 option: xcolors. This chooses color scheme. xmode now only selects
4453 4458 between Plain and Verbose. Better orthogonality.
4454 4459
4455 4460 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4456 4461 mode and color scheme for the exception handlers. Now it's
4457 4462 possible to have the verbose traceback with no coloring.
4458 4463
4459 4464 2001-11-23 Fernando Perez <fperez@colorado.edu>
4460 4465
4461 4466 * Version 0.1.12 released, 0.1.13 opened.
4462 4467
4463 4468 * Removed option to set auto-quote and auto-paren escapes by
4464 4469 user. The chances of breaking valid syntax are just too high. If
4465 4470 someone *really* wants, they can always dig into the code.
4466 4471
4467 4472 * Made prompt separators configurable.
4468 4473
4469 4474 2001-11-22 Fernando Perez <fperez@colorado.edu>
4470 4475
4471 4476 * Small bugfixes in many places.
4472 4477
4473 4478 * Removed the MyCompleter class from ipplib. It seemed redundant
4474 4479 with the C-p,C-n history search functionality. Less code to
4475 4480 maintain.
4476 4481
4477 4482 * Moved all the original ipython.py code into ipythonlib.py. Right
4478 4483 now it's just one big dump into a function called make_IPython, so
4479 4484 no real modularity has been gained. But at least it makes the
4480 4485 wrapper script tiny, and since ipythonlib is a module, it gets
4481 4486 compiled and startup is much faster.
4482 4487
4483 4488 This is a reasobably 'deep' change, so we should test it for a
4484 4489 while without messing too much more with the code.
4485 4490
4486 4491 2001-11-21 Fernando Perez <fperez@colorado.edu>
4487 4492
4488 4493 * Version 0.1.11 released, 0.1.12 opened for further work.
4489 4494
4490 4495 * Removed dependency on Itpl. It was only needed in one place. It
4491 4496 would be nice if this became part of python, though. It makes life
4492 4497 *a lot* easier in some cases.
4493 4498
4494 4499 * Simplified the prefilter code a bit. Now all handlers are
4495 4500 expected to explicitly return a value (at least a blank string).
4496 4501
4497 4502 * Heavy edits in ipplib. Removed the help system altogether. Now
4498 4503 obj?/?? is used for inspecting objects, a magic @doc prints
4499 4504 docstrings, and full-blown Python help is accessed via the 'help'
4500 4505 keyword. This cleans up a lot of code (less to maintain) and does
4501 4506 the job. Since 'help' is now a standard Python component, might as
4502 4507 well use it and remove duplicate functionality.
4503 4508
4504 4509 Also removed the option to use ipplib as a standalone program. By
4505 4510 now it's too dependent on other parts of IPython to function alone.
4506 4511
4507 4512 * Fixed bug in genutils.pager. It would crash if the pager was
4508 4513 exited immediately after opening (broken pipe).
4509 4514
4510 4515 * Trimmed down the VerboseTB reporting a little. The header is
4511 4516 much shorter now and the repeated exception arguments at the end
4512 4517 have been removed. For interactive use the old header seemed a bit
4513 4518 excessive.
4514 4519
4515 4520 * Fixed small bug in output of @whos for variables with multi-word
4516 4521 types (only first word was displayed).
4517 4522
4518 4523 2001-11-17 Fernando Perez <fperez@colorado.edu>
4519 4524
4520 4525 * Version 0.1.10 released, 0.1.11 opened for further work.
4521 4526
4522 4527 * Modified dirs and friends. dirs now *returns* the stack (not
4523 4528 prints), so one can manipulate it as a variable. Convenient to
4524 4529 travel along many directories.
4525 4530
4526 4531 * Fixed bug in magic_pdef: would only work with functions with
4527 4532 arguments with default values.
4528 4533
4529 4534 2001-11-14 Fernando Perez <fperez@colorado.edu>
4530 4535
4531 4536 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4532 4537 example with IPython. Various other minor fixes and cleanups.
4533 4538
4534 4539 * Version 0.1.9 released, 0.1.10 opened for further work.
4535 4540
4536 4541 * Added sys.path to the list of directories searched in the
4537 4542 execfile= option. It used to be the current directory and the
4538 4543 user's IPYTHONDIR only.
4539 4544
4540 4545 2001-11-13 Fernando Perez <fperez@colorado.edu>
4541 4546
4542 4547 * Reinstated the raw_input/prefilter separation that Janko had
4543 4548 initially. This gives a more convenient setup for extending the
4544 4549 pre-processor from the outside: raw_input always gets a string,
4545 4550 and prefilter has to process it. We can then redefine prefilter
4546 4551 from the outside and implement extensions for special
4547 4552 purposes.
4548 4553
4549 4554 Today I got one for inputting PhysicalQuantity objects
4550 4555 (from Scientific) without needing any function calls at
4551 4556 all. Extremely convenient, and it's all done as a user-level
4552 4557 extension (no IPython code was touched). Now instead of:
4553 4558 a = PhysicalQuantity(4.2,'m/s**2')
4554 4559 one can simply say
4555 4560 a = 4.2 m/s**2
4556 4561 or even
4557 4562 a = 4.2 m/s^2
4558 4563
4559 4564 I use this, but it's also a proof of concept: IPython really is
4560 4565 fully user-extensible, even at the level of the parsing of the
4561 4566 command line. It's not trivial, but it's perfectly doable.
4562 4567
4563 4568 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4564 4569 the problem of modules being loaded in the inverse order in which
4565 4570 they were defined in
4566 4571
4567 4572 * Version 0.1.8 released, 0.1.9 opened for further work.
4568 4573
4569 4574 * Added magics pdef, source and file. They respectively show the
4570 4575 definition line ('prototype' in C), source code and full python
4571 4576 file for any callable object. The object inspector oinfo uses
4572 4577 these to show the same information.
4573 4578
4574 4579 * Version 0.1.7 released, 0.1.8 opened for further work.
4575 4580
4576 4581 * Separated all the magic functions into a class called Magic. The
4577 4582 InteractiveShell class was becoming too big for Xemacs to handle
4578 4583 (de-indenting a line would lock it up for 10 seconds while it
4579 4584 backtracked on the whole class!)
4580 4585
4581 4586 FIXME: didn't work. It can be done, but right now namespaces are
4582 4587 all messed up. Do it later (reverted it for now, so at least
4583 4588 everything works as before).
4584 4589
4585 4590 * Got the object introspection system (magic_oinfo) working! I
4586 4591 think this is pretty much ready for release to Janko, so he can
4587 4592 test it for a while and then announce it. Pretty much 100% of what
4588 4593 I wanted for the 'phase 1' release is ready. Happy, tired.
4589 4594
4590 4595 2001-11-12 Fernando Perez <fperez@colorado.edu>
4591 4596
4592 4597 * Version 0.1.6 released, 0.1.7 opened for further work.
4593 4598
4594 4599 * Fixed bug in printing: it used to test for truth before
4595 4600 printing, so 0 wouldn't print. Now checks for None.
4596 4601
4597 4602 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4598 4603 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4599 4604 reaches by hand into the outputcache. Think of a better way to do
4600 4605 this later.
4601 4606
4602 4607 * Various small fixes thanks to Nathan's comments.
4603 4608
4604 4609 * Changed magic_pprint to magic_Pprint. This way it doesn't
4605 4610 collide with pprint() and the name is consistent with the command
4606 4611 line option.
4607 4612
4608 4613 * Changed prompt counter behavior to be fully like
4609 4614 Mathematica's. That is, even input that doesn't return a result
4610 4615 raises the prompt counter. The old behavior was kind of confusing
4611 4616 (getting the same prompt number several times if the operation
4612 4617 didn't return a result).
4613 4618
4614 4619 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4615 4620
4616 4621 * Fixed -Classic mode (wasn't working anymore).
4617 4622
4618 4623 * Added colored prompts using Nathan's new code. Colors are
4619 4624 currently hardwired, they can be user-configurable. For
4620 4625 developers, they can be chosen in file ipythonlib.py, at the
4621 4626 beginning of the CachedOutput class def.
4622 4627
4623 4628 2001-11-11 Fernando Perez <fperez@colorado.edu>
4624 4629
4625 4630 * Version 0.1.5 released, 0.1.6 opened for further work.
4626 4631
4627 4632 * Changed magic_env to *return* the environment as a dict (not to
4628 4633 print it). This way it prints, but it can also be processed.
4629 4634
4630 4635 * Added Verbose exception reporting to interactive
4631 4636 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4632 4637 traceback. Had to make some changes to the ultraTB file. This is
4633 4638 probably the last 'big' thing in my mental todo list. This ties
4634 4639 in with the next entry:
4635 4640
4636 4641 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4637 4642 has to specify is Plain, Color or Verbose for all exception
4638 4643 handling.
4639 4644
4640 4645 * Removed ShellServices option. All this can really be done via
4641 4646 the magic system. It's easier to extend, cleaner and has automatic
4642 4647 namespace protection and documentation.
4643 4648
4644 4649 2001-11-09 Fernando Perez <fperez@colorado.edu>
4645 4650
4646 4651 * Fixed bug in output cache flushing (missing parameter to
4647 4652 __init__). Other small bugs fixed (found using pychecker).
4648 4653
4649 4654 * Version 0.1.4 opened for bugfixing.
4650 4655
4651 4656 2001-11-07 Fernando Perez <fperez@colorado.edu>
4652 4657
4653 4658 * Version 0.1.3 released, mainly because of the raw_input bug.
4654 4659
4655 4660 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4656 4661 and when testing for whether things were callable, a call could
4657 4662 actually be made to certain functions. They would get called again
4658 4663 once 'really' executed, with a resulting double call. A disaster
4659 4664 in many cases (list.reverse() would never work!).
4660 4665
4661 4666 * Removed prefilter() function, moved its code to raw_input (which
4662 4667 after all was just a near-empty caller for prefilter). This saves
4663 4668 a function call on every prompt, and simplifies the class a tiny bit.
4664 4669
4665 4670 * Fix _ip to __ip name in magic example file.
4666 4671
4667 4672 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4668 4673 work with non-gnu versions of tar.
4669 4674
4670 4675 2001-11-06 Fernando Perez <fperez@colorado.edu>
4671 4676
4672 4677 * Version 0.1.2. Just to keep track of the recent changes.
4673 4678
4674 4679 * Fixed nasty bug in output prompt routine. It used to check 'if
4675 4680 arg != None...'. Problem is, this fails if arg implements a
4676 4681 special comparison (__cmp__) which disallows comparing to
4677 4682 None. Found it when trying to use the PhysicalQuantity module from
4678 4683 ScientificPython.
4679 4684
4680 4685 2001-11-05 Fernando Perez <fperez@colorado.edu>
4681 4686
4682 4687 * Also added dirs. Now the pushd/popd/dirs family functions
4683 4688 basically like the shell, with the added convenience of going home
4684 4689 when called with no args.
4685 4690
4686 4691 * pushd/popd slightly modified to mimic shell behavior more
4687 4692 closely.
4688 4693
4689 4694 * Added env,pushd,popd from ShellServices as magic functions. I
4690 4695 think the cleanest will be to port all desired functions from
4691 4696 ShellServices as magics and remove ShellServices altogether. This
4692 4697 will provide a single, clean way of adding functionality
4693 4698 (shell-type or otherwise) to IP.
4694 4699
4695 4700 2001-11-04 Fernando Perez <fperez@colorado.edu>
4696 4701
4697 4702 * Added .ipython/ directory to sys.path. This way users can keep
4698 4703 customizations there and access them via import.
4699 4704
4700 4705 2001-11-03 Fernando Perez <fperez@colorado.edu>
4701 4706
4702 4707 * Opened version 0.1.1 for new changes.
4703 4708
4704 4709 * Changed version number to 0.1.0: first 'public' release, sent to
4705 4710 Nathan and Janko.
4706 4711
4707 4712 * Lots of small fixes and tweaks.
4708 4713
4709 4714 * Minor changes to whos format. Now strings are shown, snipped if
4710 4715 too long.
4711 4716
4712 4717 * Changed ShellServices to work on __main__ so they show up in @who
4713 4718
4714 4719 * Help also works with ? at the end of a line:
4715 4720 ?sin and sin?
4716 4721 both produce the same effect. This is nice, as often I use the
4717 4722 tab-complete to find the name of a method, but I used to then have
4718 4723 to go to the beginning of the line to put a ? if I wanted more
4719 4724 info. Now I can just add the ? and hit return. Convenient.
4720 4725
4721 4726 2001-11-02 Fernando Perez <fperez@colorado.edu>
4722 4727
4723 4728 * Python version check (>=2.1) added.
4724 4729
4725 4730 * Added LazyPython documentation. At this point the docs are quite
4726 4731 a mess. A cleanup is in order.
4727 4732
4728 4733 * Auto-installer created. For some bizarre reason, the zipfiles
4729 4734 module isn't working on my system. So I made a tar version
4730 4735 (hopefully the command line options in various systems won't kill
4731 4736 me).
4732 4737
4733 4738 * Fixes to Struct in genutils. Now all dictionary-like methods are
4734 4739 protected (reasonably).
4735 4740
4736 4741 * Added pager function to genutils and changed ? to print usage
4737 4742 note through it (it was too long).
4738 4743
4739 4744 * Added the LazyPython functionality. Works great! I changed the
4740 4745 auto-quote escape to ';', it's on home row and next to '. But
4741 4746 both auto-quote and auto-paren (still /) escapes are command-line
4742 4747 parameters.
4743 4748
4744 4749
4745 4750 2001-11-01 Fernando Perez <fperez@colorado.edu>
4746 4751
4747 4752 * Version changed to 0.0.7. Fairly large change: configuration now
4748 4753 is all stored in a directory, by default .ipython. There, all
4749 4754 config files have normal looking names (not .names)
4750 4755
4751 4756 * Version 0.0.6 Released first to Lucas and Archie as a test
4752 4757 run. Since it's the first 'semi-public' release, change version to
4753 4758 > 0.0.6 for any changes now.
4754 4759
4755 4760 * Stuff I had put in the ipplib.py changelog:
4756 4761
4757 4762 Changes to InteractiveShell:
4758 4763
4759 4764 - Made the usage message a parameter.
4760 4765
4761 4766 - Require the name of the shell variable to be given. It's a bit
4762 4767 of a hack, but allows the name 'shell' not to be hardwire in the
4763 4768 magic (@) handler, which is problematic b/c it requires
4764 4769 polluting the global namespace with 'shell'. This in turn is
4765 4770 fragile: if a user redefines a variable called shell, things
4766 4771 break.
4767 4772
4768 4773 - magic @: all functions available through @ need to be defined
4769 4774 as magic_<name>, even though they can be called simply as
4770 4775 @<name>. This allows the special command @magic to gather
4771 4776 information automatically about all existing magic functions,
4772 4777 even if they are run-time user extensions, by parsing the shell
4773 4778 instance __dict__ looking for special magic_ names.
4774 4779
4775 4780 - mainloop: added *two* local namespace parameters. This allows
4776 4781 the class to differentiate between parameters which were there
4777 4782 before and after command line initialization was processed. This
4778 4783 way, later @who can show things loaded at startup by the
4779 4784 user. This trick was necessary to make session saving/reloading
4780 4785 really work: ideally after saving/exiting/reloading a session,
4781 4786 *everythin* should look the same, including the output of @who. I
4782 4787 was only able to make this work with this double namespace
4783 4788 trick.
4784 4789
4785 4790 - added a header to the logfile which allows (almost) full
4786 4791 session restoring.
4787 4792
4788 4793 - prepend lines beginning with @ or !, with a and log
4789 4794 them. Why? !lines: may be useful to know what you did @lines:
4790 4795 they may affect session state. So when restoring a session, at
4791 4796 least inform the user of their presence. I couldn't quite get
4792 4797 them to properly re-execute, but at least the user is warned.
4793 4798
4794 4799 * Started ChangeLog.
@@ -1,395 +1,406 b''
1 1 .\" Hey, EMACS: -*- nroff -*-
2 2 .\" First parameter, NAME, should be all caps
3 3 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
4 4 .\" other parameters are allowed: see man(7), man(1)
5 5 .TH IPYTHON 1 "November 30, 2004"
6 6 .\" Please adjust this date whenever revising the manpage.
7 7 .\"
8 8 .\" Some roff macros, for reference:
9 9 .\" .nh disable hyphenation
10 10 .\" .hy enable hyphenation
11 11 .\" .ad l left justify
12 12 .\" .ad b justify to both left and right margins
13 13 .\" .nf disable filling
14 14 .\" .fi enable filling
15 15 .\" .br insert line break
16 16 .\" .sp <n> insert n+1 empty lines
17 17 .\" for manpage-specific macros, see man(7) and groff_man(7)
18 18 .\" .SH section heading
19 19 .\" .SS secondary section heading
20 20 .\"
21 21 .\"
22 22 .\" To preview this page as plain text: nroff -man ipython.1
23 23 .\"
24 24 .SH NAME
25 25 ipython \- An Enhanced Interactive Python
26 26 .SH SYNOPSIS
27 27 .B ipython
28 28 .RI [ options ] " files" ...
29 29 .SH DESCRIPTION
30 30 An interactive Python shell with automatic history (input and output),
31 31 dynamic object introspection, easier configuration, command
32 32 completion, access to the system shell, integration with numerical and
33 33 scientific computing tools, and more.
34 34 .SH SPECIAL THREADING OPTIONS
35 35 The following special options are ONLY valid at the beginning of the command
36 36 line, and not later. This is because they control the initialization of
37 37 ipython itself, before the normal option-handling mechanism is active.
38 38 .TP
39 39 .B \-gthread, \-qthread, \-wthread, \-pylab
40 40 Only ONE of these can be given, and it can only be given as the first option
41 41 passed to IPython (it will have no effect in any other position). They
42 42 provide threading support for the GTK, QT and WXWidgets toolkits, and for the
43 43 matplotlib library.
44 44 .br
45 45 .sp 1
46 46 With any of the first three options, IPython starts running a separate thread
47 47 for the graphical toolkit's operation, so that you can open and control
48 48 graphical elements from within an IPython command line, without blocking. All
49 49 three provide essentially the same functionality, respectively for GTK, QT and
50 50 WXWidgets (via their Python interfaces).
51 51 .br
52 52 .sp 1
53 Note that with \-wthread, you can additionally use the \-wxversion option to
54 request a specific version of wx to be used. This requires that you have the
55 'wxversion' Python module installed, which is part of recent wxPython
56 distributions.
57 .br
58 .sp 1
53 59 If \-pylab is given, IPython loads special support for the matplotlib library
54 60 (http://matplotlib.sourceforge.net), allowing interactive usage of any of its
55 61 backends as defined in the user's .matplotlibrc file. It automatically
56 62 activates GTK, QT or WX threading for IPyhton if the choice of matplotlib
57 63 backend requires it. It also modifies the %run command to correctly execute
58 64 (without blocking) any matplotlib-based script which calls show() at the end.
59 65 .TP
60 66 .B \-tk
61 67 The \-g/q/wthread options, and \-pylab (if matplotlib is configured to use
62 68 GTK, QT or WX), will normally block Tk graphical interfaces. This means that
63 69 when GTK, QT or WX threading is active, any attempt to open a Tk GUI will
64 70 result in a dead window, and possibly cause the Python interpreter to crash.
65 71 An extra option, \-tk, is available to address this issue. It can ONLY be
66 72 given as a SECOND option after any of the above (\-gthread, \-qthread,
67 73 \-wthread or \-pylab).
68 74 .br
69 75 .sp 1
70 76 If \-tk is given, IPython will try to coordinate Tk threading with GTK, QT or
71 77 WX. This is however potentially unreliable, and you will have to test on your
72 78 platform and Python configuration to determine whether it works for you.
73 79 Debian users have reported success, apparently due to the fact that Debian
74 80 builds all of Tcl, Tk, Tkinter and Python with pthreads support. Under other
75 81 Linux environments (such as Fedora Core 2), this option has caused random
76 82 crashes and lockups of the Python interpreter. Under other operating systems
77 83 (Mac OSX and Windows), you'll need to try it to find out, since currently no
78 84 user reports are available.
79 85 .br
80 86 .sp 1
81 87 There is unfortunately no way for IPython to determine at runtime whether \-tk
82 88 will work reliably or not, so you will need to do some experiments before
83 89 relying on it for regular work.
84 90 .
85 91 .SS A WARNING ABOUT SIGNALS AND THREADS
86 92 When any of the thread systems (GTK, QT or WX) are active, either directly or
87 93 via \-pylab with a threaded backend, it is impossible to interrupt
88 94 long-running Python code via Ctrl\-C. IPython can not pass the
89 95 KeyboardInterrupt exception (or the underlying SIGINT) across threads, so any
90 96 long-running process started from IPython will run to completion, or will have
91 97 to be killed via an external (OS-based) mechanism.
92 98 .br
93 99 .sp 1
94 100 To the best of my knowledge, this limitation is imposed by the Python
95 101 interpreter itself, and it comes from the difficulty of writing portable
96 102 signal/threaded code. If any user is an expert on this topic and can suggest
97 103 a better solution, I would love to hear about it. In the IPython sources,
98 104 look at the Shell.py module, and in particular at the runcode() method.
99 105 .
100 106 .SH REGULAR OPTIONS
101 107 After the above threading options have been given, regular options can follow
102 108 in any order. All options can be abbreviated to their shortest non-ambiguous
103 109 form and are case-sensitive. One or two dashes can be used. Some options
104 110 have an alternate short form, indicated after a |.
105 111 .br
106 112 .sp 1
107 113 Most options can also be set from your ipythonrc configuration file.
108 114 See the provided examples for assistance. Options given on the
109 115 commandline override the values set in the ipythonrc file.
110 116 .br
111 117 .sp 1
112 118 All options with a [no] prepended can be specified in negated form
113 119 (\-nooption instead of \-option) to turn the feature off.
114 120 .TP
115 121 .B \-h, \-\-help
116 122 Show summary of options.
117 123 .TP
118 124 .B \-autocall <val>
119 125 Make IPython automatically call any callable object even if you didn't type
120 126 explicit parentheses. For example, 'str 43' becomes
121 127 'str(43)' automatically. The value can be '0' to disable the
122 128 feature, '1' for 'smart' autocall, where it is not applied if
123 129 there are no more arguments on the line, and '2' for 'full'
124 130 autocall, where all callable objects are automatically called
125 131 (even if no arguments are present). The default is '1'.
126 132 .TP
127 133 .B \-[no]autoindent
128 134 Turn automatic indentation on/off.
129 135 .TP
130 136 .B \-[no]automagic
131 137 Make magic commands automatic (without needing their first character
132 138 to be %). Type %magic at the IPython prompt for more information.
133 139 .TP
134 140 .B \-[no]autoedit_syntax
135 141 When a syntax error occurs after editing a file, automatically open the file
136 142 to the trouble causing line for convenient fixing.
137 143 .TP
138 144 .B \-[no]banner
139 145 Print the intial information banner (default on).
140 146 .TP
141 147 .B \-c <command>
142 148 Execute the given command string, and set sys.argv to ['c']. This is similar
143 149 to the \-c option in the normal Python interpreter.
144 150 .TP
145 151 .B \-cache_size|cs <n>
146 152 Size of the output cache (maximum number of entries to hold in
147 153 memory). The default is 1000, you can change it permanently in your
148 154 config file. Setting it to 0 completely disables the caching system,
149 155 and the minimum value accepted is 20 (if you provide a value less than
150 156 20, it is reset to 0 and a warning is issued). This limit is defined
151 157 because otherwise you'll spend more time re-flushing a too small cache
152 158 than working.
153 159 .TP
154 160 .B \-classic|cl
155 161 Gives IPython a similar feel to the classic Python prompt.
156 162 .TP
157 163 .B \-colors <scheme>
158 164 Color scheme for prompts and exception reporting. Currently
159 165 implemented: NoColor, Linux, and LightBG.
160 166 .TP
161 167 .B \-[no]color_info
162 168 IPython can display information about objects via a set of functions,
163 169 and optionally can use colors for this, syntax highlighting source
164 170 code and various other elements. However, because this information is
165 171 passed through a pager (like 'less') and many pagers get confused with
166 172 color codes, this option is off by default. You can test it and turn
167 173 it on permanently in your ipythonrc file if it works for you. As a
168 174 reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
169 175 that in RedHat 7.2 doesn't.
170 176 .br
171 177 .sp 1
172 178 Test it and turn it on permanently if it works with your system. The
173 179 magic function @color_info allows you to toggle this interactively for
174 180 testing.
175 181 .TP
176 182 .B \-[no]confirm_exit
177 183 Set to confirm when you try to exit IPython with an EOF (Control-D in
178 184 Unix, Control-Z/Enter in Windows). Note that using the magic functions
179 185 @Exit or @Quit you can force a direct exit, bypassing any
180 186 confirmation.
181 187 .TP
182 188 .B \-[no]debug
183 189 Show information about the loading process. Very useful to pin down
184 190 problems with your configuration files or to get details about session
185 191 restores.
186 192 .TP
187 193 .B \-[no]deep_reload
188 194 IPython can use the deep_reload module which reloads changes in
189 195 modules recursively (it replaces the reload() function, so you don't
190 196 need to change anything to use it). deep_reload() forces a full reload
191 197 of modules whose code may have changed, which the default reload()
192 198 function does not.
193 199 .br
194 200 .sp 1
195 201 When deep_reload is off, IPython will use the normal reload(), but
196 202 deep_reload will still be available as dreload(). This feature is off
197 203 by default [which means that you have both normal reload() and
198 204 dreload()].
199 205 .TP
200 206 .B \-editor <name>
201 207 Which editor to use with the @edit command. By default, IPython will
202 208 honor your EDITOR environment variable (if not set, vi is the Unix
203 209 default and notepad the Windows one). Since this editor is invoked on
204 210 the fly by IPython and is meant for editing small code snippets, you
205 211 may want to use a small, lightweight editor here (in case your default
206 212 EDITOR is something like Emacs).
207 213 .TP
208 214 .B \-ipythondir <name>
209 215 The name of your IPython configuration directory IPYTHONDIR. This can
210 216 also be specified through the environment variable IPYTHONDIR.
211 217 .TP
212 218 .B \-log|l
213 219 Generate a log file of all input. The file is named ipython_log.py in your
214 220 current directory (which prevents logs from multiple IPython sessions from
215 221 trampling each other). You can use this to later restore a session by loading
216 222 your logfile as a file to be executed with option -logplay (see below).
217 223 .TP
218 224 .B \-logfile|lf
219 225 Specify the name of your logfile.
220 226 .TP
221 227 .B \-logplay|lp
222 228 Replay a previous log. For restoring a session as close as possible to
223 229 the state you left it in, use this option (don't just run the
224 230 logfile). With \-logplay, IPython will try to reconstruct the previous
225 231 working environment in full, not just execute the commands in the
226 232 logfile.
227 233 .br
228 234 .sh 1
229 235 When a session is restored, logging is automatically turned on again
230 236 with the name of the logfile it was invoked with (it is read from the
231 237 log header). So once you've turned logging on for a session, you can
232 238 quit IPython and reload it as many times as you want and it will
233 239 continue to log its history and restore from the beginning every time.
234 240 .br
235 241 .sp 1
236 242 Caveats: there are limitations in this option. The history variables
237 243 _i*,_* and _dh don't get restored properly. In the future we will try
238 244 to implement full session saving by writing and retrieving a
239 245 'snapshot' of the memory state of IPython. But our first attempts
240 246 failed because of inherent limitations of Python's Pickle module, so
241 247 this may have to wait.
242 248 .TP
243 249 .B \-[no]messages
244 250 Print messages which IPython collects about its startup process
245 251 (default on).
246 252 .TP
247 253 .B \-[no]pdb
248 254 Automatically call the pdb debugger after every uncaught exception. If
249 255 you are used to debugging using pdb, this puts you automatically
250 256 inside of it after any call (either in IPython or in code called by
251 257 it) which triggers an exception which goes uncaught.
252 258 .TP
253 259 .B \-[no]pprint
254 260 IPython can optionally use the pprint (pretty printer) module for
255 261 displaying results. pprint tends to give a nicer display of nested
256 262 data structures. If you like it, you can turn it on permanently in
257 263 your config file (default off).
258 264 .TP
259 265 .B \-profile|p <name>
260 266 Assume that your config file is ipythonrc-<name> (looks in current dir
261 267 first, then in IPYTHONDIR). This is a quick way to keep and load
262 268 multiple config files for different tasks, especially if you use the
263 269 include option of config files. You can keep a basic
264 270 IPYTHONDIR/ipythonrc file and then have other 'profiles' which include
265 271 this one and load extra things for particular tasks. For example:
266 272 .br
267 273 .sp 1
268 274 1) $HOME/.ipython/ipythonrc : load basic things you always want.
269 275 .br
270 276 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-related
271 277 modules.
272 278 .br
273 279 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
274 280 plotting modules.
275 281 .br
276 282 .sp 1
277 283 Since it is possible to create an endless loop by having circular file
278 284 inclusions, IPython will stop if it reaches 15 recursive inclusions.
279 285 .TP
280 286 .B \-prompt_in1|pi1 <string>
281 287 Specify the string used for input prompts. Note that if you are using
282 288 numbered prompts, the number is represented with a '\\#' in the
283 289 string. Don't forget to quote strings with spaces embedded in
284 290 them. Default: 'In [\\#]:'.
285 291 .br
286 292 .sp 1
287 293 Most bash-like escapes can be used to customize IPython's prompts, as well as
288 294 a few additional ones which are IPython-specific. All valid prompt escapes
289 295 are described in detail in the Customization section of the IPython HTML/PDF
290 296 manual.
291 297 .TP
292 298 .B \-prompt_in2|pi2 <string>
293 299 Similar to the previous option, but used for the continuation prompts. The
294 300 special sequence '\\D' is similar to '\\#', but with all digits replaced dots
295 301 (so you can have your continuation prompt aligned with your input
296 302 prompt). Default: ' .\\D.:' (note three spaces at the start for alignment
297 303 with 'In [\\#]').
298 304 .TP
299 305 .B \-prompt_out|po <string>
300 306 String used for output prompts, also uses numbers like prompt_in1.
301 307 Default: 'Out[\\#]:'.
302 308 .TP
303 309 .B \-quick
304 310 Start in bare bones mode (no config file loaded).
305 311 .TP
306 312 .B \-rcfile <name>
307 313 Name of your IPython resource configuration file. normally IPython
308 314 loads ipythonrc (from current directory) or IPYTHONDIR/ipythonrc. If
309 315 the loading of your config file fails, IPython starts with a bare
310 316 bones configuration (no modules loaded at all).
311 317 .TP
312 318 .B \-[no]readline
313 319 Use the readline library, which is needed to support name completion
314 320 and command history, among other things. It is enabled by default, but
315 321 may cause problems for users of X/Emacs in Python comint or shell
316 322 buffers.
317 323 .br
318 324 .sp 1
319 325 Note that emacs 'eterm' buffers (opened with M-x term) support
320 326 IPython's readline and syntax coloring fine, only 'emacs' (M-x shell
321 327 and C-c !) buffers do not.
322 328 .TP
323 329 .B \-screen_length|sl <n>
324 330 Number of lines of your screen. This is used to control printing of
325 331 very long strings. Strings longer than this number of lines will be
326 332 sent through a pager instead of directly printed.
327 333 .br
328 334 .sp 1
329 335 The default value for this is 0, which means IPython will auto-detect
330 336 your screen size every time it needs to print certain potentially long
331 337 strings (this doesn't change the behavior of the 'print' keyword, it's
332 338 only triggered internally). If for some reason this isn't working well
333 339 (it needs curses support), specify it yourself. Otherwise don't change
334 340 the default.
335 341 .TP
336 342 .B \-separate_in|si <string>
337 343 Separator before input prompts. Default '\n'.
338 344 .TP
339 345 .B \-separate_out|so <string>
340 346 Separator before output prompts. Default: 0 (nothing).
341 347 .TP
342 348 .B \-separate_out2|so2 <string>
343 349 Separator after output prompts. Default: 0 (nothing).
344 350 .TP
345 351 .B \-nosep
346 352 Shorthand for '\-separate_in 0 \-separate_out 0 \-separate_out2 0'.
347 353 Simply removes all input/output separators.
348 354 .TP
349 355 .B \-upgrade
350 356 Allows you to upgrade your IPYTHONDIR configuration when you install a
351 357 new version of IPython. Since new versions may include new command
352 358 lines options or example files, this copies updated ipythonrc-type
353 359 files. However, it backs up (with a .old extension) all files which
354 360 it overwrites so that you can merge back any custimizations you might
355 361 have in your personal files.
356 362 .TP
357 363 .B \-Version
358 364 Print version information and exit.
359 365 .TP
366 .B -wxversion <string>
367 Select a specific version of wxPython (used in conjunction with
368 \-wthread). Requires the wxversion module, part of recent wxPython
369 distributions.
370 .TP
360 371 .B \-xmode <modename>
361 372 Mode for exception reporting. The valid modes are Plain, Context, and
362 373 Verbose.
363 374 .br
364 375 .sp 1
365 376 \- Plain: similar to python's normal traceback printing.
366 377 .br
367 378 .sp 1
368 379 \- Context: prints 5 lines of context source code around each line in the
369 380 traceback.
370 381 .br
371 382 .sp 1
372 383 \- Verbose: similar to Context, but additionally prints the variables
373 384 currently visible where the exception happened (shortening their strings if
374 385 too long). This can potentially be very slow, if you happen to have a huge
375 386 data structure whose string representation is complex to compute. Your
376 387 computer may appear to freeze for a while with cpu usage at 100%. If this
377 388 occurs, you can cancel the traceback with Ctrl-C (maybe hitting it more than
378 389 once).
379 390 .
380 391 .SH EMBEDDING
381 392 It is possible to start an IPython instance inside your own Python
382 393 programs. In the documentation example files there are some
383 394 illustrations on how to do this.
384 395 .br
385 396 .sp 1
386 397 This feature allows you to evalutate dynamically the state of your
387 398 code, operate with your variables, analyze them, etc. Note however
388 399 that any changes you make to values while in the shell do NOT
389 400 propagate back to the running code, so it is safe to modify your
390 401 values because you won't break your code in bizarre ways by doing so.
391 402 .SH AUTHOR
392 403 IPython was written by Fernando Perez <fperez@colorado.edu>, based on earlier
393 404 code by Janko Hauser <jh@comunit.de> and Nathaniel Gray
394 405 <n8gray@caltech.edu>. This manual page was written by Jack Moffitt
395 406 <jack@xiph.org>, for the Debian project (but may be used by others).
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now