##// END OF EJS Templates
- Small manual update about Emacs...
fperez -
Show More
@@ -1,5264 +1,5275 b''
1 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * Manual: thanks to a tip on proper color handling for Emacs, by
4 Eric J Haywiser <ejh1-AT-MIT.EDU>.
5
6 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
7 by applying the provided patch. Thanks to Liu Jin
8 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
9 XEmacs/Linux, I'm trusting the submitter that it actually helps
10 under win32/GNU Emacs. Will revisit if any problems are reported.
11
1 12 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2 13
3 14 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
4 15 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
5 16
6 17 2006-03-12 Ville Vainio <vivainio@gmail.com>
7 18
8 19 * Magic.py (magic_timeit): Added %timeit magic, contributed by
9 20 Torsten Marek.
10 21
11 22 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
12 23
13 24 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
14 25 line ranges works again.
15 26
16 27 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
17 28
18 29 * IPython/iplib.py (showtraceback): add back sys.last_traceback
19 30 and friends, after a discussion with Zach Pincus on ipython-user.
20 31 I'm not 100% sure, but after thinking aobut it quite a bit, it may
21 32 be OK. Testing with the multithreaded shells didn't reveal any
22 33 problems, but let's keep an eye out.
23 34
24 35 In the process, I fixed a few things which were calling
25 36 self.InteractiveTB() directly (like safe_execfile), which is a
26 37 mistake: ALL exception reporting should be done by calling
27 38 self.showtraceback(), which handles state and tab-completion and
28 39 more.
29 40
30 41 2006-03-01 Ville Vainio <vivainio@gmail.com>
31 42
32 43 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
33 44 To use, do "from ipipe import *".
34 45
35 46 2006-02-24 Ville Vainio <vivainio@gmail.com>
36 47
37 48 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
38 49 "cleanly" and safely than the older upgrade mechanism.
39 50
40 51 2006-02-21 Ville Vainio <vivainio@gmail.com>
41 52
42 53 * Magic.py: %save works again.
43 54
44 55 2006-02-15 Ville Vainio <vivainio@gmail.com>
45 56
46 57 * Magic.py: %Pprint works again
47 58
48 59 * Extensions/ipy_sane_defaults.py: Provide everything provided
49 60 in default ipythonrc, to make it possible to have a completely empty
50 61 ipythonrc (and thus completely rc-file free configuration)
51 62
52 63
53 64 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
54 65
55 66 * IPython/hooks.py (editor): quote the call to the editor command,
56 67 to allow commands with spaces in them. Problem noted by watching
57 68 Ian Oswald's video about textpad under win32 at
58 69 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
59 70
60 71 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
61 72 describing magics (we haven't used @ for a loong time).
62 73
63 74 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
64 75 contributed by marienz to close
65 76 http://www.scipy.net/roundup/ipython/issue53.
66 77
67 78 2006-02-10 Ville Vainio <vivainio@gmail.com>
68 79
69 80 * genutils.py: getoutput now works in win32 too
70 81
71 82 * completer.py: alias and magic completion only invoked
72 83 at the first "item" in the line, to avoid "cd %store"
73 84 nonsense.
74 85
75 86 2006-02-09 Ville Vainio <vivainio@gmail.com>
76 87
77 88 * test/*: Added a unit testing framework (finally).
78 89 '%run runtests.py' to run test_*.
79 90
80 91 * ipapi.py: Exposed runlines and set_custom_exc
81 92
82 93 2006-02-07 Ville Vainio <vivainio@gmail.com>
83 94
84 95 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
85 96 instead use "f(1 2)" as before.
86 97
87 98 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
88 99
89 100 * IPython/demo.py (IPythonDemo): Add new classes to the demo
90 101 facilities, for demos processed by the IPython input filter
91 102 (IPythonDemo), and for running a script one-line-at-a-time as a
92 103 demo, both for pure Python (LineDemo) and for IPython-processed
93 104 input (IPythonLineDemo). After a request by Dave Kohel, from the
94 105 SAGE team.
95 106 (Demo.edit): added and edit() method to the demo objects, to edit
96 107 the in-memory copy of the last executed block.
97 108
98 109 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
99 110 processing to %edit, %macro and %save. These commands can now be
100 111 invoked on the unprocessed input as it was typed by the user
101 112 (without any prefilters applied). After requests by the SAGE team
102 113 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
103 114
104 115 2006-02-01 Ville Vainio <vivainio@gmail.com>
105 116
106 117 * setup.py, eggsetup.py: easy_install ipython==dev works
107 118 correctly now (on Linux)
108 119
109 120 * ipy_user_conf,ipmaker: user config changes, removed spurious
110 121 warnings
111 122
112 123 * iplib: if rc.banner is string, use it as is.
113 124
114 125 * Magic: %pycat accepts a string argument and pages it's contents.
115 126
116 127
117 128 2006-01-30 Ville Vainio <vivainio@gmail.com>
118 129
119 130 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
120 131 Now %store and bookmarks work through PickleShare, meaning that
121 132 concurrent access is possible and all ipython sessions see the
122 133 same database situation all the time, instead of snapshot of
123 134 the situation when the session was started. Hence, %bookmark
124 135 results are immediately accessible from othes sessions. The database
125 136 is also available for use by user extensions. See:
126 137 http://www.python.org/pypi/pickleshare
127 138
128 139 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
129 140
130 141 * aliases can now be %store'd
131 142
132 143 * path.py move to Extensions so that pickleshare does not need
133 144 IPython-specific import. Extensions added to pythonpath right
134 145 at __init__.
135 146
136 147 * iplib.py: ipalias deprecated/redundant; aliases are converted and
137 148 called with _ip.system and the pre-transformed command string.
138 149
139 150 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
140 151
141 152 * IPython/iplib.py (interact): Fix that we were not catching
142 153 KeyboardInterrupt exceptions properly. I'm not quite sure why the
143 154 logic here had to change, but it's fixed now.
144 155
145 156 2006-01-29 Ville Vainio <vivainio@gmail.com>
146 157
147 158 * iplib.py: Try to import pyreadline on Windows.
148 159
149 160 2006-01-27 Ville Vainio <vivainio@gmail.com>
150 161
151 162 * iplib.py: Expose ipapi as _ip in builtin namespace.
152 163 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
153 164 and ip_set_hook (-> _ip.set_hook) redundant. % and !
154 165 syntax now produce _ip.* variant of the commands.
155 166
156 167 * "_ip.options().autoedit_syntax = 2" automatically throws
157 168 user to editor for syntax error correction without prompting.
158 169
159 170 2006-01-27 Ville Vainio <vivainio@gmail.com>
160 171
161 172 * ipmaker.py: Give "realistic" sys.argv for scripts (without
162 173 'ipython' at argv[0]) executed through command line.
163 174 NOTE: this DEPRECATES calling ipython with multiple scripts
164 175 ("ipython a.py b.py c.py")
165 176
166 177 * iplib.py, hooks.py: Added configurable input prefilter,
167 178 named 'input_prefilter'. See ext_rescapture.py for example
168 179 usage.
169 180
170 181 * ext_rescapture.py, Magic.py: Better system command output capture
171 182 through 'var = !ls' (deprecates user-visible %sc). Same notation
172 183 applies for magics, 'var = %alias' assigns alias list to var.
173 184
174 185 * ipapi.py: added meta() for accessing extension-usable data store.
175 186
176 187 * iplib.py: added InteractiveShell.getapi(). New magics should be
177 188 written doing self.getapi() instead of using the shell directly.
178 189
179 190 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
180 191 %store foo >> ~/myfoo.txt to store variables to files (in clean
181 192 textual form, not a restorable pickle).
182 193
183 194 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
184 195
185 196 * usage.py, Magic.py: added %quickref
186 197
187 198 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
188 199
189 200 * GetoptErrors when invoking magics etc. with wrong args
190 201 are now more helpful:
191 202 GetoptError: option -l not recognized (allowed: "qb" )
192 203
193 204 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
194 205
195 206 * IPython/demo.py (Demo.show): Flush stdout after each block, so
196 207 computationally intensive blocks don't appear to stall the demo.
197 208
198 209 2006-01-24 Ville Vainio <vivainio@gmail.com>
199 210
200 211 * iplib.py, hooks.py: 'result_display' hook can return a non-None
201 212 value to manipulate resulting history entry.
202 213
203 214 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
204 215 to instance methods of IPApi class, to make extending an embedded
205 216 IPython feasible. See ext_rehashdir.py for example usage.
206 217
207 218 * Merged 1071-1076 from banches/0.7.1
208 219
209 220
210 221 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
211 222
212 223 * tools/release (daystamp): Fix build tools to use the new
213 224 eggsetup.py script to build lightweight eggs.
214 225
215 226 * Applied changesets 1062 and 1064 before 0.7.1 release.
216 227
217 228 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
218 229 see the raw input history (without conversions like %ls ->
219 230 ipmagic("ls")). After a request from W. Stein, SAGE
220 231 (http://modular.ucsd.edu/sage) developer. This information is
221 232 stored in the input_hist_raw attribute of the IPython instance, so
222 233 developers can access it if needed (it's an InputList instance).
223 234
224 235 * Versionstring = 0.7.2.svn
225 236
226 237 * eggsetup.py: A separate script for constructing eggs, creates
227 238 proper launch scripts even on Windows (an .exe file in
228 239 \python24\scripts).
229 240
230 241 * ipapi.py: launch_new_instance, launch entry point needed for the
231 242 egg.
232 243
233 244 2006-01-23 Ville Vainio <vivainio@gmail.com>
234 245
235 246 * Added %cpaste magic for pasting python code
236 247
237 248 2006-01-22 Ville Vainio <vivainio@gmail.com>
238 249
239 250 * Merge from branches/0.7.1 into trunk, revs 1052-1057
240 251
241 252 * Versionstring = 0.7.2.svn
242 253
243 254 * eggsetup.py: A separate script for constructing eggs, creates
244 255 proper launch scripts even on Windows (an .exe file in
245 256 \python24\scripts).
246 257
247 258 * ipapi.py: launch_new_instance, launch entry point needed for the
248 259 egg.
249 260
250 261 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
251 262
252 263 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
253 264 %pfile foo would print the file for foo even if it was a binary.
254 265 Now, extensions '.so' and '.dll' are skipped.
255 266
256 267 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
257 268 bug, where macros would fail in all threaded modes. I'm not 100%
258 269 sure, so I'm going to put out an rc instead of making a release
259 270 today, and wait for feedback for at least a few days.
260 271
261 272 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
262 273 it...) the handling of pasting external code with autoindent on.
263 274 To get out of a multiline input, the rule will appear for most
264 275 users unchanged: two blank lines or change the indent level
265 276 proposed by IPython. But there is a twist now: you can
266 277 add/subtract only *one or two spaces*. If you add/subtract three
267 278 or more (unless you completely delete the line), IPython will
268 279 accept that line, and you'll need to enter a second one of pure
269 280 whitespace. I know it sounds complicated, but I can't find a
270 281 different solution that covers all the cases, with the right
271 282 heuristics. Hopefully in actual use, nobody will really notice
272 283 all these strange rules and things will 'just work'.
273 284
274 285 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
275 286
276 287 * IPython/iplib.py (interact): catch exceptions which can be
277 288 triggered asynchronously by signal handlers. Thanks to an
278 289 automatic crash report, submitted by Colin Kingsley
279 290 <tercel-AT-gentoo.org>.
280 291
281 292 2006-01-20 Ville Vainio <vivainio@gmail.com>
282 293
283 294 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
284 295 (%rehashdir, very useful, try it out) of how to extend ipython
285 296 with new magics. Also added Extensions dir to pythonpath to make
286 297 importing extensions easy.
287 298
288 299 * %store now complains when trying to store interactively declared
289 300 classes / instances of those classes.
290 301
291 302 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
292 303 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
293 304 if they exist, and ipy_user_conf.py with some defaults is created for
294 305 the user.
295 306
296 307 * Startup rehashing done by the config file, not InterpreterExec.
297 308 This means system commands are available even without selecting the
298 309 pysh profile. It's the sensible default after all.
299 310
300 311 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
301 312
302 313 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
303 314 multiline code with autoindent on working. But I am really not
304 315 sure, so this needs more testing. Will commit a debug-enabled
305 316 version for now, while I test it some more, so that Ville and
306 317 others may also catch any problems. Also made
307 318 self.indent_current_str() a method, to ensure that there's no
308 319 chance of the indent space count and the corresponding string
309 320 falling out of sync. All code needing the string should just call
310 321 the method.
311 322
312 323 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
313 324
314 325 * IPython/Magic.py (magic_edit): fix check for when users don't
315 326 save their output files, the try/except was in the wrong section.
316 327
317 328 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
318 329
319 330 * IPython/Magic.py (magic_run): fix __file__ global missing from
320 331 script's namespace when executed via %run. After a report by
321 332 Vivian.
322 333
323 334 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
324 335 when using python 2.4. The parent constructor changed in 2.4, and
325 336 we need to track it directly (we can't call it, as it messes up
326 337 readline and tab-completion inside our pdb would stop working).
327 338 After a bug report by R. Bernstein <rocky-AT-panix.com>.
328 339
329 340 2006-01-16 Ville Vainio <vivainio@gmail.com>
330 341
331 342 * Ipython/magic.py:Reverted back to old %edit functionality
332 343 that returns file contents on exit.
333 344
334 345 * IPython/path.py: Added Jason Orendorff's "path" module to
335 346 IPython tree, http://www.jorendorff.com/articles/python/path/.
336 347 You can get path objects conveniently through %sc, and !!, e.g.:
337 348 sc files=ls
338 349 for p in files.paths: # or files.p
339 350 print p,p.mtime
340 351
341 352 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
342 353 now work again without considering the exclusion regexp -
343 354 hence, things like ',foo my/path' turn to 'foo("my/path")'
344 355 instead of syntax error.
345 356
346 357
347 358 2006-01-14 Ville Vainio <vivainio@gmail.com>
348 359
349 360 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
350 361 ipapi decorators for python 2.4 users, options() provides access to rc
351 362 data.
352 363
353 364 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
354 365 as path separators (even on Linux ;-). Space character after
355 366 backslash (as yielded by tab completer) is still space;
356 367 "%cd long\ name" works as expected.
357 368
358 369 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
359 370 as "chain of command", with priority. API stays the same,
360 371 TryNext exception raised by a hook function signals that
361 372 current hook failed and next hook should try handling it, as
362 373 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
363 374 requested configurable display hook, which is now implemented.
364 375
365 376 2006-01-13 Ville Vainio <vivainio@gmail.com>
366 377
367 378 * IPython/platutils*.py: platform specific utility functions,
368 379 so far only set_term_title is implemented (change terminal
369 380 label in windowing systems). %cd now changes the title to
370 381 current dir.
371 382
372 383 * IPython/Release.py: Added myself to "authors" list,
373 384 had to create new files.
374 385
375 386 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
376 387 shell escape; not a known bug but had potential to be one in the
377 388 future.
378 389
379 390 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
380 391 extension API for IPython! See the module for usage example. Fix
381 392 OInspect for docstring-less magic functions.
382 393
383 394
384 395 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
385 396
386 397 * IPython/iplib.py (raw_input): temporarily deactivate all
387 398 attempts at allowing pasting of code with autoindent on. It
388 399 introduced bugs (reported by Prabhu) and I can't seem to find a
389 400 robust combination which works in all cases. Will have to revisit
390 401 later.
391 402
392 403 * IPython/genutils.py: remove isspace() function. We've dropped
393 404 2.2 compatibility, so it's OK to use the string method.
394 405
395 406 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
396 407
397 408 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
398 409 matching what NOT to autocall on, to include all python binary
399 410 operators (including things like 'and', 'or', 'is' and 'in').
400 411 Prompted by a bug report on 'foo & bar', but I realized we had
401 412 many more potential bug cases with other operators. The regexp is
402 413 self.re_exclude_auto, it's fairly commented.
403 414
404 415 2006-01-12 Ville Vainio <vivainio@gmail.com>
405 416
406 417 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
407 418 Prettified and hardened string/backslash quoting with ipsystem(),
408 419 ipalias() and ipmagic(). Now even \ characters are passed to
409 420 %magics, !shell escapes and aliases exactly as they are in the
410 421 ipython command line. Should improve backslash experience,
411 422 particularly in Windows (path delimiter for some commands that
412 423 won't understand '/'), but Unix benefits as well (regexps). %cd
413 424 magic still doesn't support backslash path delimiters, though. Also
414 425 deleted all pretense of supporting multiline command strings in
415 426 !system or %magic commands. Thanks to Jerry McRae for suggestions.
416 427
417 428 * doc/build_doc_instructions.txt added. Documentation on how to
418 429 use doc/update_manual.py, added yesterday. Both files contributed
419 430 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
420 431 doc/*.sh for deprecation at a later date.
421 432
422 433 * /ipython.py Added ipython.py to root directory for
423 434 zero-installation (tar xzvf ipython.tgz; cd ipython; python
424 435 ipython.py) and development convenience (no need to kee doing
425 436 "setup.py install" between changes).
426 437
427 438 * Made ! and !! shell escapes work (again) in multiline expressions:
428 439 if 1:
429 440 !ls
430 441 !!ls
431 442
432 443 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
433 444
434 445 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
435 446 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
436 447 module in case-insensitive installation. Was causing crashes
437 448 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
438 449
439 450 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
440 451 <marienz-AT-gentoo.org>, closes
441 452 http://www.scipy.net/roundup/ipython/issue51.
442 453
443 454 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
444 455
445 456 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
446 457 problem of excessive CPU usage under *nix and keyboard lag under
447 458 win32.
448 459
449 460 2006-01-10 *** Released version 0.7.0
450 461
451 462 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
452 463
453 464 * IPython/Release.py (revision): tag version number to 0.7.0,
454 465 ready for release.
455 466
456 467 * IPython/Magic.py (magic_edit): Add print statement to %edit so
457 468 it informs the user of the name of the temp. file used. This can
458 469 help if you decide later to reuse that same file, so you know
459 470 where to copy the info from.
460 471
461 472 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
462 473
463 474 * setup_bdist_egg.py: little script to build an egg. Added
464 475 support in the release tools as well.
465 476
466 477 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
467 478
468 479 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
469 480 version selection (new -wxversion command line and ipythonrc
470 481 parameter). Patch contributed by Arnd Baecker
471 482 <arnd.baecker-AT-web.de>.
472 483
473 484 * IPython/iplib.py (embed_mainloop): fix tab-completion in
474 485 embedded instances, for variables defined at the interactive
475 486 prompt of the embedded ipython. Reported by Arnd.
476 487
477 488 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
478 489 it can be used as a (stateful) toggle, or with a direct parameter.
479 490
480 491 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
481 492 could be triggered in certain cases and cause the traceback
482 493 printer not to work.
483 494
484 495 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
485 496
486 497 * IPython/iplib.py (_should_recompile): Small fix, closes
487 498 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
488 499
489 500 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
490 501
491 502 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
492 503 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
493 504 Moad for help with tracking it down.
494 505
495 506 * IPython/iplib.py (handle_auto): fix autocall handling for
496 507 objects which support BOTH __getitem__ and __call__ (so that f [x]
497 508 is left alone, instead of becoming f([x]) automatically).
498 509
499 510 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
500 511 Ville's patch.
501 512
502 513 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
503 514
504 515 * IPython/iplib.py (handle_auto): changed autocall semantics to
505 516 include 'smart' mode, where the autocall transformation is NOT
506 517 applied if there are no arguments on the line. This allows you to
507 518 just type 'foo' if foo is a callable to see its internal form,
508 519 instead of having it called with no arguments (typically a
509 520 mistake). The old 'full' autocall still exists: for that, you
510 521 need to set the 'autocall' parameter to 2 in your ipythonrc file.
511 522
512 523 * IPython/completer.py (Completer.attr_matches): add
513 524 tab-completion support for Enthoughts' traits. After a report by
514 525 Arnd and a patch by Prabhu.
515 526
516 527 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
517 528
518 529 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
519 530 Schmolck's patch to fix inspect.getinnerframes().
520 531
521 532 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
522 533 for embedded instances, regarding handling of namespaces and items
523 534 added to the __builtin__ one. Multiple embedded instances and
524 535 recursive embeddings should work better now (though I'm not sure
525 536 I've got all the corner cases fixed, that code is a bit of a brain
526 537 twister).
527 538
528 539 * IPython/Magic.py (magic_edit): added support to edit in-memory
529 540 macros (automatically creates the necessary temp files). %edit
530 541 also doesn't return the file contents anymore, it's just noise.
531 542
532 543 * IPython/completer.py (Completer.attr_matches): revert change to
533 544 complete only on attributes listed in __all__. I realized it
534 545 cripples the tab-completion system as a tool for exploring the
535 546 internals of unknown libraries (it renders any non-__all__
536 547 attribute off-limits). I got bit by this when trying to see
537 548 something inside the dis module.
538 549
539 550 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
540 551
541 552 * IPython/iplib.py (InteractiveShell.__init__): add .meta
542 553 namespace for users and extension writers to hold data in. This
543 554 follows the discussion in
544 555 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
545 556
546 557 * IPython/completer.py (IPCompleter.complete): small patch to help
547 558 tab-completion under Emacs, after a suggestion by John Barnard
548 559 <barnarj-AT-ccf.org>.
549 560
550 561 * IPython/Magic.py (Magic.extract_input_slices): added support for
551 562 the slice notation in magics to use N-M to represent numbers N...M
552 563 (closed endpoints). This is used by %macro and %save.
553 564
554 565 * IPython/completer.py (Completer.attr_matches): for modules which
555 566 define __all__, complete only on those. After a patch by Jeffrey
556 567 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
557 568 speed up this routine.
558 569
559 570 * IPython/Logger.py (Logger.log): fix a history handling bug. I
560 571 don't know if this is the end of it, but the behavior now is
561 572 certainly much more correct. Note that coupled with macros,
562 573 slightly surprising (at first) behavior may occur: a macro will in
563 574 general expand to multiple lines of input, so upon exiting, the
564 575 in/out counters will both be bumped by the corresponding amount
565 576 (as if the macro's contents had been typed interactively). Typing
566 577 %hist will reveal the intermediate (silently processed) lines.
567 578
568 579 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
569 580 pickle to fail (%run was overwriting __main__ and not restoring
570 581 it, but pickle relies on __main__ to operate).
571 582
572 583 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
573 584 using properties, but forgot to make the main InteractiveShell
574 585 class a new-style class. Properties fail silently, and
575 586 misteriously, with old-style class (getters work, but
576 587 setters don't do anything).
577 588
578 589 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
579 590
580 591 * IPython/Magic.py (magic_history): fix history reporting bug (I
581 592 know some nasties are still there, I just can't seem to find a
582 593 reproducible test case to track them down; the input history is
583 594 falling out of sync...)
584 595
585 596 * IPython/iplib.py (handle_shell_escape): fix bug where both
586 597 aliases and system accesses where broken for indented code (such
587 598 as loops).
588 599
589 600 * IPython/genutils.py (shell): fix small but critical bug for
590 601 win32 system access.
591 602
592 603 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
593 604
594 605 * IPython/iplib.py (showtraceback): remove use of the
595 606 sys.last_{type/value/traceback} structures, which are non
596 607 thread-safe.
597 608 (_prefilter): change control flow to ensure that we NEVER
598 609 introspect objects when autocall is off. This will guarantee that
599 610 having an input line of the form 'x.y', where access to attribute
600 611 'y' has side effects, doesn't trigger the side effect TWICE. It
601 612 is important to note that, with autocall on, these side effects
602 613 can still happen.
603 614 (ipsystem): new builtin, to complete the ip{magic/alias/system}
604 615 trio. IPython offers these three kinds of special calls which are
605 616 not python code, and it's a good thing to have their call method
606 617 be accessible as pure python functions (not just special syntax at
607 618 the command line). It gives us a better internal implementation
608 619 structure, as well as exposing these for user scripting more
609 620 cleanly.
610 621
611 622 * IPython/macro.py (Macro.__init__): moved macros to a standalone
612 623 file. Now that they'll be more likely to be used with the
613 624 persistance system (%store), I want to make sure their module path
614 625 doesn't change in the future, so that we don't break things for
615 626 users' persisted data.
616 627
617 628 * IPython/iplib.py (autoindent_update): move indentation
618 629 management into the _text_ processing loop, not the keyboard
619 630 interactive one. This is necessary to correctly process non-typed
620 631 multiline input (such as macros).
621 632
622 633 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
623 634 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
624 635 which was producing problems in the resulting manual.
625 636 (magic_whos): improve reporting of instances (show their class,
626 637 instead of simply printing 'instance' which isn't terribly
627 638 informative).
628 639
629 640 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
630 641 (minor mods) to support network shares under win32.
631 642
632 643 * IPython/winconsole.py (get_console_size): add new winconsole
633 644 module and fixes to page_dumb() to improve its behavior under
634 645 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
635 646
636 647 * IPython/Magic.py (Macro): simplified Macro class to just
637 648 subclass list. We've had only 2.2 compatibility for a very long
638 649 time, yet I was still avoiding subclassing the builtin types. No
639 650 more (I'm also starting to use properties, though I won't shift to
640 651 2.3-specific features quite yet).
641 652 (magic_store): added Ville's patch for lightweight variable
642 653 persistence, after a request on the user list by Matt Wilkie
643 654 <maphew-AT-gmail.com>. The new %store magic's docstring has full
644 655 details.
645 656
646 657 * IPython/iplib.py (InteractiveShell.post_config_initialization):
647 658 changed the default logfile name from 'ipython.log' to
648 659 'ipython_log.py'. These logs are real python files, and now that
649 660 we have much better multiline support, people are more likely to
650 661 want to use them as such. Might as well name them correctly.
651 662
652 663 * IPython/Magic.py: substantial cleanup. While we can't stop
653 664 using magics as mixins, due to the existing customizations 'out
654 665 there' which rely on the mixin naming conventions, at least I
655 666 cleaned out all cross-class name usage. So once we are OK with
656 667 breaking compatibility, the two systems can be separated.
657 668
658 669 * IPython/Logger.py: major cleanup. This one is NOT a mixin
659 670 anymore, and the class is a fair bit less hideous as well. New
660 671 features were also introduced: timestamping of input, and logging
661 672 of output results. These are user-visible with the -t and -o
662 673 options to %logstart. Closes
663 674 http://www.scipy.net/roundup/ipython/issue11 and a request by
664 675 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
665 676
666 677 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
667 678
668 679 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
669 680 better hadnle backslashes in paths. See the thread 'More Windows
670 681 questions part 2 - \/ characters revisited' on the iypthon user
671 682 list:
672 683 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
673 684
674 685 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
675 686
676 687 (InteractiveShell.__init__): change threaded shells to not use the
677 688 ipython crash handler. This was causing more problems than not,
678 689 as exceptions in the main thread (GUI code, typically) would
679 690 always show up as a 'crash', when they really weren't.
680 691
681 692 The colors and exception mode commands (%colors/%xmode) have been
682 693 synchronized to also take this into account, so users can get
683 694 verbose exceptions for their threaded code as well. I also added
684 695 support for activating pdb inside this exception handler as well,
685 696 so now GUI authors can use IPython's enhanced pdb at runtime.
686 697
687 698 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
688 699 true by default, and add it to the shipped ipythonrc file. Since
689 700 this asks the user before proceeding, I think it's OK to make it
690 701 true by default.
691 702
692 703 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
693 704 of the previous special-casing of input in the eval loop. I think
694 705 this is cleaner, as they really are commands and shouldn't have
695 706 a special role in the middle of the core code.
696 707
697 708 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
698 709
699 710 * IPython/iplib.py (edit_syntax_error): added support for
700 711 automatically reopening the editor if the file had a syntax error
701 712 in it. Thanks to scottt who provided the patch at:
702 713 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
703 714 version committed).
704 715
705 716 * IPython/iplib.py (handle_normal): add suport for multi-line
706 717 input with emtpy lines. This fixes
707 718 http://www.scipy.net/roundup/ipython/issue43 and a similar
708 719 discussion on the user list.
709 720
710 721 WARNING: a behavior change is necessarily introduced to support
711 722 blank lines: now a single blank line with whitespace does NOT
712 723 break the input loop, which means that when autoindent is on, by
713 724 default hitting return on the next (indented) line does NOT exit.
714 725
715 726 Instead, to exit a multiline input you can either have:
716 727
717 728 - TWO whitespace lines (just hit return again), or
718 729 - a single whitespace line of a different length than provided
719 730 by the autoindent (add or remove a space).
720 731
721 732 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
722 733 module to better organize all readline-related functionality.
723 734 I've deleted FlexCompleter and put all completion clases here.
724 735
725 736 * IPython/iplib.py (raw_input): improve indentation management.
726 737 It is now possible to paste indented code with autoindent on, and
727 738 the code is interpreted correctly (though it still looks bad on
728 739 screen, due to the line-oriented nature of ipython).
729 740 (MagicCompleter.complete): change behavior so that a TAB key on an
730 741 otherwise empty line actually inserts a tab, instead of completing
731 742 on the entire global namespace. This makes it easier to use the
732 743 TAB key for indentation. After a request by Hans Meine
733 744 <hans_meine-AT-gmx.net>
734 745 (_prefilter): add support so that typing plain 'exit' or 'quit'
735 746 does a sensible thing. Originally I tried to deviate as little as
736 747 possible from the default python behavior, but even that one may
737 748 change in this direction (thread on python-dev to that effect).
738 749 Regardless, ipython should do the right thing even if CPython's
739 750 '>>>' prompt doesn't.
740 751 (InteractiveShell): removed subclassing code.InteractiveConsole
741 752 class. By now we'd overridden just about all of its methods: I've
742 753 copied the remaining two over, and now ipython is a standalone
743 754 class. This will provide a clearer picture for the chainsaw
744 755 branch refactoring.
745 756
746 757 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
747 758
748 759 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
749 760 failures for objects which break when dir() is called on them.
750 761
751 762 * IPython/FlexCompleter.py (Completer.__init__): Added support for
752 763 distinct local and global namespaces in the completer API. This
753 764 change allows us top properly handle completion with distinct
754 765 scopes, including in embedded instances (this had never really
755 766 worked correctly).
756 767
757 768 Note: this introduces a change in the constructor for
758 769 MagicCompleter, as a new global_namespace parameter is now the
759 770 second argument (the others were bumped one position).
760 771
761 772 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
762 773
763 774 * IPython/iplib.py (embed_mainloop): fix tab-completion in
764 775 embedded instances (which can be done now thanks to Vivian's
765 776 frame-handling fixes for pdb).
766 777 (InteractiveShell.__init__): Fix namespace handling problem in
767 778 embedded instances. We were overwriting __main__ unconditionally,
768 779 and this should only be done for 'full' (non-embedded) IPython;
769 780 embedded instances must respect the caller's __main__. Thanks to
770 781 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
771 782
772 783 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
773 784
774 785 * setup.py: added download_url to setup(). This registers the
775 786 download address at PyPI, which is not only useful to humans
776 787 browsing the site, but is also picked up by setuptools (the Eggs
777 788 machinery). Thanks to Ville and R. Kern for the info/discussion
778 789 on this.
779 790
780 791 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
781 792
782 793 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
783 794 This brings a lot of nice functionality to the pdb mode, which now
784 795 has tab-completion, syntax highlighting, and better stack handling
785 796 than before. Many thanks to Vivian De Smedt
786 797 <vivian-AT-vdesmedt.com> for the original patches.
787 798
788 799 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
789 800
790 801 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
791 802 sequence to consistently accept the banner argument. The
792 803 inconsistency was tripping SAGE, thanks to Gary Zablackis
793 804 <gzabl-AT-yahoo.com> for the report.
794 805
795 806 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
796 807
797 808 * IPython/iplib.py (InteractiveShell.post_config_initialization):
798 809 Fix bug where a naked 'alias' call in the ipythonrc file would
799 810 cause a crash. Bug reported by Jorgen Stenarson.
800 811
801 812 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
802 813
803 814 * IPython/ipmaker.py (make_IPython): cleanups which should improve
804 815 startup time.
805 816
806 817 * IPython/iplib.py (runcode): my globals 'fix' for embedded
807 818 instances had introduced a bug with globals in normal code. Now
808 819 it's working in all cases.
809 820
810 821 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
811 822 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
812 823 has been introduced to set the default case sensitivity of the
813 824 searches. Users can still select either mode at runtime on a
814 825 per-search basis.
815 826
816 827 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
817 828
818 829 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
819 830 attributes in wildcard searches for subclasses. Modified version
820 831 of a patch by Jorgen.
821 832
822 833 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
823 834
824 835 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
825 836 embedded instances. I added a user_global_ns attribute to the
826 837 InteractiveShell class to handle this.
827 838
828 839 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
829 840
830 841 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
831 842 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
832 843 (reported under win32, but may happen also in other platforms).
833 844 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
834 845
835 846 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
836 847
837 848 * IPython/Magic.py (magic_psearch): new support for wildcard
838 849 patterns. Now, typing ?a*b will list all names which begin with a
839 850 and end in b, for example. The %psearch magic has full
840 851 docstrings. Many thanks to Jörgen Stenarson
841 852 <jorgen.stenarson-AT-bostream.nu>, author of the patches
842 853 implementing this functionality.
843 854
844 855 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
845 856
846 857 * Manual: fixed long-standing annoyance of double-dashes (as in
847 858 --prefix=~, for example) being stripped in the HTML version. This
848 859 is a latex2html bug, but a workaround was provided. Many thanks
849 860 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
850 861 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
851 862 rolling. This seemingly small issue had tripped a number of users
852 863 when first installing, so I'm glad to see it gone.
853 864
854 865 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
855 866
856 867 * IPython/Extensions/numeric_formats.py: fix missing import,
857 868 reported by Stephen Walton.
858 869
859 870 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
860 871
861 872 * IPython/demo.py: finish demo module, fully documented now.
862 873
863 874 * IPython/genutils.py (file_read): simple little utility to read a
864 875 file and ensure it's closed afterwards.
865 876
866 877 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
867 878
868 879 * IPython/demo.py (Demo.__init__): added support for individually
869 880 tagging blocks for automatic execution.
870 881
871 882 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
872 883 syntax-highlighted python sources, requested by John.
873 884
874 885 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
875 886
876 887 * IPython/demo.py (Demo.again): fix bug where again() blocks after
877 888 finishing.
878 889
879 890 * IPython/genutils.py (shlex_split): moved from Magic to here,
880 891 where all 2.2 compatibility stuff lives. I needed it for demo.py.
881 892
882 893 * IPython/demo.py (Demo.__init__): added support for silent
883 894 blocks, improved marks as regexps, docstrings written.
884 895 (Demo.__init__): better docstring, added support for sys.argv.
885 896
886 897 * IPython/genutils.py (marquee): little utility used by the demo
887 898 code, handy in general.
888 899
889 900 * IPython/demo.py (Demo.__init__): new class for interactive
890 901 demos. Not documented yet, I just wrote it in a hurry for
891 902 scipy'05. Will docstring later.
892 903
893 904 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
894 905
895 906 * IPython/Shell.py (sigint_handler): Drastic simplification which
896 907 also seems to make Ctrl-C work correctly across threads! This is
897 908 so simple, that I can't beleive I'd missed it before. Needs more
898 909 testing, though.
899 910 (KBINT): Never mind, revert changes. I'm sure I'd tried something
900 911 like this before...
901 912
902 913 * IPython/genutils.py (get_home_dir): add protection against
903 914 non-dirs in win32 registry.
904 915
905 916 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
906 917 bug where dict was mutated while iterating (pysh crash).
907 918
908 919 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
909 920
910 921 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
911 922 spurious newlines added by this routine. After a report by
912 923 F. Mantegazza.
913 924
914 925 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
915 926
916 927 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
917 928 calls. These were a leftover from the GTK 1.x days, and can cause
918 929 problems in certain cases (after a report by John Hunter).
919 930
920 931 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
921 932 os.getcwd() fails at init time. Thanks to patch from David Remahl
922 933 <chmod007-AT-mac.com>.
923 934 (InteractiveShell.__init__): prevent certain special magics from
924 935 being shadowed by aliases. Closes
925 936 http://www.scipy.net/roundup/ipython/issue41.
926 937
927 938 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
928 939
929 940 * IPython/iplib.py (InteractiveShell.complete): Added new
930 941 top-level completion method to expose the completion mechanism
931 942 beyond readline-based environments.
932 943
933 944 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
934 945
935 946 * tools/ipsvnc (svnversion): fix svnversion capture.
936 947
937 948 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
938 949 attribute to self, which was missing. Before, it was set by a
939 950 routine which in certain cases wasn't being called, so the
940 951 instance could end up missing the attribute. This caused a crash.
941 952 Closes http://www.scipy.net/roundup/ipython/issue40.
942 953
943 954 2005-08-16 Fernando Perez <fperez@colorado.edu>
944 955
945 956 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
946 957 contains non-string attribute. Closes
947 958 http://www.scipy.net/roundup/ipython/issue38.
948 959
949 960 2005-08-14 Fernando Perez <fperez@colorado.edu>
950 961
951 962 * tools/ipsvnc: Minor improvements, to add changeset info.
952 963
953 964 2005-08-12 Fernando Perez <fperez@colorado.edu>
954 965
955 966 * IPython/iplib.py (runsource): remove self.code_to_run_src
956 967 attribute. I realized this is nothing more than
957 968 '\n'.join(self.buffer), and having the same data in two different
958 969 places is just asking for synchronization bugs. This may impact
959 970 people who have custom exception handlers, so I need to warn
960 971 ipython-dev about it (F. Mantegazza may use them).
961 972
962 973 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
963 974
964 975 * IPython/genutils.py: fix 2.2 compatibility (generators)
965 976
966 977 2005-07-18 Fernando Perez <fperez@colorado.edu>
967 978
968 979 * IPython/genutils.py (get_home_dir): fix to help users with
969 980 invalid $HOME under win32.
970 981
971 982 2005-07-17 Fernando Perez <fperez@colorado.edu>
972 983
973 984 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
974 985 some old hacks and clean up a bit other routines; code should be
975 986 simpler and a bit faster.
976 987
977 988 * IPython/iplib.py (interact): removed some last-resort attempts
978 989 to survive broken stdout/stderr. That code was only making it
979 990 harder to abstract out the i/o (necessary for gui integration),
980 991 and the crashes it could prevent were extremely rare in practice
981 992 (besides being fully user-induced in a pretty violent manner).
982 993
983 994 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
984 995 Nothing major yet, but the code is simpler to read; this should
985 996 make it easier to do more serious modifications in the future.
986 997
987 998 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
988 999 which broke in .15 (thanks to a report by Ville).
989 1000
990 1001 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
991 1002 be quite correct, I know next to nothing about unicode). This
992 1003 will allow unicode strings to be used in prompts, amongst other
993 1004 cases. It also will prevent ipython from crashing when unicode
994 1005 shows up unexpectedly in many places. If ascii encoding fails, we
995 1006 assume utf_8. Currently the encoding is not a user-visible
996 1007 setting, though it could be made so if there is demand for it.
997 1008
998 1009 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
999 1010
1000 1011 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1001 1012
1002 1013 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1003 1014
1004 1015 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1005 1016 code can work transparently for 2.2/2.3.
1006 1017
1007 1018 2005-07-16 Fernando Perez <fperez@colorado.edu>
1008 1019
1009 1020 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1010 1021 out of the color scheme table used for coloring exception
1011 1022 tracebacks. This allows user code to add new schemes at runtime.
1012 1023 This is a minimally modified version of the patch at
1013 1024 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1014 1025 for the contribution.
1015 1026
1016 1027 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1017 1028 slightly modified version of the patch in
1018 1029 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1019 1030 to remove the previous try/except solution (which was costlier).
1020 1031 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1021 1032
1022 1033 2005-06-08 Fernando Perez <fperez@colorado.edu>
1023 1034
1024 1035 * IPython/iplib.py (write/write_err): Add methods to abstract all
1025 1036 I/O a bit more.
1026 1037
1027 1038 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1028 1039 warning, reported by Aric Hagberg, fix by JD Hunter.
1029 1040
1030 1041 2005-06-02 *** Released version 0.6.15
1031 1042
1032 1043 2005-06-01 Fernando Perez <fperez@colorado.edu>
1033 1044
1034 1045 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1035 1046 tab-completion of filenames within open-quoted strings. Note that
1036 1047 this requires that in ~/.ipython/ipythonrc, users change the
1037 1048 readline delimiters configuration to read:
1038 1049
1039 1050 readline_remove_delims -/~
1040 1051
1041 1052
1042 1053 2005-05-31 *** Released version 0.6.14
1043 1054
1044 1055 2005-05-29 Fernando Perez <fperez@colorado.edu>
1045 1056
1046 1057 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1047 1058 with files not on the filesystem. Reported by Eliyahu Sandler
1048 1059 <eli@gondolin.net>
1049 1060
1050 1061 2005-05-22 Fernando Perez <fperez@colorado.edu>
1051 1062
1052 1063 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1053 1064 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1054 1065
1055 1066 2005-05-19 Fernando Perez <fperez@colorado.edu>
1056 1067
1057 1068 * IPython/iplib.py (safe_execfile): close a file which could be
1058 1069 left open (causing problems in win32, which locks open files).
1059 1070 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1060 1071
1061 1072 2005-05-18 Fernando Perez <fperez@colorado.edu>
1062 1073
1063 1074 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1064 1075 keyword arguments correctly to safe_execfile().
1065 1076
1066 1077 2005-05-13 Fernando Perez <fperez@colorado.edu>
1067 1078
1068 1079 * ipython.1: Added info about Qt to manpage, and threads warning
1069 1080 to usage page (invoked with --help).
1070 1081
1071 1082 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1072 1083 new matcher (it goes at the end of the priority list) to do
1073 1084 tab-completion on named function arguments. Submitted by George
1074 1085 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1075 1086 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1076 1087 for more details.
1077 1088
1078 1089 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1079 1090 SystemExit exceptions in the script being run. Thanks to a report
1080 1091 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1081 1092 producing very annoying behavior when running unit tests.
1082 1093
1083 1094 2005-05-12 Fernando Perez <fperez@colorado.edu>
1084 1095
1085 1096 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1086 1097 which I'd broken (again) due to a changed regexp. In the process,
1087 1098 added ';' as an escape to auto-quote the whole line without
1088 1099 splitting its arguments. Thanks to a report by Jerry McRae
1089 1100 <qrs0xyc02-AT-sneakemail.com>.
1090 1101
1091 1102 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1092 1103 possible crashes caused by a TokenError. Reported by Ed Schofield
1093 1104 <schofield-AT-ftw.at>.
1094 1105
1095 1106 2005-05-06 Fernando Perez <fperez@colorado.edu>
1096 1107
1097 1108 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1098 1109
1099 1110 2005-04-29 Fernando Perez <fperez@colorado.edu>
1100 1111
1101 1112 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1102 1113 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1103 1114 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1104 1115 which provides support for Qt interactive usage (similar to the
1105 1116 existing one for WX and GTK). This had been often requested.
1106 1117
1107 1118 2005-04-14 *** Released version 0.6.13
1108 1119
1109 1120 2005-04-08 Fernando Perez <fperez@colorado.edu>
1110 1121
1111 1122 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1112 1123 from _ofind, which gets called on almost every input line. Now,
1113 1124 we only try to get docstrings if they are actually going to be
1114 1125 used (the overhead of fetching unnecessary docstrings can be
1115 1126 noticeable for certain objects, such as Pyro proxies).
1116 1127
1117 1128 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1118 1129 for completers. For some reason I had been passing them the state
1119 1130 variable, which completers never actually need, and was in
1120 1131 conflict with the rlcompleter API. Custom completers ONLY need to
1121 1132 take the text parameter.
1122 1133
1123 1134 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1124 1135 work correctly in pysh. I've also moved all the logic which used
1125 1136 to be in pysh.py here, which will prevent problems with future
1126 1137 upgrades. However, this time I must warn users to update their
1127 1138 pysh profile to include the line
1128 1139
1129 1140 import_all IPython.Extensions.InterpreterExec
1130 1141
1131 1142 because otherwise things won't work for them. They MUST also
1132 1143 delete pysh.py and the line
1133 1144
1134 1145 execfile pysh.py
1135 1146
1136 1147 from their ipythonrc-pysh.
1137 1148
1138 1149 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1139 1150 robust in the face of objects whose dir() returns non-strings
1140 1151 (which it shouldn't, but some broken libs like ITK do). Thanks to
1141 1152 a patch by John Hunter (implemented differently, though). Also
1142 1153 minor improvements by using .extend instead of + on lists.
1143 1154
1144 1155 * pysh.py:
1145 1156
1146 1157 2005-04-06 Fernando Perez <fperez@colorado.edu>
1147 1158
1148 1159 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1149 1160 by default, so that all users benefit from it. Those who don't
1150 1161 want it can still turn it off.
1151 1162
1152 1163 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1153 1164 config file, I'd forgotten about this, so users were getting it
1154 1165 off by default.
1155 1166
1156 1167 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1157 1168 consistency. Now magics can be called in multiline statements,
1158 1169 and python variables can be expanded in magic calls via $var.
1159 1170 This makes the magic system behave just like aliases or !system
1160 1171 calls.
1161 1172
1162 1173 2005-03-28 Fernando Perez <fperez@colorado.edu>
1163 1174
1164 1175 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1165 1176 expensive string additions for building command. Add support for
1166 1177 trailing ';' when autocall is used.
1167 1178
1168 1179 2005-03-26 Fernando Perez <fperez@colorado.edu>
1169 1180
1170 1181 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1171 1182 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1172 1183 ipython.el robust against prompts with any number of spaces
1173 1184 (including 0) after the ':' character.
1174 1185
1175 1186 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1176 1187 continuation prompt, which misled users to think the line was
1177 1188 already indented. Closes debian Bug#300847, reported to me by
1178 1189 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1179 1190
1180 1191 2005-03-23 Fernando Perez <fperez@colorado.edu>
1181 1192
1182 1193 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1183 1194 properly aligned if they have embedded newlines.
1184 1195
1185 1196 * IPython/iplib.py (runlines): Add a public method to expose
1186 1197 IPython's code execution machinery, so that users can run strings
1187 1198 as if they had been typed at the prompt interactively.
1188 1199 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1189 1200 methods which can call the system shell, but with python variable
1190 1201 expansion. The three such methods are: __IPYTHON__.system,
1191 1202 .getoutput and .getoutputerror. These need to be documented in a
1192 1203 'public API' section (to be written) of the manual.
1193 1204
1194 1205 2005-03-20 Fernando Perez <fperez@colorado.edu>
1195 1206
1196 1207 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1197 1208 for custom exception handling. This is quite powerful, and it
1198 1209 allows for user-installable exception handlers which can trap
1199 1210 custom exceptions at runtime and treat them separately from
1200 1211 IPython's default mechanisms. At the request of Frédéric
1201 1212 Mantegazza <mantegazza-AT-ill.fr>.
1202 1213 (InteractiveShell.set_custom_completer): public API function to
1203 1214 add new completers at runtime.
1204 1215
1205 1216 2005-03-19 Fernando Perez <fperez@colorado.edu>
1206 1217
1207 1218 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1208 1219 allow objects which provide their docstrings via non-standard
1209 1220 mechanisms (like Pyro proxies) to still be inspected by ipython's
1210 1221 ? system.
1211 1222
1212 1223 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1213 1224 automatic capture system. I tried quite hard to make it work
1214 1225 reliably, and simply failed. I tried many combinations with the
1215 1226 subprocess module, but eventually nothing worked in all needed
1216 1227 cases (not blocking stdin for the child, duplicating stdout
1217 1228 without blocking, etc). The new %sc/%sx still do capture to these
1218 1229 magical list/string objects which make shell use much more
1219 1230 conveninent, so not all is lost.
1220 1231
1221 1232 XXX - FIX MANUAL for the change above!
1222 1233
1223 1234 (runsource): I copied code.py's runsource() into ipython to modify
1224 1235 it a bit. Now the code object and source to be executed are
1225 1236 stored in ipython. This makes this info accessible to third-party
1226 1237 tools, like custom exception handlers. After a request by Frédéric
1227 1238 Mantegazza <mantegazza-AT-ill.fr>.
1228 1239
1229 1240 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1230 1241 history-search via readline (like C-p/C-n). I'd wanted this for a
1231 1242 long time, but only recently found out how to do it. For users
1232 1243 who already have their ipythonrc files made and want this, just
1233 1244 add:
1234 1245
1235 1246 readline_parse_and_bind "\e[A": history-search-backward
1236 1247 readline_parse_and_bind "\e[B": history-search-forward
1237 1248
1238 1249 2005-03-18 Fernando Perez <fperez@colorado.edu>
1239 1250
1240 1251 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1241 1252 LSString and SList classes which allow transparent conversions
1242 1253 between list mode and whitespace-separated string.
1243 1254 (magic_r): Fix recursion problem in %r.
1244 1255
1245 1256 * IPython/genutils.py (LSString): New class to be used for
1246 1257 automatic storage of the results of all alias/system calls in _o
1247 1258 and _e (stdout/err). These provide a .l/.list attribute which
1248 1259 does automatic splitting on newlines. This means that for most
1249 1260 uses, you'll never need to do capturing of output with %sc/%sx
1250 1261 anymore, since ipython keeps this always done for you. Note that
1251 1262 only the LAST results are stored, the _o/e variables are
1252 1263 overwritten on each call. If you need to save their contents
1253 1264 further, simply bind them to any other name.
1254 1265
1255 1266 2005-03-17 Fernando Perez <fperez@colorado.edu>
1256 1267
1257 1268 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1258 1269 prompt namespace handling.
1259 1270
1260 1271 2005-03-16 Fernando Perez <fperez@colorado.edu>
1261 1272
1262 1273 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1263 1274 classic prompts to be '>>> ' (final space was missing, and it
1264 1275 trips the emacs python mode).
1265 1276 (BasePrompt.__str__): Added safe support for dynamic prompt
1266 1277 strings. Now you can set your prompt string to be '$x', and the
1267 1278 value of x will be printed from your interactive namespace. The
1268 1279 interpolation syntax includes the full Itpl support, so
1269 1280 ${foo()+x+bar()} is a valid prompt string now, and the function
1270 1281 calls will be made at runtime.
1271 1282
1272 1283 2005-03-15 Fernando Perez <fperez@colorado.edu>
1273 1284
1274 1285 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1275 1286 avoid name clashes in pylab. %hist still works, it just forwards
1276 1287 the call to %history.
1277 1288
1278 1289 2005-03-02 *** Released version 0.6.12
1279 1290
1280 1291 2005-03-02 Fernando Perez <fperez@colorado.edu>
1281 1292
1282 1293 * IPython/iplib.py (handle_magic): log magic calls properly as
1283 1294 ipmagic() function calls.
1284 1295
1285 1296 * IPython/Magic.py (magic_time): Improved %time to support
1286 1297 statements and provide wall-clock as well as CPU time.
1287 1298
1288 1299 2005-02-27 Fernando Perez <fperez@colorado.edu>
1289 1300
1290 1301 * IPython/hooks.py: New hooks module, to expose user-modifiable
1291 1302 IPython functionality in a clean manner. For now only the editor
1292 1303 hook is actually written, and other thigns which I intend to turn
1293 1304 into proper hooks aren't yet there. The display and prefilter
1294 1305 stuff, for example, should be hooks. But at least now the
1295 1306 framework is in place, and the rest can be moved here with more
1296 1307 time later. IPython had had a .hooks variable for a long time for
1297 1308 this purpose, but I'd never actually used it for anything.
1298 1309
1299 1310 2005-02-26 Fernando Perez <fperez@colorado.edu>
1300 1311
1301 1312 * IPython/ipmaker.py (make_IPython): make the default ipython
1302 1313 directory be called _ipython under win32, to follow more the
1303 1314 naming peculiarities of that platform (where buggy software like
1304 1315 Visual Sourcesafe breaks with .named directories). Reported by
1305 1316 Ville Vainio.
1306 1317
1307 1318 2005-02-23 Fernando Perez <fperez@colorado.edu>
1308 1319
1309 1320 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1310 1321 auto_aliases for win32 which were causing problems. Users can
1311 1322 define the ones they personally like.
1312 1323
1313 1324 2005-02-21 Fernando Perez <fperez@colorado.edu>
1314 1325
1315 1326 * IPython/Magic.py (magic_time): new magic to time execution of
1316 1327 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1317 1328
1318 1329 2005-02-19 Fernando Perez <fperez@colorado.edu>
1319 1330
1320 1331 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1321 1332 into keys (for prompts, for example).
1322 1333
1323 1334 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1324 1335 prompts in case users want them. This introduces a small behavior
1325 1336 change: ipython does not automatically add a space to all prompts
1326 1337 anymore. To get the old prompts with a space, users should add it
1327 1338 manually to their ipythonrc file, so for example prompt_in1 should
1328 1339 now read 'In [\#]: ' instead of 'In [\#]:'.
1329 1340 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1330 1341 file) to control left-padding of secondary prompts.
1331 1342
1332 1343 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1333 1344 the profiler can't be imported. Fix for Debian, which removed
1334 1345 profile.py because of License issues. I applied a slightly
1335 1346 modified version of the original Debian patch at
1336 1347 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1337 1348
1338 1349 2005-02-17 Fernando Perez <fperez@colorado.edu>
1339 1350
1340 1351 * IPython/genutils.py (native_line_ends): Fix bug which would
1341 1352 cause improper line-ends under win32 b/c I was not opening files
1342 1353 in binary mode. Bug report and fix thanks to Ville.
1343 1354
1344 1355 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1345 1356 trying to catch spurious foo[1] autocalls. My fix actually broke
1346 1357 ',/' autoquote/call with explicit escape (bad regexp).
1347 1358
1348 1359 2005-02-15 *** Released version 0.6.11
1349 1360
1350 1361 2005-02-14 Fernando Perez <fperez@colorado.edu>
1351 1362
1352 1363 * IPython/background_jobs.py: New background job management
1353 1364 subsystem. This is implemented via a new set of classes, and
1354 1365 IPython now provides a builtin 'jobs' object for background job
1355 1366 execution. A convenience %bg magic serves as a lightweight
1356 1367 frontend for starting the more common type of calls. This was
1357 1368 inspired by discussions with B. Granger and the BackgroundCommand
1358 1369 class described in the book Python Scripting for Computational
1359 1370 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1360 1371 (although ultimately no code from this text was used, as IPython's
1361 1372 system is a separate implementation).
1362 1373
1363 1374 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1364 1375 to control the completion of single/double underscore names
1365 1376 separately. As documented in the example ipytonrc file, the
1366 1377 readline_omit__names variable can now be set to 2, to omit even
1367 1378 single underscore names. Thanks to a patch by Brian Wong
1368 1379 <BrianWong-AT-AirgoNetworks.Com>.
1369 1380 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1370 1381 be autocalled as foo([1]) if foo were callable. A problem for
1371 1382 things which are both callable and implement __getitem__.
1372 1383 (init_readline): Fix autoindentation for win32. Thanks to a patch
1373 1384 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1374 1385
1375 1386 2005-02-12 Fernando Perez <fperez@colorado.edu>
1376 1387
1377 1388 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1378 1389 which I had written long ago to sort out user error messages which
1379 1390 may occur during startup. This seemed like a good idea initially,
1380 1391 but it has proven a disaster in retrospect. I don't want to
1381 1392 change much code for now, so my fix is to set the internal 'debug'
1382 1393 flag to true everywhere, whose only job was precisely to control
1383 1394 this subsystem. This closes issue 28 (as well as avoiding all
1384 1395 sorts of strange hangups which occur from time to time).
1385 1396
1386 1397 2005-02-07 Fernando Perez <fperez@colorado.edu>
1387 1398
1388 1399 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1389 1400 previous call produced a syntax error.
1390 1401
1391 1402 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1392 1403 classes without constructor.
1393 1404
1394 1405 2005-02-06 Fernando Perez <fperez@colorado.edu>
1395 1406
1396 1407 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1397 1408 completions with the results of each matcher, so we return results
1398 1409 to the user from all namespaces. This breaks with ipython
1399 1410 tradition, but I think it's a nicer behavior. Now you get all
1400 1411 possible completions listed, from all possible namespaces (python,
1401 1412 filesystem, magics...) After a request by John Hunter
1402 1413 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1403 1414
1404 1415 2005-02-05 Fernando Perez <fperez@colorado.edu>
1405 1416
1406 1417 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1407 1418 the call had quote characters in it (the quotes were stripped).
1408 1419
1409 1420 2005-01-31 Fernando Perez <fperez@colorado.edu>
1410 1421
1411 1422 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1412 1423 Itpl.itpl() to make the code more robust against psyco
1413 1424 optimizations.
1414 1425
1415 1426 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1416 1427 of causing an exception. Quicker, cleaner.
1417 1428
1418 1429 2005-01-28 Fernando Perez <fperez@colorado.edu>
1419 1430
1420 1431 * scripts/ipython_win_post_install.py (install): hardcode
1421 1432 sys.prefix+'python.exe' as the executable path. It turns out that
1422 1433 during the post-installation run, sys.executable resolves to the
1423 1434 name of the binary installer! I should report this as a distutils
1424 1435 bug, I think. I updated the .10 release with this tiny fix, to
1425 1436 avoid annoying the lists further.
1426 1437
1427 1438 2005-01-27 *** Released version 0.6.10
1428 1439
1429 1440 2005-01-27 Fernando Perez <fperez@colorado.edu>
1430 1441
1431 1442 * IPython/numutils.py (norm): Added 'inf' as optional name for
1432 1443 L-infinity norm, included references to mathworld.com for vector
1433 1444 norm definitions.
1434 1445 (amin/amax): added amin/amax for array min/max. Similar to what
1435 1446 pylab ships with after the recent reorganization of names.
1436 1447 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1437 1448
1438 1449 * ipython.el: committed Alex's recent fixes and improvements.
1439 1450 Tested with python-mode from CVS, and it looks excellent. Since
1440 1451 python-mode hasn't released anything in a while, I'm temporarily
1441 1452 putting a copy of today's CVS (v 4.70) of python-mode in:
1442 1453 http://ipython.scipy.org/tmp/python-mode.el
1443 1454
1444 1455 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1445 1456 sys.executable for the executable name, instead of assuming it's
1446 1457 called 'python.exe' (the post-installer would have produced broken
1447 1458 setups on systems with a differently named python binary).
1448 1459
1449 1460 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1450 1461 references to os.linesep, to make the code more
1451 1462 platform-independent. This is also part of the win32 coloring
1452 1463 fixes.
1453 1464
1454 1465 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1455 1466 lines, which actually cause coloring bugs because the length of
1456 1467 the line is very difficult to correctly compute with embedded
1457 1468 escapes. This was the source of all the coloring problems under
1458 1469 Win32. I think that _finally_, Win32 users have a properly
1459 1470 working ipython in all respects. This would never have happened
1460 1471 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1461 1472
1462 1473 2005-01-26 *** Released version 0.6.9
1463 1474
1464 1475 2005-01-25 Fernando Perez <fperez@colorado.edu>
1465 1476
1466 1477 * setup.py: finally, we have a true Windows installer, thanks to
1467 1478 the excellent work of Viktor Ransmayr
1468 1479 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1469 1480 Windows users. The setup routine is quite a bit cleaner thanks to
1470 1481 this, and the post-install script uses the proper functions to
1471 1482 allow a clean de-installation using the standard Windows Control
1472 1483 Panel.
1473 1484
1474 1485 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1475 1486 environment variable under all OSes (including win32) if
1476 1487 available. This will give consistency to win32 users who have set
1477 1488 this variable for any reason. If os.environ['HOME'] fails, the
1478 1489 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1479 1490
1480 1491 2005-01-24 Fernando Perez <fperez@colorado.edu>
1481 1492
1482 1493 * IPython/numutils.py (empty_like): add empty_like(), similar to
1483 1494 zeros_like() but taking advantage of the new empty() Numeric routine.
1484 1495
1485 1496 2005-01-23 *** Released version 0.6.8
1486 1497
1487 1498 2005-01-22 Fernando Perez <fperez@colorado.edu>
1488 1499
1489 1500 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1490 1501 automatic show() calls. After discussing things with JDH, it
1491 1502 turns out there are too many corner cases where this can go wrong.
1492 1503 It's best not to try to be 'too smart', and simply have ipython
1493 1504 reproduce as much as possible the default behavior of a normal
1494 1505 python shell.
1495 1506
1496 1507 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1497 1508 line-splitting regexp and _prefilter() to avoid calling getattr()
1498 1509 on assignments. This closes
1499 1510 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1500 1511 readline uses getattr(), so a simple <TAB> keypress is still
1501 1512 enough to trigger getattr() calls on an object.
1502 1513
1503 1514 2005-01-21 Fernando Perez <fperez@colorado.edu>
1504 1515
1505 1516 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1506 1517 docstring under pylab so it doesn't mask the original.
1507 1518
1508 1519 2005-01-21 *** Released version 0.6.7
1509 1520
1510 1521 2005-01-21 Fernando Perez <fperez@colorado.edu>
1511 1522
1512 1523 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1513 1524 signal handling for win32 users in multithreaded mode.
1514 1525
1515 1526 2005-01-17 Fernando Perez <fperez@colorado.edu>
1516 1527
1517 1528 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1518 1529 instances with no __init__. After a crash report by Norbert Nemec
1519 1530 <Norbert-AT-nemec-online.de>.
1520 1531
1521 1532 2005-01-14 Fernando Perez <fperez@colorado.edu>
1522 1533
1523 1534 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1524 1535 names for verbose exceptions, when multiple dotted names and the
1525 1536 'parent' object were present on the same line.
1526 1537
1527 1538 2005-01-11 Fernando Perez <fperez@colorado.edu>
1528 1539
1529 1540 * IPython/genutils.py (flag_calls): new utility to trap and flag
1530 1541 calls in functions. I need it to clean up matplotlib support.
1531 1542 Also removed some deprecated code in genutils.
1532 1543
1533 1544 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1534 1545 that matplotlib scripts called with %run, which don't call show()
1535 1546 themselves, still have their plotting windows open.
1536 1547
1537 1548 2005-01-05 Fernando Perez <fperez@colorado.edu>
1538 1549
1539 1550 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1540 1551 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1541 1552
1542 1553 2004-12-19 Fernando Perez <fperez@colorado.edu>
1543 1554
1544 1555 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1545 1556 parent_runcode, which was an eyesore. The same result can be
1546 1557 obtained with Python's regular superclass mechanisms.
1547 1558
1548 1559 2004-12-17 Fernando Perez <fperez@colorado.edu>
1549 1560
1550 1561 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1551 1562 reported by Prabhu.
1552 1563 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1553 1564 sys.stderr) instead of explicitly calling sys.stderr. This helps
1554 1565 maintain our I/O abstractions clean, for future GUI embeddings.
1555 1566
1556 1567 * IPython/genutils.py (info): added new utility for sys.stderr
1557 1568 unified info message handling (thin wrapper around warn()).
1558 1569
1559 1570 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1560 1571 composite (dotted) names on verbose exceptions.
1561 1572 (VerboseTB.nullrepr): harden against another kind of errors which
1562 1573 Python's inspect module can trigger, and which were crashing
1563 1574 IPython. Thanks to a report by Marco Lombardi
1564 1575 <mlombard-AT-ma010192.hq.eso.org>.
1565 1576
1566 1577 2004-12-13 *** Released version 0.6.6
1567 1578
1568 1579 2004-12-12 Fernando Perez <fperez@colorado.edu>
1569 1580
1570 1581 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1571 1582 generated by pygtk upon initialization if it was built without
1572 1583 threads (for matplotlib users). After a crash reported by
1573 1584 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1574 1585
1575 1586 * IPython/ipmaker.py (make_IPython): fix small bug in the
1576 1587 import_some parameter for multiple imports.
1577 1588
1578 1589 * IPython/iplib.py (ipmagic): simplified the interface of
1579 1590 ipmagic() to take a single string argument, just as it would be
1580 1591 typed at the IPython cmd line.
1581 1592 (ipalias): Added new ipalias() with an interface identical to
1582 1593 ipmagic(). This completes exposing a pure python interface to the
1583 1594 alias and magic system, which can be used in loops or more complex
1584 1595 code where IPython's automatic line mangling is not active.
1585 1596
1586 1597 * IPython/genutils.py (timing): changed interface of timing to
1587 1598 simply run code once, which is the most common case. timings()
1588 1599 remains unchanged, for the cases where you want multiple runs.
1589 1600
1590 1601 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1591 1602 bug where Python2.2 crashes with exec'ing code which does not end
1592 1603 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1593 1604 before.
1594 1605
1595 1606 2004-12-10 Fernando Perez <fperez@colorado.edu>
1596 1607
1597 1608 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1598 1609 -t to -T, to accomodate the new -t flag in %run (the %run and
1599 1610 %prun options are kind of intermixed, and it's not easy to change
1600 1611 this with the limitations of python's getopt).
1601 1612
1602 1613 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1603 1614 the execution of scripts. It's not as fine-tuned as timeit.py,
1604 1615 but it works from inside ipython (and under 2.2, which lacks
1605 1616 timeit.py). Optionally a number of runs > 1 can be given for
1606 1617 timing very short-running code.
1607 1618
1608 1619 * IPython/genutils.py (uniq_stable): new routine which returns a
1609 1620 list of unique elements in any iterable, but in stable order of
1610 1621 appearance. I needed this for the ultraTB fixes, and it's a handy
1611 1622 utility.
1612 1623
1613 1624 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1614 1625 dotted names in Verbose exceptions. This had been broken since
1615 1626 the very start, now x.y will properly be printed in a Verbose
1616 1627 traceback, instead of x being shown and y appearing always as an
1617 1628 'undefined global'. Getting this to work was a bit tricky,
1618 1629 because by default python tokenizers are stateless. Saved by
1619 1630 python's ability to easily add a bit of state to an arbitrary
1620 1631 function (without needing to build a full-blown callable object).
1621 1632
1622 1633 Also big cleanup of this code, which had horrendous runtime
1623 1634 lookups of zillions of attributes for colorization. Moved all
1624 1635 this code into a few templates, which make it cleaner and quicker.
1625 1636
1626 1637 Printout quality was also improved for Verbose exceptions: one
1627 1638 variable per line, and memory addresses are printed (this can be
1628 1639 quite handy in nasty debugging situations, which is what Verbose
1629 1640 is for).
1630 1641
1631 1642 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1632 1643 the command line as scripts to be loaded by embedded instances.
1633 1644 Doing so has the potential for an infinite recursion if there are
1634 1645 exceptions thrown in the process. This fixes a strange crash
1635 1646 reported by Philippe MULLER <muller-AT-irit.fr>.
1636 1647
1637 1648 2004-12-09 Fernando Perez <fperez@colorado.edu>
1638 1649
1639 1650 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1640 1651 to reflect new names in matplotlib, which now expose the
1641 1652 matlab-compatible interface via a pylab module instead of the
1642 1653 'matlab' name. The new code is backwards compatible, so users of
1643 1654 all matplotlib versions are OK. Patch by J. Hunter.
1644 1655
1645 1656 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1646 1657 of __init__ docstrings for instances (class docstrings are already
1647 1658 automatically printed). Instances with customized docstrings
1648 1659 (indep. of the class) are also recognized and all 3 separate
1649 1660 docstrings are printed (instance, class, constructor). After some
1650 1661 comments/suggestions by J. Hunter.
1651 1662
1652 1663 2004-12-05 Fernando Perez <fperez@colorado.edu>
1653 1664
1654 1665 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1655 1666 warnings when tab-completion fails and triggers an exception.
1656 1667
1657 1668 2004-12-03 Fernando Perez <fperez@colorado.edu>
1658 1669
1659 1670 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1660 1671 be triggered when using 'run -p'. An incorrect option flag was
1661 1672 being set ('d' instead of 'D').
1662 1673 (manpage): fix missing escaped \- sign.
1663 1674
1664 1675 2004-11-30 *** Released version 0.6.5
1665 1676
1666 1677 2004-11-30 Fernando Perez <fperez@colorado.edu>
1667 1678
1668 1679 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1669 1680 setting with -d option.
1670 1681
1671 1682 * setup.py (docfiles): Fix problem where the doc glob I was using
1672 1683 was COMPLETELY BROKEN. It was giving the right files by pure
1673 1684 accident, but failed once I tried to include ipython.el. Note:
1674 1685 glob() does NOT allow you to do exclusion on multiple endings!
1675 1686
1676 1687 2004-11-29 Fernando Perez <fperez@colorado.edu>
1677 1688
1678 1689 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1679 1690 the manpage as the source. Better formatting & consistency.
1680 1691
1681 1692 * IPython/Magic.py (magic_run): Added new -d option, to run
1682 1693 scripts under the control of the python pdb debugger. Note that
1683 1694 this required changing the %prun option -d to -D, to avoid a clash
1684 1695 (since %run must pass options to %prun, and getopt is too dumb to
1685 1696 handle options with string values with embedded spaces). Thanks
1686 1697 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1687 1698 (magic_who_ls): added type matching to %who and %whos, so that one
1688 1699 can filter their output to only include variables of certain
1689 1700 types. Another suggestion by Matthew.
1690 1701 (magic_whos): Added memory summaries in kb and Mb for arrays.
1691 1702 (magic_who): Improve formatting (break lines every 9 vars).
1692 1703
1693 1704 2004-11-28 Fernando Perez <fperez@colorado.edu>
1694 1705
1695 1706 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1696 1707 cache when empty lines were present.
1697 1708
1698 1709 2004-11-24 Fernando Perez <fperez@colorado.edu>
1699 1710
1700 1711 * IPython/usage.py (__doc__): document the re-activated threading
1701 1712 options for WX and GTK.
1702 1713
1703 1714 2004-11-23 Fernando Perez <fperez@colorado.edu>
1704 1715
1705 1716 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1706 1717 the -wthread and -gthread options, along with a new -tk one to try
1707 1718 and coordinate Tk threading with wx/gtk. The tk support is very
1708 1719 platform dependent, since it seems to require Tcl and Tk to be
1709 1720 built with threads (Fedora1/2 appears NOT to have it, but in
1710 1721 Prabhu's Debian boxes it works OK). But even with some Tk
1711 1722 limitations, this is a great improvement.
1712 1723
1713 1724 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1714 1725 info in user prompts. Patch by Prabhu.
1715 1726
1716 1727 2004-11-18 Fernando Perez <fperez@colorado.edu>
1717 1728
1718 1729 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1719 1730 EOFErrors and bail, to avoid infinite loops if a non-terminating
1720 1731 file is fed into ipython. Patch submitted in issue 19 by user,
1721 1732 many thanks.
1722 1733
1723 1734 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1724 1735 autoquote/parens in continuation prompts, which can cause lots of
1725 1736 problems. Closes roundup issue 20.
1726 1737
1727 1738 2004-11-17 Fernando Perez <fperez@colorado.edu>
1728 1739
1729 1740 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1730 1741 reported as debian bug #280505. I'm not sure my local changelog
1731 1742 entry has the proper debian format (Jack?).
1732 1743
1733 1744 2004-11-08 *** Released version 0.6.4
1734 1745
1735 1746 2004-11-08 Fernando Perez <fperez@colorado.edu>
1736 1747
1737 1748 * IPython/iplib.py (init_readline): Fix exit message for Windows
1738 1749 when readline is active. Thanks to a report by Eric Jones
1739 1750 <eric-AT-enthought.com>.
1740 1751
1741 1752 2004-11-07 Fernando Perez <fperez@colorado.edu>
1742 1753
1743 1754 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1744 1755 sometimes seen by win2k/cygwin users.
1745 1756
1746 1757 2004-11-06 Fernando Perez <fperez@colorado.edu>
1747 1758
1748 1759 * IPython/iplib.py (interact): Change the handling of %Exit from
1749 1760 trying to propagate a SystemExit to an internal ipython flag.
1750 1761 This is less elegant than using Python's exception mechanism, but
1751 1762 I can't get that to work reliably with threads, so under -pylab
1752 1763 %Exit was hanging IPython. Cross-thread exception handling is
1753 1764 really a bitch. Thaks to a bug report by Stephen Walton
1754 1765 <stephen.walton-AT-csun.edu>.
1755 1766
1756 1767 2004-11-04 Fernando Perez <fperez@colorado.edu>
1757 1768
1758 1769 * IPython/iplib.py (raw_input_original): store a pointer to the
1759 1770 true raw_input to harden against code which can modify it
1760 1771 (wx.py.PyShell does this and would otherwise crash ipython).
1761 1772 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1762 1773
1763 1774 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1764 1775 Ctrl-C problem, which does not mess up the input line.
1765 1776
1766 1777 2004-11-03 Fernando Perez <fperez@colorado.edu>
1767 1778
1768 1779 * IPython/Release.py: Changed licensing to BSD, in all files.
1769 1780 (name): lowercase name for tarball/RPM release.
1770 1781
1771 1782 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1772 1783 use throughout ipython.
1773 1784
1774 1785 * IPython/Magic.py (Magic._ofind): Switch to using the new
1775 1786 OInspect.getdoc() function.
1776 1787
1777 1788 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1778 1789 of the line currently being canceled via Ctrl-C. It's extremely
1779 1790 ugly, but I don't know how to do it better (the problem is one of
1780 1791 handling cross-thread exceptions).
1781 1792
1782 1793 2004-10-28 Fernando Perez <fperez@colorado.edu>
1783 1794
1784 1795 * IPython/Shell.py (signal_handler): add signal handlers to trap
1785 1796 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1786 1797 report by Francesc Alted.
1787 1798
1788 1799 2004-10-21 Fernando Perez <fperez@colorado.edu>
1789 1800
1790 1801 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1791 1802 to % for pysh syntax extensions.
1792 1803
1793 1804 2004-10-09 Fernando Perez <fperez@colorado.edu>
1794 1805
1795 1806 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1796 1807 arrays to print a more useful summary, without calling str(arr).
1797 1808 This avoids the problem of extremely lengthy computations which
1798 1809 occur if arr is large, and appear to the user as a system lockup
1799 1810 with 100% cpu activity. After a suggestion by Kristian Sandberg
1800 1811 <Kristian.Sandberg@colorado.edu>.
1801 1812 (Magic.__init__): fix bug in global magic escapes not being
1802 1813 correctly set.
1803 1814
1804 1815 2004-10-08 Fernando Perez <fperez@colorado.edu>
1805 1816
1806 1817 * IPython/Magic.py (__license__): change to absolute imports of
1807 1818 ipython's own internal packages, to start adapting to the absolute
1808 1819 import requirement of PEP-328.
1809 1820
1810 1821 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1811 1822 files, and standardize author/license marks through the Release
1812 1823 module instead of having per/file stuff (except for files with
1813 1824 particular licenses, like the MIT/PSF-licensed codes).
1814 1825
1815 1826 * IPython/Debugger.py: remove dead code for python 2.1
1816 1827
1817 1828 2004-10-04 Fernando Perez <fperez@colorado.edu>
1818 1829
1819 1830 * IPython/iplib.py (ipmagic): New function for accessing magics
1820 1831 via a normal python function call.
1821 1832
1822 1833 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1823 1834 from '@' to '%', to accomodate the new @decorator syntax of python
1824 1835 2.4.
1825 1836
1826 1837 2004-09-29 Fernando Perez <fperez@colorado.edu>
1827 1838
1828 1839 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1829 1840 matplotlib.use to prevent running scripts which try to switch
1830 1841 interactive backends from within ipython. This will just crash
1831 1842 the python interpreter, so we can't allow it (but a detailed error
1832 1843 is given to the user).
1833 1844
1834 1845 2004-09-28 Fernando Perez <fperez@colorado.edu>
1835 1846
1836 1847 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1837 1848 matplotlib-related fixes so that using @run with non-matplotlib
1838 1849 scripts doesn't pop up spurious plot windows. This requires
1839 1850 matplotlib >= 0.63, where I had to make some changes as well.
1840 1851
1841 1852 * IPython/ipmaker.py (make_IPython): update version requirement to
1842 1853 python 2.2.
1843 1854
1844 1855 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1845 1856 banner arg for embedded customization.
1846 1857
1847 1858 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1848 1859 explicit uses of __IP as the IPython's instance name. Now things
1849 1860 are properly handled via the shell.name value. The actual code
1850 1861 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1851 1862 is much better than before. I'll clean things completely when the
1852 1863 magic stuff gets a real overhaul.
1853 1864
1854 1865 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1855 1866 minor changes to debian dir.
1856 1867
1857 1868 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1858 1869 pointer to the shell itself in the interactive namespace even when
1859 1870 a user-supplied dict is provided. This is needed for embedding
1860 1871 purposes (found by tests with Michel Sanner).
1861 1872
1862 1873 2004-09-27 Fernando Perez <fperez@colorado.edu>
1863 1874
1864 1875 * IPython/UserConfig/ipythonrc: remove []{} from
1865 1876 readline_remove_delims, so that things like [modname.<TAB> do
1866 1877 proper completion. This disables [].TAB, but that's a less common
1867 1878 case than module names in list comprehensions, for example.
1868 1879 Thanks to a report by Andrea Riciputi.
1869 1880
1870 1881 2004-09-09 Fernando Perez <fperez@colorado.edu>
1871 1882
1872 1883 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1873 1884 blocking problems in win32 and osx. Fix by John.
1874 1885
1875 1886 2004-09-08 Fernando Perez <fperez@colorado.edu>
1876 1887
1877 1888 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1878 1889 for Win32 and OSX. Fix by John Hunter.
1879 1890
1880 1891 2004-08-30 *** Released version 0.6.3
1881 1892
1882 1893 2004-08-30 Fernando Perez <fperez@colorado.edu>
1883 1894
1884 1895 * setup.py (isfile): Add manpages to list of dependent files to be
1885 1896 updated.
1886 1897
1887 1898 2004-08-27 Fernando Perez <fperez@colorado.edu>
1888 1899
1889 1900 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1890 1901 for now. They don't really work with standalone WX/GTK code
1891 1902 (though matplotlib IS working fine with both of those backends).
1892 1903 This will neeed much more testing. I disabled most things with
1893 1904 comments, so turning it back on later should be pretty easy.
1894 1905
1895 1906 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1896 1907 autocalling of expressions like r'foo', by modifying the line
1897 1908 split regexp. Closes
1898 1909 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1899 1910 Riley <ipythonbugs-AT-sabi.net>.
1900 1911 (InteractiveShell.mainloop): honor --nobanner with banner
1901 1912 extensions.
1902 1913
1903 1914 * IPython/Shell.py: Significant refactoring of all classes, so
1904 1915 that we can really support ALL matplotlib backends and threading
1905 1916 models (John spotted a bug with Tk which required this). Now we
1906 1917 should support single-threaded, WX-threads and GTK-threads, both
1907 1918 for generic code and for matplotlib.
1908 1919
1909 1920 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1910 1921 -pylab, to simplify things for users. Will also remove the pylab
1911 1922 profile, since now all of matplotlib configuration is directly
1912 1923 handled here. This also reduces startup time.
1913 1924
1914 1925 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1915 1926 shell wasn't being correctly called. Also in IPShellWX.
1916 1927
1917 1928 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1918 1929 fine-tune banner.
1919 1930
1920 1931 * IPython/numutils.py (spike): Deprecate these spike functions,
1921 1932 delete (long deprecated) gnuplot_exec handler.
1922 1933
1923 1934 2004-08-26 Fernando Perez <fperez@colorado.edu>
1924 1935
1925 1936 * ipython.1: Update for threading options, plus some others which
1926 1937 were missing.
1927 1938
1928 1939 * IPython/ipmaker.py (__call__): Added -wthread option for
1929 1940 wxpython thread handling. Make sure threading options are only
1930 1941 valid at the command line.
1931 1942
1932 1943 * scripts/ipython: moved shell selection into a factory function
1933 1944 in Shell.py, to keep the starter script to a minimum.
1934 1945
1935 1946 2004-08-25 Fernando Perez <fperez@colorado.edu>
1936 1947
1937 1948 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1938 1949 John. Along with some recent changes he made to matplotlib, the
1939 1950 next versions of both systems should work very well together.
1940 1951
1941 1952 2004-08-24 Fernando Perez <fperez@colorado.edu>
1942 1953
1943 1954 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1944 1955 tried to switch the profiling to using hotshot, but I'm getting
1945 1956 strange errors from prof.runctx() there. I may be misreading the
1946 1957 docs, but it looks weird. For now the profiling code will
1947 1958 continue to use the standard profiler.
1948 1959
1949 1960 2004-08-23 Fernando Perez <fperez@colorado.edu>
1950 1961
1951 1962 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1952 1963 threaded shell, by John Hunter. It's not quite ready yet, but
1953 1964 close.
1954 1965
1955 1966 2004-08-22 Fernando Perez <fperez@colorado.edu>
1956 1967
1957 1968 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1958 1969 in Magic and ultraTB.
1959 1970
1960 1971 * ipython.1: document threading options in manpage.
1961 1972
1962 1973 * scripts/ipython: Changed name of -thread option to -gthread,
1963 1974 since this is GTK specific. I want to leave the door open for a
1964 1975 -wthread option for WX, which will most likely be necessary. This
1965 1976 change affects usage and ipmaker as well.
1966 1977
1967 1978 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1968 1979 handle the matplotlib shell issues. Code by John Hunter
1969 1980 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1970 1981 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1971 1982 broken (and disabled for end users) for now, but it puts the
1972 1983 infrastructure in place.
1973 1984
1974 1985 2004-08-21 Fernando Perez <fperez@colorado.edu>
1975 1986
1976 1987 * ipythonrc-pylab: Add matplotlib support.
1977 1988
1978 1989 * matplotlib_config.py: new files for matplotlib support, part of
1979 1990 the pylab profile.
1980 1991
1981 1992 * IPython/usage.py (__doc__): documented the threading options.
1982 1993
1983 1994 2004-08-20 Fernando Perez <fperez@colorado.edu>
1984 1995
1985 1996 * ipython: Modified the main calling routine to handle the -thread
1986 1997 and -mpthread options. This needs to be done as a top-level hack,
1987 1998 because it determines which class to instantiate for IPython
1988 1999 itself.
1989 2000
1990 2001 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1991 2002 classes to support multithreaded GTK operation without blocking,
1992 2003 and matplotlib with all backends. This is a lot of still very
1993 2004 experimental code, and threads are tricky. So it may still have a
1994 2005 few rough edges... This code owes a lot to
1995 2006 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1996 2007 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1997 2008 to John Hunter for all the matplotlib work.
1998 2009
1999 2010 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2000 2011 options for gtk thread and matplotlib support.
2001 2012
2002 2013 2004-08-16 Fernando Perez <fperez@colorado.edu>
2003 2014
2004 2015 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2005 2016 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2006 2017 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2007 2018
2008 2019 2004-08-11 Fernando Perez <fperez@colorado.edu>
2009 2020
2010 2021 * setup.py (isfile): Fix build so documentation gets updated for
2011 2022 rpms (it was only done for .tgz builds).
2012 2023
2013 2024 2004-08-10 Fernando Perez <fperez@colorado.edu>
2014 2025
2015 2026 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2016 2027
2017 2028 * iplib.py : Silence syntax error exceptions in tab-completion.
2018 2029
2019 2030 2004-08-05 Fernando Perez <fperez@colorado.edu>
2020 2031
2021 2032 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2022 2033 'color off' mark for continuation prompts. This was causing long
2023 2034 continuation lines to mis-wrap.
2024 2035
2025 2036 2004-08-01 Fernando Perez <fperez@colorado.edu>
2026 2037
2027 2038 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2028 2039 for building ipython to be a parameter. All this is necessary
2029 2040 right now to have a multithreaded version, but this insane
2030 2041 non-design will be cleaned up soon. For now, it's a hack that
2031 2042 works.
2032 2043
2033 2044 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2034 2045 args in various places. No bugs so far, but it's a dangerous
2035 2046 practice.
2036 2047
2037 2048 2004-07-31 Fernando Perez <fperez@colorado.edu>
2038 2049
2039 2050 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2040 2051 fix completion of files with dots in their names under most
2041 2052 profiles (pysh was OK because the completion order is different).
2042 2053
2043 2054 2004-07-27 Fernando Perez <fperez@colorado.edu>
2044 2055
2045 2056 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2046 2057 keywords manually, b/c the one in keyword.py was removed in python
2047 2058 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2048 2059 This is NOT a bug under python 2.3 and earlier.
2049 2060
2050 2061 2004-07-26 Fernando Perez <fperez@colorado.edu>
2051 2062
2052 2063 * IPython/ultraTB.py (VerboseTB.text): Add another
2053 2064 linecache.checkcache() call to try to prevent inspect.py from
2054 2065 crashing under python 2.3. I think this fixes
2055 2066 http://www.scipy.net/roundup/ipython/issue17.
2056 2067
2057 2068 2004-07-26 *** Released version 0.6.2
2058 2069
2059 2070 2004-07-26 Fernando Perez <fperez@colorado.edu>
2060 2071
2061 2072 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2062 2073 fail for any number.
2063 2074 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2064 2075 empty bookmarks.
2065 2076
2066 2077 2004-07-26 *** Released version 0.6.1
2067 2078
2068 2079 2004-07-26 Fernando Perez <fperez@colorado.edu>
2069 2080
2070 2081 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2071 2082
2072 2083 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2073 2084 escaping '()[]{}' in filenames.
2074 2085
2075 2086 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2076 2087 Python 2.2 users who lack a proper shlex.split.
2077 2088
2078 2089 2004-07-19 Fernando Perez <fperez@colorado.edu>
2079 2090
2080 2091 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2081 2092 for reading readline's init file. I follow the normal chain:
2082 2093 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2083 2094 report by Mike Heeter. This closes
2084 2095 http://www.scipy.net/roundup/ipython/issue16.
2085 2096
2086 2097 2004-07-18 Fernando Perez <fperez@colorado.edu>
2087 2098
2088 2099 * IPython/iplib.py (__init__): Add better handling of '\' under
2089 2100 Win32 for filenames. After a patch by Ville.
2090 2101
2091 2102 2004-07-17 Fernando Perez <fperez@colorado.edu>
2092 2103
2093 2104 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2094 2105 autocalling would be triggered for 'foo is bar' if foo is
2095 2106 callable. I also cleaned up the autocall detection code to use a
2096 2107 regexp, which is faster. Bug reported by Alexander Schmolck.
2097 2108
2098 2109 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2099 2110 '?' in them would confuse the help system. Reported by Alex
2100 2111 Schmolck.
2101 2112
2102 2113 2004-07-16 Fernando Perez <fperez@colorado.edu>
2103 2114
2104 2115 * IPython/GnuplotInteractive.py (__all__): added plot2.
2105 2116
2106 2117 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2107 2118 plotting dictionaries, lists or tuples of 1d arrays.
2108 2119
2109 2120 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2110 2121 optimizations.
2111 2122
2112 2123 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2113 2124 the information which was there from Janko's original IPP code:
2114 2125
2115 2126 03.05.99 20:53 porto.ifm.uni-kiel.de
2116 2127 --Started changelog.
2117 2128 --make clear do what it say it does
2118 2129 --added pretty output of lines from inputcache
2119 2130 --Made Logger a mixin class, simplifies handling of switches
2120 2131 --Added own completer class. .string<TAB> expands to last history
2121 2132 line which starts with string. The new expansion is also present
2122 2133 with Ctrl-r from the readline library. But this shows, who this
2123 2134 can be done for other cases.
2124 2135 --Added convention that all shell functions should accept a
2125 2136 parameter_string This opens the door for different behaviour for
2126 2137 each function. @cd is a good example of this.
2127 2138
2128 2139 04.05.99 12:12 porto.ifm.uni-kiel.de
2129 2140 --added logfile rotation
2130 2141 --added new mainloop method which freezes first the namespace
2131 2142
2132 2143 07.05.99 21:24 porto.ifm.uni-kiel.de
2133 2144 --added the docreader classes. Now there is a help system.
2134 2145 -This is only a first try. Currently it's not easy to put new
2135 2146 stuff in the indices. But this is the way to go. Info would be
2136 2147 better, but HTML is every where and not everybody has an info
2137 2148 system installed and it's not so easy to change html-docs to info.
2138 2149 --added global logfile option
2139 2150 --there is now a hook for object inspection method pinfo needs to
2140 2151 be provided for this. Can be reached by two '??'.
2141 2152
2142 2153 08.05.99 20:51 porto.ifm.uni-kiel.de
2143 2154 --added a README
2144 2155 --bug in rc file. Something has changed so functions in the rc
2145 2156 file need to reference the shell and not self. Not clear if it's a
2146 2157 bug or feature.
2147 2158 --changed rc file for new behavior
2148 2159
2149 2160 2004-07-15 Fernando Perez <fperez@colorado.edu>
2150 2161
2151 2162 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2152 2163 cache was falling out of sync in bizarre manners when multi-line
2153 2164 input was present. Minor optimizations and cleanup.
2154 2165
2155 2166 (Logger): Remove old Changelog info for cleanup. This is the
2156 2167 information which was there from Janko's original code:
2157 2168
2158 2169 Changes to Logger: - made the default log filename a parameter
2159 2170
2160 2171 - put a check for lines beginning with !@? in log(). Needed
2161 2172 (even if the handlers properly log their lines) for mid-session
2162 2173 logging activation to work properly. Without this, lines logged
2163 2174 in mid session, which get read from the cache, would end up
2164 2175 'bare' (with !@? in the open) in the log. Now they are caught
2165 2176 and prepended with a #.
2166 2177
2167 2178 * IPython/iplib.py (InteractiveShell.init_readline): added check
2168 2179 in case MagicCompleter fails to be defined, so we don't crash.
2169 2180
2170 2181 2004-07-13 Fernando Perez <fperez@colorado.edu>
2171 2182
2172 2183 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2173 2184 of EPS if the requested filename ends in '.eps'.
2174 2185
2175 2186 2004-07-04 Fernando Perez <fperez@colorado.edu>
2176 2187
2177 2188 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2178 2189 escaping of quotes when calling the shell.
2179 2190
2180 2191 2004-07-02 Fernando Perez <fperez@colorado.edu>
2181 2192
2182 2193 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2183 2194 gettext not working because we were clobbering '_'. Fixes
2184 2195 http://www.scipy.net/roundup/ipython/issue6.
2185 2196
2186 2197 2004-07-01 Fernando Perez <fperez@colorado.edu>
2187 2198
2188 2199 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2189 2200 into @cd. Patch by Ville.
2190 2201
2191 2202 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2192 2203 new function to store things after ipmaker runs. Patch by Ville.
2193 2204 Eventually this will go away once ipmaker is removed and the class
2194 2205 gets cleaned up, but for now it's ok. Key functionality here is
2195 2206 the addition of the persistent storage mechanism, a dict for
2196 2207 keeping data across sessions (for now just bookmarks, but more can
2197 2208 be implemented later).
2198 2209
2199 2210 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2200 2211 persistent across sections. Patch by Ville, I modified it
2201 2212 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2202 2213 added a '-l' option to list all bookmarks.
2203 2214
2204 2215 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2205 2216 center for cleanup. Registered with atexit.register(). I moved
2206 2217 here the old exit_cleanup(). After a patch by Ville.
2207 2218
2208 2219 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2209 2220 characters in the hacked shlex_split for python 2.2.
2210 2221
2211 2222 * IPython/iplib.py (file_matches): more fixes to filenames with
2212 2223 whitespace in them. It's not perfect, but limitations in python's
2213 2224 readline make it impossible to go further.
2214 2225
2215 2226 2004-06-29 Fernando Perez <fperez@colorado.edu>
2216 2227
2217 2228 * IPython/iplib.py (file_matches): escape whitespace correctly in
2218 2229 filename completions. Bug reported by Ville.
2219 2230
2220 2231 2004-06-28 Fernando Perez <fperez@colorado.edu>
2221 2232
2222 2233 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2223 2234 the history file will be called 'history-PROFNAME' (or just
2224 2235 'history' if no profile is loaded). I was getting annoyed at
2225 2236 getting my Numerical work history clobbered by pysh sessions.
2226 2237
2227 2238 * IPython/iplib.py (InteractiveShell.__init__): Internal
2228 2239 getoutputerror() function so that we can honor the system_verbose
2229 2240 flag for _all_ system calls. I also added escaping of #
2230 2241 characters here to avoid confusing Itpl.
2231 2242
2232 2243 * IPython/Magic.py (shlex_split): removed call to shell in
2233 2244 parse_options and replaced it with shlex.split(). The annoying
2234 2245 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2235 2246 to backport it from 2.3, with several frail hacks (the shlex
2236 2247 module is rather limited in 2.2). Thanks to a suggestion by Ville
2237 2248 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2238 2249 problem.
2239 2250
2240 2251 (Magic.magic_system_verbose): new toggle to print the actual
2241 2252 system calls made by ipython. Mainly for debugging purposes.
2242 2253
2243 2254 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2244 2255 doesn't support persistence. Reported (and fix suggested) by
2245 2256 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2246 2257
2247 2258 2004-06-26 Fernando Perez <fperez@colorado.edu>
2248 2259
2249 2260 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2250 2261 continue prompts.
2251 2262
2252 2263 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2253 2264 function (basically a big docstring) and a few more things here to
2254 2265 speedup startup. pysh.py is now very lightweight. We want because
2255 2266 it gets execfile'd, while InterpreterExec gets imported, so
2256 2267 byte-compilation saves time.
2257 2268
2258 2269 2004-06-25 Fernando Perez <fperez@colorado.edu>
2259 2270
2260 2271 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2261 2272 -NUM', which was recently broken.
2262 2273
2263 2274 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2264 2275 in multi-line input (but not !!, which doesn't make sense there).
2265 2276
2266 2277 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2267 2278 It's just too useful, and people can turn it off in the less
2268 2279 common cases where it's a problem.
2269 2280
2270 2281 2004-06-24 Fernando Perez <fperez@colorado.edu>
2271 2282
2272 2283 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2273 2284 special syntaxes (like alias calling) is now allied in multi-line
2274 2285 input. This is still _very_ experimental, but it's necessary for
2275 2286 efficient shell usage combining python looping syntax with system
2276 2287 calls. For now it's restricted to aliases, I don't think it
2277 2288 really even makes sense to have this for magics.
2278 2289
2279 2290 2004-06-23 Fernando Perez <fperez@colorado.edu>
2280 2291
2281 2292 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2282 2293 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2283 2294
2284 2295 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2285 2296 extensions under Windows (after code sent by Gary Bishop). The
2286 2297 extensions considered 'executable' are stored in IPython's rc
2287 2298 structure as win_exec_ext.
2288 2299
2289 2300 * IPython/genutils.py (shell): new function, like system() but
2290 2301 without return value. Very useful for interactive shell work.
2291 2302
2292 2303 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2293 2304 delete aliases.
2294 2305
2295 2306 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2296 2307 sure that the alias table doesn't contain python keywords.
2297 2308
2298 2309 2004-06-21 Fernando Perez <fperez@colorado.edu>
2299 2310
2300 2311 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2301 2312 non-existent items are found in $PATH. Reported by Thorsten.
2302 2313
2303 2314 2004-06-20 Fernando Perez <fperez@colorado.edu>
2304 2315
2305 2316 * IPython/iplib.py (complete): modified the completer so that the
2306 2317 order of priorities can be easily changed at runtime.
2307 2318
2308 2319 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2309 2320 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2310 2321
2311 2322 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2312 2323 expand Python variables prepended with $ in all system calls. The
2313 2324 same was done to InteractiveShell.handle_shell_escape. Now all
2314 2325 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2315 2326 expansion of python variables and expressions according to the
2316 2327 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2317 2328
2318 2329 Though PEP-215 has been rejected, a similar (but simpler) one
2319 2330 seems like it will go into Python 2.4, PEP-292 -
2320 2331 http://www.python.org/peps/pep-0292.html.
2321 2332
2322 2333 I'll keep the full syntax of PEP-215, since IPython has since the
2323 2334 start used Ka-Ping Yee's reference implementation discussed there
2324 2335 (Itpl), and I actually like the powerful semantics it offers.
2325 2336
2326 2337 In order to access normal shell variables, the $ has to be escaped
2327 2338 via an extra $. For example:
2328 2339
2329 2340 In [7]: PATH='a python variable'
2330 2341
2331 2342 In [8]: !echo $PATH
2332 2343 a python variable
2333 2344
2334 2345 In [9]: !echo $$PATH
2335 2346 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2336 2347
2337 2348 (Magic.parse_options): escape $ so the shell doesn't evaluate
2338 2349 things prematurely.
2339 2350
2340 2351 * IPython/iplib.py (InteractiveShell.call_alias): added the
2341 2352 ability for aliases to expand python variables via $.
2342 2353
2343 2354 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2344 2355 system, now there's a @rehash/@rehashx pair of magics. These work
2345 2356 like the csh rehash command, and can be invoked at any time. They
2346 2357 build a table of aliases to everything in the user's $PATH
2347 2358 (@rehash uses everything, @rehashx is slower but only adds
2348 2359 executable files). With this, the pysh.py-based shell profile can
2349 2360 now simply call rehash upon startup, and full access to all
2350 2361 programs in the user's path is obtained.
2351 2362
2352 2363 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2353 2364 functionality is now fully in place. I removed the old dynamic
2354 2365 code generation based approach, in favor of a much lighter one
2355 2366 based on a simple dict. The advantage is that this allows me to
2356 2367 now have thousands of aliases with negligible cost (unthinkable
2357 2368 with the old system).
2358 2369
2359 2370 2004-06-19 Fernando Perez <fperez@colorado.edu>
2360 2371
2361 2372 * IPython/iplib.py (__init__): extended MagicCompleter class to
2362 2373 also complete (last in priority) on user aliases.
2363 2374
2364 2375 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2365 2376 call to eval.
2366 2377 (ItplNS.__init__): Added a new class which functions like Itpl,
2367 2378 but allows configuring the namespace for the evaluation to occur
2368 2379 in.
2369 2380
2370 2381 2004-06-18 Fernando Perez <fperez@colorado.edu>
2371 2382
2372 2383 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2373 2384 better message when 'exit' or 'quit' are typed (a common newbie
2374 2385 confusion).
2375 2386
2376 2387 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2377 2388 check for Windows users.
2378 2389
2379 2390 * IPython/iplib.py (InteractiveShell.user_setup): removed
2380 2391 disabling of colors for Windows. I'll test at runtime and issue a
2381 2392 warning if Gary's readline isn't found, as to nudge users to
2382 2393 download it.
2383 2394
2384 2395 2004-06-16 Fernando Perez <fperez@colorado.edu>
2385 2396
2386 2397 * IPython/genutils.py (Stream.__init__): changed to print errors
2387 2398 to sys.stderr. I had a circular dependency here. Now it's
2388 2399 possible to run ipython as IDLE's shell (consider this pre-alpha,
2389 2400 since true stdout things end up in the starting terminal instead
2390 2401 of IDLE's out).
2391 2402
2392 2403 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2393 2404 users who haven't # updated their prompt_in2 definitions. Remove
2394 2405 eventually.
2395 2406 (multiple_replace): added credit to original ASPN recipe.
2396 2407
2397 2408 2004-06-15 Fernando Perez <fperez@colorado.edu>
2398 2409
2399 2410 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2400 2411 list of auto-defined aliases.
2401 2412
2402 2413 2004-06-13 Fernando Perez <fperez@colorado.edu>
2403 2414
2404 2415 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2405 2416 install was really requested (so setup.py can be used for other
2406 2417 things under Windows).
2407 2418
2408 2419 2004-06-10 Fernando Perez <fperez@colorado.edu>
2409 2420
2410 2421 * IPython/Logger.py (Logger.create_log): Manually remove any old
2411 2422 backup, since os.remove may fail under Windows. Fixes bug
2412 2423 reported by Thorsten.
2413 2424
2414 2425 2004-06-09 Fernando Perez <fperez@colorado.edu>
2415 2426
2416 2427 * examples/example-embed.py: fixed all references to %n (replaced
2417 2428 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2418 2429 for all examples and the manual as well.
2419 2430
2420 2431 2004-06-08 Fernando Perez <fperez@colorado.edu>
2421 2432
2422 2433 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2423 2434 alignment and color management. All 3 prompt subsystems now
2424 2435 inherit from BasePrompt.
2425 2436
2426 2437 * tools/release: updates for windows installer build and tag rpms
2427 2438 with python version (since paths are fixed).
2428 2439
2429 2440 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2430 2441 which will become eventually obsolete. Also fixed the default
2431 2442 prompt_in2 to use \D, so at least new users start with the correct
2432 2443 defaults.
2433 2444 WARNING: Users with existing ipythonrc files will need to apply
2434 2445 this fix manually!
2435 2446
2436 2447 * setup.py: make windows installer (.exe). This is finally the
2437 2448 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2438 2449 which I hadn't included because it required Python 2.3 (or recent
2439 2450 distutils).
2440 2451
2441 2452 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2442 2453 usage of new '\D' escape.
2443 2454
2444 2455 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2445 2456 lacks os.getuid())
2446 2457 (CachedOutput.set_colors): Added the ability to turn coloring
2447 2458 on/off with @colors even for manually defined prompt colors. It
2448 2459 uses a nasty global, but it works safely and via the generic color
2449 2460 handling mechanism.
2450 2461 (Prompt2.__init__): Introduced new escape '\D' for continuation
2451 2462 prompts. It represents the counter ('\#') as dots.
2452 2463 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2453 2464 need to update their ipythonrc files and replace '%n' with '\D' in
2454 2465 their prompt_in2 settings everywhere. Sorry, but there's
2455 2466 otherwise no clean way to get all prompts to properly align. The
2456 2467 ipythonrc shipped with IPython has been updated.
2457 2468
2458 2469 2004-06-07 Fernando Perez <fperez@colorado.edu>
2459 2470
2460 2471 * setup.py (isfile): Pass local_icons option to latex2html, so the
2461 2472 resulting HTML file is self-contained. Thanks to
2462 2473 dryice-AT-liu.com.cn for the tip.
2463 2474
2464 2475 * pysh.py: I created a new profile 'shell', which implements a
2465 2476 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2466 2477 system shell, nor will it become one anytime soon. It's mainly
2467 2478 meant to illustrate the use of the new flexible bash-like prompts.
2468 2479 I guess it could be used by hardy souls for true shell management,
2469 2480 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2470 2481 profile. This uses the InterpreterExec extension provided by
2471 2482 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2472 2483
2473 2484 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2474 2485 auto-align itself with the length of the previous input prompt
2475 2486 (taking into account the invisible color escapes).
2476 2487 (CachedOutput.__init__): Large restructuring of this class. Now
2477 2488 all three prompts (primary1, primary2, output) are proper objects,
2478 2489 managed by the 'parent' CachedOutput class. The code is still a
2479 2490 bit hackish (all prompts share state via a pointer to the cache),
2480 2491 but it's overall far cleaner than before.
2481 2492
2482 2493 * IPython/genutils.py (getoutputerror): modified to add verbose,
2483 2494 debug and header options. This makes the interface of all getout*
2484 2495 functions uniform.
2485 2496 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2486 2497
2487 2498 * IPython/Magic.py (Magic.default_option): added a function to
2488 2499 allow registering default options for any magic command. This
2489 2500 makes it easy to have profiles which customize the magics globally
2490 2501 for a certain use. The values set through this function are
2491 2502 picked up by the parse_options() method, which all magics should
2492 2503 use to parse their options.
2493 2504
2494 2505 * IPython/genutils.py (warn): modified the warnings framework to
2495 2506 use the Term I/O class. I'm trying to slowly unify all of
2496 2507 IPython's I/O operations to pass through Term.
2497 2508
2498 2509 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2499 2510 the secondary prompt to correctly match the length of the primary
2500 2511 one for any prompt. Now multi-line code will properly line up
2501 2512 even for path dependent prompts, such as the new ones available
2502 2513 via the prompt_specials.
2503 2514
2504 2515 2004-06-06 Fernando Perez <fperez@colorado.edu>
2505 2516
2506 2517 * IPython/Prompts.py (prompt_specials): Added the ability to have
2507 2518 bash-like special sequences in the prompts, which get
2508 2519 automatically expanded. Things like hostname, current working
2509 2520 directory and username are implemented already, but it's easy to
2510 2521 add more in the future. Thanks to a patch by W.J. van der Laan
2511 2522 <gnufnork-AT-hetdigitalegat.nl>
2512 2523 (prompt_specials): Added color support for prompt strings, so
2513 2524 users can define arbitrary color setups for their prompts.
2514 2525
2515 2526 2004-06-05 Fernando Perez <fperez@colorado.edu>
2516 2527
2517 2528 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2518 2529 code to load Gary Bishop's readline and configure it
2519 2530 automatically. Thanks to Gary for help on this.
2520 2531
2521 2532 2004-06-01 Fernando Perez <fperez@colorado.edu>
2522 2533
2523 2534 * IPython/Logger.py (Logger.create_log): fix bug for logging
2524 2535 with no filename (previous fix was incomplete).
2525 2536
2526 2537 2004-05-25 Fernando Perez <fperez@colorado.edu>
2527 2538
2528 2539 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2529 2540 parens would get passed to the shell.
2530 2541
2531 2542 2004-05-20 Fernando Perez <fperez@colorado.edu>
2532 2543
2533 2544 * IPython/Magic.py (Magic.magic_prun): changed default profile
2534 2545 sort order to 'time' (the more common profiling need).
2535 2546
2536 2547 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2537 2548 so that source code shown is guaranteed in sync with the file on
2538 2549 disk (also changed in psource). Similar fix to the one for
2539 2550 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2540 2551 <yann.ledu-AT-noos.fr>.
2541 2552
2542 2553 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2543 2554 with a single option would not be correctly parsed. Closes
2544 2555 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2545 2556 introduced in 0.6.0 (on 2004-05-06).
2546 2557
2547 2558 2004-05-13 *** Released version 0.6.0
2548 2559
2549 2560 2004-05-13 Fernando Perez <fperez@colorado.edu>
2550 2561
2551 2562 * debian/: Added debian/ directory to CVS, so that debian support
2552 2563 is publicly accessible. The debian package is maintained by Jack
2553 2564 Moffit <jack-AT-xiph.org>.
2554 2565
2555 2566 * Documentation: included the notes about an ipython-based system
2556 2567 shell (the hypothetical 'pysh') into the new_design.pdf document,
2557 2568 so that these ideas get distributed to users along with the
2558 2569 official documentation.
2559 2570
2560 2571 2004-05-10 Fernando Perez <fperez@colorado.edu>
2561 2572
2562 2573 * IPython/Logger.py (Logger.create_log): fix recently introduced
2563 2574 bug (misindented line) where logstart would fail when not given an
2564 2575 explicit filename.
2565 2576
2566 2577 2004-05-09 Fernando Perez <fperez@colorado.edu>
2567 2578
2568 2579 * IPython/Magic.py (Magic.parse_options): skip system call when
2569 2580 there are no options to look for. Faster, cleaner for the common
2570 2581 case.
2571 2582
2572 2583 * Documentation: many updates to the manual: describing Windows
2573 2584 support better, Gnuplot updates, credits, misc small stuff. Also
2574 2585 updated the new_design doc a bit.
2575 2586
2576 2587 2004-05-06 *** Released version 0.6.0.rc1
2577 2588
2578 2589 2004-05-06 Fernando Perez <fperez@colorado.edu>
2579 2590
2580 2591 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2581 2592 operations to use the vastly more efficient list/''.join() method.
2582 2593 (FormattedTB.text): Fix
2583 2594 http://www.scipy.net/roundup/ipython/issue12 - exception source
2584 2595 extract not updated after reload. Thanks to Mike Salib
2585 2596 <msalib-AT-mit.edu> for pinning the source of the problem.
2586 2597 Fortunately, the solution works inside ipython and doesn't require
2587 2598 any changes to python proper.
2588 2599
2589 2600 * IPython/Magic.py (Magic.parse_options): Improved to process the
2590 2601 argument list as a true shell would (by actually using the
2591 2602 underlying system shell). This way, all @magics automatically get
2592 2603 shell expansion for variables. Thanks to a comment by Alex
2593 2604 Schmolck.
2594 2605
2595 2606 2004-04-04 Fernando Perez <fperez@colorado.edu>
2596 2607
2597 2608 * IPython/iplib.py (InteractiveShell.interact): Added a special
2598 2609 trap for a debugger quit exception, which is basically impossible
2599 2610 to handle by normal mechanisms, given what pdb does to the stack.
2600 2611 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2601 2612
2602 2613 2004-04-03 Fernando Perez <fperez@colorado.edu>
2603 2614
2604 2615 * IPython/genutils.py (Term): Standardized the names of the Term
2605 2616 class streams to cin/cout/cerr, following C++ naming conventions
2606 2617 (I can't use in/out/err because 'in' is not a valid attribute
2607 2618 name).
2608 2619
2609 2620 * IPython/iplib.py (InteractiveShell.interact): don't increment
2610 2621 the prompt if there's no user input. By Daniel 'Dang' Griffith
2611 2622 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2612 2623 Francois Pinard.
2613 2624
2614 2625 2004-04-02 Fernando Perez <fperez@colorado.edu>
2615 2626
2616 2627 * IPython/genutils.py (Stream.__init__): Modified to survive at
2617 2628 least importing in contexts where stdin/out/err aren't true file
2618 2629 objects, such as PyCrust (they lack fileno() and mode). However,
2619 2630 the recovery facilities which rely on these things existing will
2620 2631 not work.
2621 2632
2622 2633 2004-04-01 Fernando Perez <fperez@colorado.edu>
2623 2634
2624 2635 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2625 2636 use the new getoutputerror() function, so it properly
2626 2637 distinguishes stdout/err.
2627 2638
2628 2639 * IPython/genutils.py (getoutputerror): added a function to
2629 2640 capture separately the standard output and error of a command.
2630 2641 After a comment from dang on the mailing lists. This code is
2631 2642 basically a modified version of commands.getstatusoutput(), from
2632 2643 the standard library.
2633 2644
2634 2645 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2635 2646 '!!' as a special syntax (shorthand) to access @sx.
2636 2647
2637 2648 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2638 2649 command and return its output as a list split on '\n'.
2639 2650
2640 2651 2004-03-31 Fernando Perez <fperez@colorado.edu>
2641 2652
2642 2653 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2643 2654 method to dictionaries used as FakeModule instances if they lack
2644 2655 it. At least pydoc in python2.3 breaks for runtime-defined
2645 2656 functions without this hack. At some point I need to _really_
2646 2657 understand what FakeModule is doing, because it's a gross hack.
2647 2658 But it solves Arnd's problem for now...
2648 2659
2649 2660 2004-02-27 Fernando Perez <fperez@colorado.edu>
2650 2661
2651 2662 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2652 2663 mode would behave erratically. Also increased the number of
2653 2664 possible logs in rotate mod to 999. Thanks to Rod Holland
2654 2665 <rhh@StructureLABS.com> for the report and fixes.
2655 2666
2656 2667 2004-02-26 Fernando Perez <fperez@colorado.edu>
2657 2668
2658 2669 * IPython/genutils.py (page): Check that the curses module really
2659 2670 has the initscr attribute before trying to use it. For some
2660 2671 reason, the Solaris curses module is missing this. I think this
2661 2672 should be considered a Solaris python bug, but I'm not sure.
2662 2673
2663 2674 2004-01-17 Fernando Perez <fperez@colorado.edu>
2664 2675
2665 2676 * IPython/genutils.py (Stream.__init__): Changes to try to make
2666 2677 ipython robust against stdin/out/err being closed by the user.
2667 2678 This is 'user error' (and blocks a normal python session, at least
2668 2679 the stdout case). However, Ipython should be able to survive such
2669 2680 instances of abuse as gracefully as possible. To simplify the
2670 2681 coding and maintain compatibility with Gary Bishop's Term
2671 2682 contributions, I've made use of classmethods for this. I think
2672 2683 this introduces a dependency on python 2.2.
2673 2684
2674 2685 2004-01-13 Fernando Perez <fperez@colorado.edu>
2675 2686
2676 2687 * IPython/numutils.py (exp_safe): simplified the code a bit and
2677 2688 removed the need for importing the kinds module altogether.
2678 2689
2679 2690 2004-01-06 Fernando Perez <fperez@colorado.edu>
2680 2691
2681 2692 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2682 2693 a magic function instead, after some community feedback. No
2683 2694 special syntax will exist for it, but its name is deliberately
2684 2695 very short.
2685 2696
2686 2697 2003-12-20 Fernando Perez <fperez@colorado.edu>
2687 2698
2688 2699 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2689 2700 new functionality, to automagically assign the result of a shell
2690 2701 command to a variable. I'll solicit some community feedback on
2691 2702 this before making it permanent.
2692 2703
2693 2704 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2694 2705 requested about callables for which inspect couldn't obtain a
2695 2706 proper argspec. Thanks to a crash report sent by Etienne
2696 2707 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2697 2708
2698 2709 2003-12-09 Fernando Perez <fperez@colorado.edu>
2699 2710
2700 2711 * IPython/genutils.py (page): patch for the pager to work across
2701 2712 various versions of Windows. By Gary Bishop.
2702 2713
2703 2714 2003-12-04 Fernando Perez <fperez@colorado.edu>
2704 2715
2705 2716 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2706 2717 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2707 2718 While I tested this and it looks ok, there may still be corner
2708 2719 cases I've missed.
2709 2720
2710 2721 2003-12-01 Fernando Perez <fperez@colorado.edu>
2711 2722
2712 2723 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2713 2724 where a line like 'p,q=1,2' would fail because the automagic
2714 2725 system would be triggered for @p.
2715 2726
2716 2727 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2717 2728 cleanups, code unmodified.
2718 2729
2719 2730 * IPython/genutils.py (Term): added a class for IPython to handle
2720 2731 output. In most cases it will just be a proxy for stdout/err, but
2721 2732 having this allows modifications to be made for some platforms,
2722 2733 such as handling color escapes under Windows. All of this code
2723 2734 was contributed by Gary Bishop, with minor modifications by me.
2724 2735 The actual changes affect many files.
2725 2736
2726 2737 2003-11-30 Fernando Perez <fperez@colorado.edu>
2727 2738
2728 2739 * IPython/iplib.py (file_matches): new completion code, courtesy
2729 2740 of Jeff Collins. This enables filename completion again under
2730 2741 python 2.3, which disabled it at the C level.
2731 2742
2732 2743 2003-11-11 Fernando Perez <fperez@colorado.edu>
2733 2744
2734 2745 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2735 2746 for Numeric.array(map(...)), but often convenient.
2736 2747
2737 2748 2003-11-05 Fernando Perez <fperez@colorado.edu>
2738 2749
2739 2750 * IPython/numutils.py (frange): Changed a call from int() to
2740 2751 int(round()) to prevent a problem reported with arange() in the
2741 2752 numpy list.
2742 2753
2743 2754 2003-10-06 Fernando Perez <fperez@colorado.edu>
2744 2755
2745 2756 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2746 2757 prevent crashes if sys lacks an argv attribute (it happens with
2747 2758 embedded interpreters which build a bare-bones sys module).
2748 2759 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2749 2760
2750 2761 2003-09-24 Fernando Perez <fperez@colorado.edu>
2751 2762
2752 2763 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2753 2764 to protect against poorly written user objects where __getattr__
2754 2765 raises exceptions other than AttributeError. Thanks to a bug
2755 2766 report by Oliver Sander <osander-AT-gmx.de>.
2756 2767
2757 2768 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2758 2769 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2759 2770
2760 2771 2003-09-09 Fernando Perez <fperez@colorado.edu>
2761 2772
2762 2773 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2763 2774 unpacking a list whith a callable as first element would
2764 2775 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2765 2776 Collins.
2766 2777
2767 2778 2003-08-25 *** Released version 0.5.0
2768 2779
2769 2780 2003-08-22 Fernando Perez <fperez@colorado.edu>
2770 2781
2771 2782 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2772 2783 improperly defined user exceptions. Thanks to feedback from Mark
2773 2784 Russell <mrussell-AT-verio.net>.
2774 2785
2775 2786 2003-08-20 Fernando Perez <fperez@colorado.edu>
2776 2787
2777 2788 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2778 2789 printing so that it would print multi-line string forms starting
2779 2790 with a new line. This way the formatting is better respected for
2780 2791 objects which work hard to make nice string forms.
2781 2792
2782 2793 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2783 2794 autocall would overtake data access for objects with both
2784 2795 __getitem__ and __call__.
2785 2796
2786 2797 2003-08-19 *** Released version 0.5.0-rc1
2787 2798
2788 2799 2003-08-19 Fernando Perez <fperez@colorado.edu>
2789 2800
2790 2801 * IPython/deep_reload.py (load_tail): single tiny change here
2791 2802 seems to fix the long-standing bug of dreload() failing to work
2792 2803 for dotted names. But this module is pretty tricky, so I may have
2793 2804 missed some subtlety. Needs more testing!.
2794 2805
2795 2806 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2796 2807 exceptions which have badly implemented __str__ methods.
2797 2808 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2798 2809 which I've been getting reports about from Python 2.3 users. I
2799 2810 wish I had a simple test case to reproduce the problem, so I could
2800 2811 either write a cleaner workaround or file a bug report if
2801 2812 necessary.
2802 2813
2803 2814 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2804 2815 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2805 2816 a bug report by Tjabo Kloppenburg.
2806 2817
2807 2818 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2808 2819 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2809 2820 seems rather unstable. Thanks to a bug report by Tjabo
2810 2821 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2811 2822
2812 2823 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2813 2824 this out soon because of the critical fixes in the inner loop for
2814 2825 generators.
2815 2826
2816 2827 * IPython/Magic.py (Magic.getargspec): removed. This (and
2817 2828 _get_def) have been obsoleted by OInspect for a long time, I
2818 2829 hadn't noticed that they were dead code.
2819 2830 (Magic._ofind): restored _ofind functionality for a few literals
2820 2831 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2821 2832 for things like "hello".capitalize?, since that would require a
2822 2833 potentially dangerous eval() again.
2823 2834
2824 2835 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2825 2836 logic a bit more to clean up the escapes handling and minimize the
2826 2837 use of _ofind to only necessary cases. The interactive 'feel' of
2827 2838 IPython should have improved quite a bit with the changes in
2828 2839 _prefilter and _ofind (besides being far safer than before).
2829 2840
2830 2841 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2831 2842 obscure, never reported). Edit would fail to find the object to
2832 2843 edit under some circumstances.
2833 2844 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2834 2845 which were causing double-calling of generators. Those eval calls
2835 2846 were _very_ dangerous, since code with side effects could be
2836 2847 triggered. As they say, 'eval is evil'... These were the
2837 2848 nastiest evals in IPython. Besides, _ofind is now far simpler,
2838 2849 and it should also be quite a bit faster. Its use of inspect is
2839 2850 also safer, so perhaps some of the inspect-related crashes I've
2840 2851 seen lately with Python 2.3 might be taken care of. That will
2841 2852 need more testing.
2842 2853
2843 2854 2003-08-17 Fernando Perez <fperez@colorado.edu>
2844 2855
2845 2856 * IPython/iplib.py (InteractiveShell._prefilter): significant
2846 2857 simplifications to the logic for handling user escapes. Faster
2847 2858 and simpler code.
2848 2859
2849 2860 2003-08-14 Fernando Perez <fperez@colorado.edu>
2850 2861
2851 2862 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2852 2863 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2853 2864 but it should be quite a bit faster. And the recursive version
2854 2865 generated O(log N) intermediate storage for all rank>1 arrays,
2855 2866 even if they were contiguous.
2856 2867 (l1norm): Added this function.
2857 2868 (norm): Added this function for arbitrary norms (including
2858 2869 l-infinity). l1 and l2 are still special cases for convenience
2859 2870 and speed.
2860 2871
2861 2872 2003-08-03 Fernando Perez <fperez@colorado.edu>
2862 2873
2863 2874 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2864 2875 exceptions, which now raise PendingDeprecationWarnings in Python
2865 2876 2.3. There were some in Magic and some in Gnuplot2.
2866 2877
2867 2878 2003-06-30 Fernando Perez <fperez@colorado.edu>
2868 2879
2869 2880 * IPython/genutils.py (page): modified to call curses only for
2870 2881 terminals where TERM=='xterm'. After problems under many other
2871 2882 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2872 2883
2873 2884 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2874 2885 would be triggered when readline was absent. This was just an old
2875 2886 debugging statement I'd forgotten to take out.
2876 2887
2877 2888 2003-06-20 Fernando Perez <fperez@colorado.edu>
2878 2889
2879 2890 * IPython/genutils.py (clock): modified to return only user time
2880 2891 (not counting system time), after a discussion on scipy. While
2881 2892 system time may be a useful quantity occasionally, it may much
2882 2893 more easily be skewed by occasional swapping or other similar
2883 2894 activity.
2884 2895
2885 2896 2003-06-05 Fernando Perez <fperez@colorado.edu>
2886 2897
2887 2898 * IPython/numutils.py (identity): new function, for building
2888 2899 arbitrary rank Kronecker deltas (mostly backwards compatible with
2889 2900 Numeric.identity)
2890 2901
2891 2902 2003-06-03 Fernando Perez <fperez@colorado.edu>
2892 2903
2893 2904 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2894 2905 arguments passed to magics with spaces, to allow trailing '\' to
2895 2906 work normally (mainly for Windows users).
2896 2907
2897 2908 2003-05-29 Fernando Perez <fperez@colorado.edu>
2898 2909
2899 2910 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2900 2911 instead of pydoc.help. This fixes a bizarre behavior where
2901 2912 printing '%s' % locals() would trigger the help system. Now
2902 2913 ipython behaves like normal python does.
2903 2914
2904 2915 Note that if one does 'from pydoc import help', the bizarre
2905 2916 behavior returns, but this will also happen in normal python, so
2906 2917 it's not an ipython bug anymore (it has to do with how pydoc.help
2907 2918 is implemented).
2908 2919
2909 2920 2003-05-22 Fernando Perez <fperez@colorado.edu>
2910 2921
2911 2922 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2912 2923 return [] instead of None when nothing matches, also match to end
2913 2924 of line. Patch by Gary Bishop.
2914 2925
2915 2926 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2916 2927 protection as before, for files passed on the command line. This
2917 2928 prevents the CrashHandler from kicking in if user files call into
2918 2929 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2919 2930 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2920 2931
2921 2932 2003-05-20 *** Released version 0.4.0
2922 2933
2923 2934 2003-05-20 Fernando Perez <fperez@colorado.edu>
2924 2935
2925 2936 * setup.py: added support for manpages. It's a bit hackish b/c of
2926 2937 a bug in the way the bdist_rpm distutils target handles gzipped
2927 2938 manpages, but it works. After a patch by Jack.
2928 2939
2929 2940 2003-05-19 Fernando Perez <fperez@colorado.edu>
2930 2941
2931 2942 * IPython/numutils.py: added a mockup of the kinds module, since
2932 2943 it was recently removed from Numeric. This way, numutils will
2933 2944 work for all users even if they are missing kinds.
2934 2945
2935 2946 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2936 2947 failure, which can occur with SWIG-wrapped extensions. After a
2937 2948 crash report from Prabhu.
2938 2949
2939 2950 2003-05-16 Fernando Perez <fperez@colorado.edu>
2940 2951
2941 2952 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2942 2953 protect ipython from user code which may call directly
2943 2954 sys.excepthook (this looks like an ipython crash to the user, even
2944 2955 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2945 2956 This is especially important to help users of WxWindows, but may
2946 2957 also be useful in other cases.
2947 2958
2948 2959 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2949 2960 an optional tb_offset to be specified, and to preserve exception
2950 2961 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2951 2962
2952 2963 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2953 2964
2954 2965 2003-05-15 Fernando Perez <fperez@colorado.edu>
2955 2966
2956 2967 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2957 2968 installing for a new user under Windows.
2958 2969
2959 2970 2003-05-12 Fernando Perez <fperez@colorado.edu>
2960 2971
2961 2972 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2962 2973 handler for Emacs comint-based lines. Currently it doesn't do
2963 2974 much (but importantly, it doesn't update the history cache). In
2964 2975 the future it may be expanded if Alex needs more functionality
2965 2976 there.
2966 2977
2967 2978 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2968 2979 info to crash reports.
2969 2980
2970 2981 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2971 2982 just like Python's -c. Also fixed crash with invalid -color
2972 2983 option value at startup. Thanks to Will French
2973 2984 <wfrench-AT-bestweb.net> for the bug report.
2974 2985
2975 2986 2003-05-09 Fernando Perez <fperez@colorado.edu>
2976 2987
2977 2988 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2978 2989 to EvalDict (it's a mapping, after all) and simplified its code
2979 2990 quite a bit, after a nice discussion on c.l.py where Gustavo
2980 2991 Córdova <gcordova-AT-sismex.com> suggested the new version.
2981 2992
2982 2993 2003-04-30 Fernando Perez <fperez@colorado.edu>
2983 2994
2984 2995 * IPython/genutils.py (timings_out): modified it to reduce its
2985 2996 overhead in the common reps==1 case.
2986 2997
2987 2998 2003-04-29 Fernando Perez <fperez@colorado.edu>
2988 2999
2989 3000 * IPython/genutils.py (timings_out): Modified to use the resource
2990 3001 module, which avoids the wraparound problems of time.clock().
2991 3002
2992 3003 2003-04-17 *** Released version 0.2.15pre4
2993 3004
2994 3005 2003-04-17 Fernando Perez <fperez@colorado.edu>
2995 3006
2996 3007 * setup.py (scriptfiles): Split windows-specific stuff over to a
2997 3008 separate file, in an attempt to have a Windows GUI installer.
2998 3009 That didn't work, but part of the groundwork is done.
2999 3010
3000 3011 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3001 3012 indent/unindent with 4 spaces. Particularly useful in combination
3002 3013 with the new auto-indent option.
3003 3014
3004 3015 2003-04-16 Fernando Perez <fperez@colorado.edu>
3005 3016
3006 3017 * IPython/Magic.py: various replacements of self.rc for
3007 3018 self.shell.rc. A lot more remains to be done to fully disentangle
3008 3019 this class from the main Shell class.
3009 3020
3010 3021 * IPython/GnuplotRuntime.py: added checks for mouse support so
3011 3022 that we don't try to enable it if the current gnuplot doesn't
3012 3023 really support it. Also added checks so that we don't try to
3013 3024 enable persist under Windows (where Gnuplot doesn't recognize the
3014 3025 option).
3015 3026
3016 3027 * IPython/iplib.py (InteractiveShell.interact): Added optional
3017 3028 auto-indenting code, after a patch by King C. Shu
3018 3029 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3019 3030 get along well with pasting indented code. If I ever figure out
3020 3031 how to make that part go well, it will become on by default.
3021 3032
3022 3033 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3023 3034 crash ipython if there was an unmatched '%' in the user's prompt
3024 3035 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3025 3036
3026 3037 * IPython/iplib.py (InteractiveShell.interact): removed the
3027 3038 ability to ask the user whether he wants to crash or not at the
3028 3039 'last line' exception handler. Calling functions at that point
3029 3040 changes the stack, and the error reports would have incorrect
3030 3041 tracebacks.
3031 3042
3032 3043 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3033 3044 pass through a peger a pretty-printed form of any object. After a
3034 3045 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3035 3046
3036 3047 2003-04-14 Fernando Perez <fperez@colorado.edu>
3037 3048
3038 3049 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3039 3050 all files in ~ would be modified at first install (instead of
3040 3051 ~/.ipython). This could be potentially disastrous, as the
3041 3052 modification (make line-endings native) could damage binary files.
3042 3053
3043 3054 2003-04-10 Fernando Perez <fperez@colorado.edu>
3044 3055
3045 3056 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3046 3057 handle only lines which are invalid python. This now means that
3047 3058 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3048 3059 for the bug report.
3049 3060
3050 3061 2003-04-01 Fernando Perez <fperez@colorado.edu>
3051 3062
3052 3063 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3053 3064 where failing to set sys.last_traceback would crash pdb.pm().
3054 3065 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3055 3066 report.
3056 3067
3057 3068 2003-03-25 Fernando Perez <fperez@colorado.edu>
3058 3069
3059 3070 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3060 3071 before printing it (it had a lot of spurious blank lines at the
3061 3072 end).
3062 3073
3063 3074 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3064 3075 output would be sent 21 times! Obviously people don't use this
3065 3076 too often, or I would have heard about it.
3066 3077
3067 3078 2003-03-24 Fernando Perez <fperez@colorado.edu>
3068 3079
3069 3080 * setup.py (scriptfiles): renamed the data_files parameter from
3070 3081 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3071 3082 for the patch.
3072 3083
3073 3084 2003-03-20 Fernando Perez <fperez@colorado.edu>
3074 3085
3075 3086 * IPython/genutils.py (error): added error() and fatal()
3076 3087 functions.
3077 3088
3078 3089 2003-03-18 *** Released version 0.2.15pre3
3079 3090
3080 3091 2003-03-18 Fernando Perez <fperez@colorado.edu>
3081 3092
3082 3093 * setupext/install_data_ext.py
3083 3094 (install_data_ext.initialize_options): Class contributed by Jack
3084 3095 Moffit for fixing the old distutils hack. He is sending this to
3085 3096 the distutils folks so in the future we may not need it as a
3086 3097 private fix.
3087 3098
3088 3099 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3089 3100 changes for Debian packaging. See his patch for full details.
3090 3101 The old distutils hack of making the ipythonrc* files carry a
3091 3102 bogus .py extension is gone, at last. Examples were moved to a
3092 3103 separate subdir under doc/, and the separate executable scripts
3093 3104 now live in their own directory. Overall a great cleanup. The
3094 3105 manual was updated to use the new files, and setup.py has been
3095 3106 fixed for this setup.
3096 3107
3097 3108 * IPython/PyColorize.py (Parser.usage): made non-executable and
3098 3109 created a pycolor wrapper around it to be included as a script.
3099 3110
3100 3111 2003-03-12 *** Released version 0.2.15pre2
3101 3112
3102 3113 2003-03-12 Fernando Perez <fperez@colorado.edu>
3103 3114
3104 3115 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3105 3116 long-standing problem with garbage characters in some terminals.
3106 3117 The issue was really that the \001 and \002 escapes must _only_ be
3107 3118 passed to input prompts (which call readline), but _never_ to
3108 3119 normal text to be printed on screen. I changed ColorANSI to have
3109 3120 two classes: TermColors and InputTermColors, each with the
3110 3121 appropriate escapes for input prompts or normal text. The code in
3111 3122 Prompts.py got slightly more complicated, but this very old and
3112 3123 annoying bug is finally fixed.
3113 3124
3114 3125 All the credit for nailing down the real origin of this problem
3115 3126 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3116 3127 *Many* thanks to him for spending quite a bit of effort on this.
3117 3128
3118 3129 2003-03-05 *** Released version 0.2.15pre1
3119 3130
3120 3131 2003-03-03 Fernando Perez <fperez@colorado.edu>
3121 3132
3122 3133 * IPython/FakeModule.py: Moved the former _FakeModule to a
3123 3134 separate file, because it's also needed by Magic (to fix a similar
3124 3135 pickle-related issue in @run).
3125 3136
3126 3137 2003-03-02 Fernando Perez <fperez@colorado.edu>
3127 3138
3128 3139 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3129 3140 the autocall option at runtime.
3130 3141 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3131 3142 across Magic.py to start separating Magic from InteractiveShell.
3132 3143 (Magic._ofind): Fixed to return proper namespace for dotted
3133 3144 names. Before, a dotted name would always return 'not currently
3134 3145 defined', because it would find the 'parent'. s.x would be found,
3135 3146 but since 'x' isn't defined by itself, it would get confused.
3136 3147 (Magic.magic_run): Fixed pickling problems reported by Ralf
3137 3148 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3138 3149 that I'd used when Mike Heeter reported similar issues at the
3139 3150 top-level, but now for @run. It boils down to injecting the
3140 3151 namespace where code is being executed with something that looks
3141 3152 enough like a module to fool pickle.dump(). Since a pickle stores
3142 3153 a named reference to the importing module, we need this for
3143 3154 pickles to save something sensible.
3144 3155
3145 3156 * IPython/ipmaker.py (make_IPython): added an autocall option.
3146 3157
3147 3158 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3148 3159 the auto-eval code. Now autocalling is an option, and the code is
3149 3160 also vastly safer. There is no more eval() involved at all.
3150 3161
3151 3162 2003-03-01 Fernando Perez <fperez@colorado.edu>
3152 3163
3153 3164 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3154 3165 dict with named keys instead of a tuple.
3155 3166
3156 3167 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3157 3168
3158 3169 * setup.py (make_shortcut): Fixed message about directories
3159 3170 created during Windows installation (the directories were ok, just
3160 3171 the printed message was misleading). Thanks to Chris Liechti
3161 3172 <cliechti-AT-gmx.net> for the heads up.
3162 3173
3163 3174 2003-02-21 Fernando Perez <fperez@colorado.edu>
3164 3175
3165 3176 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3166 3177 of ValueError exception when checking for auto-execution. This
3167 3178 one is raised by things like Numeric arrays arr.flat when the
3168 3179 array is non-contiguous.
3169 3180
3170 3181 2003-01-31 Fernando Perez <fperez@colorado.edu>
3171 3182
3172 3183 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3173 3184 not return any value at all (even though the command would get
3174 3185 executed).
3175 3186 (xsys): Flush stdout right after printing the command to ensure
3176 3187 proper ordering of commands and command output in the total
3177 3188 output.
3178 3189 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3179 3190 system/getoutput as defaults. The old ones are kept for
3180 3191 compatibility reasons, so no code which uses this library needs
3181 3192 changing.
3182 3193
3183 3194 2003-01-27 *** Released version 0.2.14
3184 3195
3185 3196 2003-01-25 Fernando Perez <fperez@colorado.edu>
3186 3197
3187 3198 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3188 3199 functions defined in previous edit sessions could not be re-edited
3189 3200 (because the temp files were immediately removed). Now temp files
3190 3201 are removed only at IPython's exit.
3191 3202 (Magic.magic_run): Improved @run to perform shell-like expansions
3192 3203 on its arguments (~users and $VARS). With this, @run becomes more
3193 3204 like a normal command-line.
3194 3205
3195 3206 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3196 3207 bugs related to embedding and cleaned up that code. A fairly
3197 3208 important one was the impossibility to access the global namespace
3198 3209 through the embedded IPython (only local variables were visible).
3199 3210
3200 3211 2003-01-14 Fernando Perez <fperez@colorado.edu>
3201 3212
3202 3213 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3203 3214 auto-calling to be a bit more conservative. Now it doesn't get
3204 3215 triggered if any of '!=()<>' are in the rest of the input line, to
3205 3216 allow comparing callables. Thanks to Alex for the heads up.
3206 3217
3207 3218 2003-01-07 Fernando Perez <fperez@colorado.edu>
3208 3219
3209 3220 * IPython/genutils.py (page): fixed estimation of the number of
3210 3221 lines in a string to be paged to simply count newlines. This
3211 3222 prevents over-guessing due to embedded escape sequences. A better
3212 3223 long-term solution would involve stripping out the control chars
3213 3224 for the count, but it's potentially so expensive I just don't
3214 3225 think it's worth doing.
3215 3226
3216 3227 2002-12-19 *** Released version 0.2.14pre50
3217 3228
3218 3229 2002-12-19 Fernando Perez <fperez@colorado.edu>
3219 3230
3220 3231 * tools/release (version): Changed release scripts to inform
3221 3232 Andrea and build a NEWS file with a list of recent changes.
3222 3233
3223 3234 * IPython/ColorANSI.py (__all__): changed terminal detection
3224 3235 code. Seems to work better for xterms without breaking
3225 3236 konsole. Will need more testing to determine if WinXP and Mac OSX
3226 3237 also work ok.
3227 3238
3228 3239 2002-12-18 *** Released version 0.2.14pre49
3229 3240
3230 3241 2002-12-18 Fernando Perez <fperez@colorado.edu>
3231 3242
3232 3243 * Docs: added new info about Mac OSX, from Andrea.
3233 3244
3234 3245 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3235 3246 allow direct plotting of python strings whose format is the same
3236 3247 of gnuplot data files.
3237 3248
3238 3249 2002-12-16 Fernando Perez <fperez@colorado.edu>
3239 3250
3240 3251 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3241 3252 value of exit question to be acknowledged.
3242 3253
3243 3254 2002-12-03 Fernando Perez <fperez@colorado.edu>
3244 3255
3245 3256 * IPython/ipmaker.py: removed generators, which had been added
3246 3257 by mistake in an earlier debugging run. This was causing trouble
3247 3258 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3248 3259 for pointing this out.
3249 3260
3250 3261 2002-11-17 Fernando Perez <fperez@colorado.edu>
3251 3262
3252 3263 * Manual: updated the Gnuplot section.
3253 3264
3254 3265 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3255 3266 a much better split of what goes in Runtime and what goes in
3256 3267 Interactive.
3257 3268
3258 3269 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3259 3270 being imported from iplib.
3260 3271
3261 3272 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3262 3273 for command-passing. Now the global Gnuplot instance is called
3263 3274 'gp' instead of 'g', which was really a far too fragile and
3264 3275 common name.
3265 3276
3266 3277 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3267 3278 bounding boxes generated by Gnuplot for square plots.
3268 3279
3269 3280 * IPython/genutils.py (popkey): new function added. I should
3270 3281 suggest this on c.l.py as a dict method, it seems useful.
3271 3282
3272 3283 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3273 3284 to transparently handle PostScript generation. MUCH better than
3274 3285 the previous plot_eps/replot_eps (which I removed now). The code
3275 3286 is also fairly clean and well documented now (including
3276 3287 docstrings).
3277 3288
3278 3289 2002-11-13 Fernando Perez <fperez@colorado.edu>
3279 3290
3280 3291 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3281 3292 (inconsistent with options).
3282 3293
3283 3294 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3284 3295 manually disabled, I don't know why. Fixed it.
3285 3296 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3286 3297 eps output.
3287 3298
3288 3299 2002-11-12 Fernando Perez <fperez@colorado.edu>
3289 3300
3290 3301 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3291 3302 don't propagate up to caller. Fixes crash reported by François
3292 3303 Pinard.
3293 3304
3294 3305 2002-11-09 Fernando Perez <fperez@colorado.edu>
3295 3306
3296 3307 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3297 3308 history file for new users.
3298 3309 (make_IPython): fixed bug where initial install would leave the
3299 3310 user running in the .ipython dir.
3300 3311 (make_IPython): fixed bug where config dir .ipython would be
3301 3312 created regardless of the given -ipythondir option. Thanks to Cory
3302 3313 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3303 3314
3304 3315 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3305 3316 type confirmations. Will need to use it in all of IPython's code
3306 3317 consistently.
3307 3318
3308 3319 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3309 3320 context to print 31 lines instead of the default 5. This will make
3310 3321 the crash reports extremely detailed in case the problem is in
3311 3322 libraries I don't have access to.
3312 3323
3313 3324 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3314 3325 line of defense' code to still crash, but giving users fair
3315 3326 warning. I don't want internal errors to go unreported: if there's
3316 3327 an internal problem, IPython should crash and generate a full
3317 3328 report.
3318 3329
3319 3330 2002-11-08 Fernando Perez <fperez@colorado.edu>
3320 3331
3321 3332 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3322 3333 otherwise uncaught exceptions which can appear if people set
3323 3334 sys.stdout to something badly broken. Thanks to a crash report
3324 3335 from henni-AT-mail.brainbot.com.
3325 3336
3326 3337 2002-11-04 Fernando Perez <fperez@colorado.edu>
3327 3338
3328 3339 * IPython/iplib.py (InteractiveShell.interact): added
3329 3340 __IPYTHON__active to the builtins. It's a flag which goes on when
3330 3341 the interaction starts and goes off again when it stops. This
3331 3342 allows embedding code to detect being inside IPython. Before this
3332 3343 was done via __IPYTHON__, but that only shows that an IPython
3333 3344 instance has been created.
3334 3345
3335 3346 * IPython/Magic.py (Magic.magic_env): I realized that in a
3336 3347 UserDict, instance.data holds the data as a normal dict. So I
3337 3348 modified @env to return os.environ.data instead of rebuilding a
3338 3349 dict by hand.
3339 3350
3340 3351 2002-11-02 Fernando Perez <fperez@colorado.edu>
3341 3352
3342 3353 * IPython/genutils.py (warn): changed so that level 1 prints no
3343 3354 header. Level 2 is now the default (with 'WARNING' header, as
3344 3355 before). I think I tracked all places where changes were needed in
3345 3356 IPython, but outside code using the old level numbering may have
3346 3357 broken.
3347 3358
3348 3359 * IPython/iplib.py (InteractiveShell.runcode): added this to
3349 3360 handle the tracebacks in SystemExit traps correctly. The previous
3350 3361 code (through interact) was printing more of the stack than
3351 3362 necessary, showing IPython internal code to the user.
3352 3363
3353 3364 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3354 3365 default. Now that the default at the confirmation prompt is yes,
3355 3366 it's not so intrusive. François' argument that ipython sessions
3356 3367 tend to be complex enough not to lose them from an accidental C-d,
3357 3368 is a valid one.
3358 3369
3359 3370 * IPython/iplib.py (InteractiveShell.interact): added a
3360 3371 showtraceback() call to the SystemExit trap, and modified the exit
3361 3372 confirmation to have yes as the default.
3362 3373
3363 3374 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3364 3375 this file. It's been gone from the code for a long time, this was
3365 3376 simply leftover junk.
3366 3377
3367 3378 2002-11-01 Fernando Perez <fperez@colorado.edu>
3368 3379
3369 3380 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3370 3381 added. If set, IPython now traps EOF and asks for
3371 3382 confirmation. After a request by François Pinard.
3372 3383
3373 3384 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3374 3385 of @abort, and with a new (better) mechanism for handling the
3375 3386 exceptions.
3376 3387
3377 3388 2002-10-27 Fernando Perez <fperez@colorado.edu>
3378 3389
3379 3390 * IPython/usage.py (__doc__): updated the --help information and
3380 3391 the ipythonrc file to indicate that -log generates
3381 3392 ./ipython.log. Also fixed the corresponding info in @logstart.
3382 3393 This and several other fixes in the manuals thanks to reports by
3383 3394 François Pinard <pinard-AT-iro.umontreal.ca>.
3384 3395
3385 3396 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3386 3397 refer to @logstart (instead of @log, which doesn't exist).
3387 3398
3388 3399 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3389 3400 AttributeError crash. Thanks to Christopher Armstrong
3390 3401 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3391 3402 introduced recently (in 0.2.14pre37) with the fix to the eval
3392 3403 problem mentioned below.
3393 3404
3394 3405 2002-10-17 Fernando Perez <fperez@colorado.edu>
3395 3406
3396 3407 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3397 3408 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3398 3409
3399 3410 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3400 3411 this function to fix a problem reported by Alex Schmolck. He saw
3401 3412 it with list comprehensions and generators, which were getting
3402 3413 called twice. The real problem was an 'eval' call in testing for
3403 3414 automagic which was evaluating the input line silently.
3404 3415
3405 3416 This is a potentially very nasty bug, if the input has side
3406 3417 effects which must not be repeated. The code is much cleaner now,
3407 3418 without any blanket 'except' left and with a regexp test for
3408 3419 actual function names.
3409 3420
3410 3421 But an eval remains, which I'm not fully comfortable with. I just
3411 3422 don't know how to find out if an expression could be a callable in
3412 3423 the user's namespace without doing an eval on the string. However
3413 3424 that string is now much more strictly checked so that no code
3414 3425 slips by, so the eval should only happen for things that can
3415 3426 really be only function/method names.
3416 3427
3417 3428 2002-10-15 Fernando Perez <fperez@colorado.edu>
3418 3429
3419 3430 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3420 3431 OSX information to main manual, removed README_Mac_OSX file from
3421 3432 distribution. Also updated credits for recent additions.
3422 3433
3423 3434 2002-10-10 Fernando Perez <fperez@colorado.edu>
3424 3435
3425 3436 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3426 3437 terminal-related issues. Many thanks to Andrea Riciputi
3427 3438 <andrea.riciputi-AT-libero.it> for writing it.
3428 3439
3429 3440 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3430 3441 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3431 3442
3432 3443 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3433 3444 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3434 3445 <syver-en-AT-online.no> who both submitted patches for this problem.
3435 3446
3436 3447 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3437 3448 global embedding to make sure that things don't overwrite user
3438 3449 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3439 3450
3440 3451 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3441 3452 compatibility. Thanks to Hayden Callow
3442 3453 <h.callow-AT-elec.canterbury.ac.nz>
3443 3454
3444 3455 2002-10-04 Fernando Perez <fperez@colorado.edu>
3445 3456
3446 3457 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3447 3458 Gnuplot.File objects.
3448 3459
3449 3460 2002-07-23 Fernando Perez <fperez@colorado.edu>
3450 3461
3451 3462 * IPython/genutils.py (timing): Added timings() and timing() for
3452 3463 quick access to the most commonly needed data, the execution
3453 3464 times. Old timing() renamed to timings_out().
3454 3465
3455 3466 2002-07-18 Fernando Perez <fperez@colorado.edu>
3456 3467
3457 3468 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3458 3469 bug with nested instances disrupting the parent's tab completion.
3459 3470
3460 3471 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3461 3472 all_completions code to begin the emacs integration.
3462 3473
3463 3474 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3464 3475 argument to allow titling individual arrays when plotting.
3465 3476
3466 3477 2002-07-15 Fernando Perez <fperez@colorado.edu>
3467 3478
3468 3479 * setup.py (make_shortcut): changed to retrieve the value of
3469 3480 'Program Files' directory from the registry (this value changes in
3470 3481 non-english versions of Windows). Thanks to Thomas Fanslau
3471 3482 <tfanslau-AT-gmx.de> for the report.
3472 3483
3473 3484 2002-07-10 Fernando Perez <fperez@colorado.edu>
3474 3485
3475 3486 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3476 3487 a bug in pdb, which crashes if a line with only whitespace is
3477 3488 entered. Bug report submitted to sourceforge.
3478 3489
3479 3490 2002-07-09 Fernando Perez <fperez@colorado.edu>
3480 3491
3481 3492 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3482 3493 reporting exceptions (it's a bug in inspect.py, I just set a
3483 3494 workaround).
3484 3495
3485 3496 2002-07-08 Fernando Perez <fperez@colorado.edu>
3486 3497
3487 3498 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3488 3499 __IPYTHON__ in __builtins__ to show up in user_ns.
3489 3500
3490 3501 2002-07-03 Fernando Perez <fperez@colorado.edu>
3491 3502
3492 3503 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3493 3504 name from @gp_set_instance to @gp_set_default.
3494 3505
3495 3506 * IPython/ipmaker.py (make_IPython): default editor value set to
3496 3507 '0' (a string), to match the rc file. Otherwise will crash when
3497 3508 .strip() is called on it.
3498 3509
3499 3510
3500 3511 2002-06-28 Fernando Perez <fperez@colorado.edu>
3501 3512
3502 3513 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3503 3514 of files in current directory when a file is executed via
3504 3515 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3505 3516
3506 3517 * setup.py (manfiles): fix for rpm builds, submitted by RA
3507 3518 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3508 3519
3509 3520 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3510 3521 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3511 3522 string!). A. Schmolck caught this one.
3512 3523
3513 3524 2002-06-27 Fernando Perez <fperez@colorado.edu>
3514 3525
3515 3526 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3516 3527 defined files at the cmd line. __name__ wasn't being set to
3517 3528 __main__.
3518 3529
3519 3530 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3520 3531 regular lists and tuples besides Numeric arrays.
3521 3532
3522 3533 * IPython/Prompts.py (CachedOutput.__call__): Added output
3523 3534 supression for input ending with ';'. Similar to Mathematica and
3524 3535 Matlab. The _* vars and Out[] list are still updated, just like
3525 3536 Mathematica behaves.
3526 3537
3527 3538 2002-06-25 Fernando Perez <fperez@colorado.edu>
3528 3539
3529 3540 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3530 3541 .ini extensions for profiels under Windows.
3531 3542
3532 3543 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3533 3544 string form. Fix contributed by Alexander Schmolck
3534 3545 <a.schmolck-AT-gmx.net>
3535 3546
3536 3547 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3537 3548 pre-configured Gnuplot instance.
3538 3549
3539 3550 2002-06-21 Fernando Perez <fperez@colorado.edu>
3540 3551
3541 3552 * IPython/numutils.py (exp_safe): new function, works around the
3542 3553 underflow problems in Numeric.
3543 3554 (log2): New fn. Safe log in base 2: returns exact integer answer
3544 3555 for exact integer powers of 2.
3545 3556
3546 3557 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3547 3558 properly.
3548 3559
3549 3560 2002-06-20 Fernando Perez <fperez@colorado.edu>
3550 3561
3551 3562 * IPython/genutils.py (timing): new function like
3552 3563 Mathematica's. Similar to time_test, but returns more info.
3553 3564
3554 3565 2002-06-18 Fernando Perez <fperez@colorado.edu>
3555 3566
3556 3567 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3557 3568 according to Mike Heeter's suggestions.
3558 3569
3559 3570 2002-06-16 Fernando Perez <fperez@colorado.edu>
3560 3571
3561 3572 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3562 3573 system. GnuplotMagic is gone as a user-directory option. New files
3563 3574 make it easier to use all the gnuplot stuff both from external
3564 3575 programs as well as from IPython. Had to rewrite part of
3565 3576 hardcopy() b/c of a strange bug: often the ps files simply don't
3566 3577 get created, and require a repeat of the command (often several
3567 3578 times).
3568 3579
3569 3580 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3570 3581 resolve output channel at call time, so that if sys.stderr has
3571 3582 been redirected by user this gets honored.
3572 3583
3573 3584 2002-06-13 Fernando Perez <fperez@colorado.edu>
3574 3585
3575 3586 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3576 3587 IPShell. Kept a copy with the old names to avoid breaking people's
3577 3588 embedded code.
3578 3589
3579 3590 * IPython/ipython: simplified it to the bare minimum after
3580 3591 Holger's suggestions. Added info about how to use it in
3581 3592 PYTHONSTARTUP.
3582 3593
3583 3594 * IPython/Shell.py (IPythonShell): changed the options passing
3584 3595 from a string with funky %s replacements to a straight list. Maybe
3585 3596 a bit more typing, but it follows sys.argv conventions, so there's
3586 3597 less special-casing to remember.
3587 3598
3588 3599 2002-06-12 Fernando Perez <fperez@colorado.edu>
3589 3600
3590 3601 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3591 3602 command. Thanks to a suggestion by Mike Heeter.
3592 3603 (Magic.magic_pfile): added behavior to look at filenames if given
3593 3604 arg is not a defined object.
3594 3605 (Magic.magic_save): New @save function to save code snippets. Also
3595 3606 a Mike Heeter idea.
3596 3607
3597 3608 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3598 3609 plot() and replot(). Much more convenient now, especially for
3599 3610 interactive use.
3600 3611
3601 3612 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3602 3613 filenames.
3603 3614
3604 3615 2002-06-02 Fernando Perez <fperez@colorado.edu>
3605 3616
3606 3617 * IPython/Struct.py (Struct.__init__): modified to admit
3607 3618 initialization via another struct.
3608 3619
3609 3620 * IPython/genutils.py (SystemExec.__init__): New stateful
3610 3621 interface to xsys and bq. Useful for writing system scripts.
3611 3622
3612 3623 2002-05-30 Fernando Perez <fperez@colorado.edu>
3613 3624
3614 3625 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3615 3626 documents. This will make the user download smaller (it's getting
3616 3627 too big).
3617 3628
3618 3629 2002-05-29 Fernando Perez <fperez@colorado.edu>
3619 3630
3620 3631 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3621 3632 fix problems with shelve and pickle. Seems to work, but I don't
3622 3633 know if corner cases break it. Thanks to Mike Heeter
3623 3634 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3624 3635
3625 3636 2002-05-24 Fernando Perez <fperez@colorado.edu>
3626 3637
3627 3638 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3628 3639 macros having broken.
3629 3640
3630 3641 2002-05-21 Fernando Perez <fperez@colorado.edu>
3631 3642
3632 3643 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3633 3644 introduced logging bug: all history before logging started was
3634 3645 being written one character per line! This came from the redesign
3635 3646 of the input history as a special list which slices to strings,
3636 3647 not to lists.
3637 3648
3638 3649 2002-05-20 Fernando Perez <fperez@colorado.edu>
3639 3650
3640 3651 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3641 3652 be an attribute of all classes in this module. The design of these
3642 3653 classes needs some serious overhauling.
3643 3654
3644 3655 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3645 3656 which was ignoring '_' in option names.
3646 3657
3647 3658 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3648 3659 'Verbose_novars' to 'Context' and made it the new default. It's a
3649 3660 bit more readable and also safer than verbose.
3650 3661
3651 3662 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3652 3663 triple-quoted strings.
3653 3664
3654 3665 * IPython/OInspect.py (__all__): new module exposing the object
3655 3666 introspection facilities. Now the corresponding magics are dummy
3656 3667 wrappers around this. Having this module will make it much easier
3657 3668 to put these functions into our modified pdb.
3658 3669 This new object inspector system uses the new colorizing module,
3659 3670 so source code and other things are nicely syntax highlighted.
3660 3671
3661 3672 2002-05-18 Fernando Perez <fperez@colorado.edu>
3662 3673
3663 3674 * IPython/ColorANSI.py: Split the coloring tools into a separate
3664 3675 module so I can use them in other code easier (they were part of
3665 3676 ultraTB).
3666 3677
3667 3678 2002-05-17 Fernando Perez <fperez@colorado.edu>
3668 3679
3669 3680 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3670 3681 fixed it to set the global 'g' also to the called instance, as
3671 3682 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3672 3683 user's 'g' variables).
3673 3684
3674 3685 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3675 3686 global variables (aliases to _ih,_oh) so that users which expect
3676 3687 In[5] or Out[7] to work aren't unpleasantly surprised.
3677 3688 (InputList.__getslice__): new class to allow executing slices of
3678 3689 input history directly. Very simple class, complements the use of
3679 3690 macros.
3680 3691
3681 3692 2002-05-16 Fernando Perez <fperez@colorado.edu>
3682 3693
3683 3694 * setup.py (docdirbase): make doc directory be just doc/IPython
3684 3695 without version numbers, it will reduce clutter for users.
3685 3696
3686 3697 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3687 3698 execfile call to prevent possible memory leak. See for details:
3688 3699 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3689 3700
3690 3701 2002-05-15 Fernando Perez <fperez@colorado.edu>
3691 3702
3692 3703 * IPython/Magic.py (Magic.magic_psource): made the object
3693 3704 introspection names be more standard: pdoc, pdef, pfile and
3694 3705 psource. They all print/page their output, and it makes
3695 3706 remembering them easier. Kept old names for compatibility as
3696 3707 aliases.
3697 3708
3698 3709 2002-05-14 Fernando Perez <fperez@colorado.edu>
3699 3710
3700 3711 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3701 3712 what the mouse problem was. The trick is to use gnuplot with temp
3702 3713 files and NOT with pipes (for data communication), because having
3703 3714 both pipes and the mouse on is bad news.
3704 3715
3705 3716 2002-05-13 Fernando Perez <fperez@colorado.edu>
3706 3717
3707 3718 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3708 3719 bug. Information would be reported about builtins even when
3709 3720 user-defined functions overrode them.
3710 3721
3711 3722 2002-05-11 Fernando Perez <fperez@colorado.edu>
3712 3723
3713 3724 * IPython/__init__.py (__all__): removed FlexCompleter from
3714 3725 __all__ so that things don't fail in platforms without readline.
3715 3726
3716 3727 2002-05-10 Fernando Perez <fperez@colorado.edu>
3717 3728
3718 3729 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3719 3730 it requires Numeric, effectively making Numeric a dependency for
3720 3731 IPython.
3721 3732
3722 3733 * Released 0.2.13
3723 3734
3724 3735 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3725 3736 profiler interface. Now all the major options from the profiler
3726 3737 module are directly supported in IPython, both for single
3727 3738 expressions (@prun) and for full programs (@run -p).
3728 3739
3729 3740 2002-05-09 Fernando Perez <fperez@colorado.edu>
3730 3741
3731 3742 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3732 3743 magic properly formatted for screen.
3733 3744
3734 3745 * setup.py (make_shortcut): Changed things to put pdf version in
3735 3746 doc/ instead of doc/manual (had to change lyxport a bit).
3736 3747
3737 3748 * IPython/Magic.py (Profile.string_stats): made profile runs go
3738 3749 through pager (they are long and a pager allows searching, saving,
3739 3750 etc.)
3740 3751
3741 3752 2002-05-08 Fernando Perez <fperez@colorado.edu>
3742 3753
3743 3754 * Released 0.2.12
3744 3755
3745 3756 2002-05-06 Fernando Perez <fperez@colorado.edu>
3746 3757
3747 3758 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3748 3759 introduced); 'hist n1 n2' was broken.
3749 3760 (Magic.magic_pdb): added optional on/off arguments to @pdb
3750 3761 (Magic.magic_run): added option -i to @run, which executes code in
3751 3762 the IPython namespace instead of a clean one. Also added @irun as
3752 3763 an alias to @run -i.
3753 3764
3754 3765 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3755 3766 fixed (it didn't really do anything, the namespaces were wrong).
3756 3767
3757 3768 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3758 3769
3759 3770 * IPython/__init__.py (__all__): Fixed package namespace, now
3760 3771 'import IPython' does give access to IPython.<all> as
3761 3772 expected. Also renamed __release__ to Release.
3762 3773
3763 3774 * IPython/Debugger.py (__license__): created new Pdb class which
3764 3775 functions like a drop-in for the normal pdb.Pdb but does NOT
3765 3776 import readline by default. This way it doesn't muck up IPython's
3766 3777 readline handling, and now tab-completion finally works in the
3767 3778 debugger -- sort of. It completes things globally visible, but the
3768 3779 completer doesn't track the stack as pdb walks it. That's a bit
3769 3780 tricky, and I'll have to implement it later.
3770 3781
3771 3782 2002-05-05 Fernando Perez <fperez@colorado.edu>
3772 3783
3773 3784 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3774 3785 magic docstrings when printed via ? (explicit \'s were being
3775 3786 printed).
3776 3787
3777 3788 * IPython/ipmaker.py (make_IPython): fixed namespace
3778 3789 identification bug. Now variables loaded via logs or command-line
3779 3790 files are recognized in the interactive namespace by @who.
3780 3791
3781 3792 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3782 3793 log replay system stemming from the string form of Structs.
3783 3794
3784 3795 * IPython/Magic.py (Macro.__init__): improved macros to properly
3785 3796 handle magic commands in them.
3786 3797 (Magic.magic_logstart): usernames are now expanded so 'logstart
3787 3798 ~/mylog' now works.
3788 3799
3789 3800 * IPython/iplib.py (complete): fixed bug where paths starting with
3790 3801 '/' would be completed as magic names.
3791 3802
3792 3803 2002-05-04 Fernando Perez <fperez@colorado.edu>
3793 3804
3794 3805 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3795 3806 allow running full programs under the profiler's control.
3796 3807
3797 3808 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3798 3809 mode to report exceptions verbosely but without formatting
3799 3810 variables. This addresses the issue of ipython 'freezing' (it's
3800 3811 not frozen, but caught in an expensive formatting loop) when huge
3801 3812 variables are in the context of an exception.
3802 3813 (VerboseTB.text): Added '--->' markers at line where exception was
3803 3814 triggered. Much clearer to read, especially in NoColor modes.
3804 3815
3805 3816 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3806 3817 implemented in reverse when changing to the new parse_options().
3807 3818
3808 3819 2002-05-03 Fernando Perez <fperez@colorado.edu>
3809 3820
3810 3821 * IPython/Magic.py (Magic.parse_options): new function so that
3811 3822 magics can parse options easier.
3812 3823 (Magic.magic_prun): new function similar to profile.run(),
3813 3824 suggested by Chris Hart.
3814 3825 (Magic.magic_cd): fixed behavior so that it only changes if
3815 3826 directory actually is in history.
3816 3827
3817 3828 * IPython/usage.py (__doc__): added information about potential
3818 3829 slowness of Verbose exception mode when there are huge data
3819 3830 structures to be formatted (thanks to Archie Paulson).
3820 3831
3821 3832 * IPython/ipmaker.py (make_IPython): Changed default logging
3822 3833 (when simply called with -log) to use curr_dir/ipython.log in
3823 3834 rotate mode. Fixed crash which was occuring with -log before
3824 3835 (thanks to Jim Boyle).
3825 3836
3826 3837 2002-05-01 Fernando Perez <fperez@colorado.edu>
3827 3838
3828 3839 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3829 3840 was nasty -- though somewhat of a corner case).
3830 3841
3831 3842 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3832 3843 text (was a bug).
3833 3844
3834 3845 2002-04-30 Fernando Perez <fperez@colorado.edu>
3835 3846
3836 3847 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3837 3848 a print after ^D or ^C from the user so that the In[] prompt
3838 3849 doesn't over-run the gnuplot one.
3839 3850
3840 3851 2002-04-29 Fernando Perez <fperez@colorado.edu>
3841 3852
3842 3853 * Released 0.2.10
3843 3854
3844 3855 * IPython/__release__.py (version): get date dynamically.
3845 3856
3846 3857 * Misc. documentation updates thanks to Arnd's comments. Also ran
3847 3858 a full spellcheck on the manual (hadn't been done in a while).
3848 3859
3849 3860 2002-04-27 Fernando Perez <fperez@colorado.edu>
3850 3861
3851 3862 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3852 3863 starting a log in mid-session would reset the input history list.
3853 3864
3854 3865 2002-04-26 Fernando Perez <fperez@colorado.edu>
3855 3866
3856 3867 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3857 3868 all files were being included in an update. Now anything in
3858 3869 UserConfig that matches [A-Za-z]*.py will go (this excludes
3859 3870 __init__.py)
3860 3871
3861 3872 2002-04-25 Fernando Perez <fperez@colorado.edu>
3862 3873
3863 3874 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3864 3875 to __builtins__ so that any form of embedded or imported code can
3865 3876 test for being inside IPython.
3866 3877
3867 3878 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3868 3879 changed to GnuplotMagic because it's now an importable module,
3869 3880 this makes the name follow that of the standard Gnuplot module.
3870 3881 GnuplotMagic can now be loaded at any time in mid-session.
3871 3882
3872 3883 2002-04-24 Fernando Perez <fperez@colorado.edu>
3873 3884
3874 3885 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3875 3886 the globals (IPython has its own namespace) and the
3876 3887 PhysicalQuantity stuff is much better anyway.
3877 3888
3878 3889 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3879 3890 embedding example to standard user directory for
3880 3891 distribution. Also put it in the manual.
3881 3892
3882 3893 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3883 3894 instance as first argument (so it doesn't rely on some obscure
3884 3895 hidden global).
3885 3896
3886 3897 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3887 3898 delimiters. While it prevents ().TAB from working, it allows
3888 3899 completions in open (... expressions. This is by far a more common
3889 3900 case.
3890 3901
3891 3902 2002-04-23 Fernando Perez <fperez@colorado.edu>
3892 3903
3893 3904 * IPython/Extensions/InterpreterPasteInput.py: new
3894 3905 syntax-processing module for pasting lines with >>> or ... at the
3895 3906 start.
3896 3907
3897 3908 * IPython/Extensions/PhysicalQ_Interactive.py
3898 3909 (PhysicalQuantityInteractive.__int__): fixed to work with either
3899 3910 Numeric or math.
3900 3911
3901 3912 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3902 3913 provided profiles. Now we have:
3903 3914 -math -> math module as * and cmath with its own namespace.
3904 3915 -numeric -> Numeric as *, plus gnuplot & grace
3905 3916 -physics -> same as before
3906 3917
3907 3918 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3908 3919 user-defined magics wouldn't be found by @magic if they were
3909 3920 defined as class methods. Also cleaned up the namespace search
3910 3921 logic and the string building (to use %s instead of many repeated
3911 3922 string adds).
3912 3923
3913 3924 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3914 3925 of user-defined magics to operate with class methods (cleaner, in
3915 3926 line with the gnuplot code).
3916 3927
3917 3928 2002-04-22 Fernando Perez <fperez@colorado.edu>
3918 3929
3919 3930 * setup.py: updated dependency list so that manual is updated when
3920 3931 all included files change.
3921 3932
3922 3933 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3923 3934 the delimiter removal option (the fix is ugly right now).
3924 3935
3925 3936 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3926 3937 all of the math profile (quicker loading, no conflict between
3927 3938 g-9.8 and g-gnuplot).
3928 3939
3929 3940 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3930 3941 name of post-mortem files to IPython_crash_report.txt.
3931 3942
3932 3943 * Cleanup/update of the docs. Added all the new readline info and
3933 3944 formatted all lists as 'real lists'.
3934 3945
3935 3946 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3936 3947 tab-completion options, since the full readline parse_and_bind is
3937 3948 now accessible.
3938 3949
3939 3950 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3940 3951 handling of readline options. Now users can specify any string to
3941 3952 be passed to parse_and_bind(), as well as the delimiters to be
3942 3953 removed.
3943 3954 (InteractiveShell.__init__): Added __name__ to the global
3944 3955 namespace so that things like Itpl which rely on its existence
3945 3956 don't crash.
3946 3957 (InteractiveShell._prefilter): Defined the default with a _ so
3947 3958 that prefilter() is easier to override, while the default one
3948 3959 remains available.
3949 3960
3950 3961 2002-04-18 Fernando Perez <fperez@colorado.edu>
3951 3962
3952 3963 * Added information about pdb in the docs.
3953 3964
3954 3965 2002-04-17 Fernando Perez <fperez@colorado.edu>
3955 3966
3956 3967 * IPython/ipmaker.py (make_IPython): added rc_override option to
3957 3968 allow passing config options at creation time which may override
3958 3969 anything set in the config files or command line. This is
3959 3970 particularly useful for configuring embedded instances.
3960 3971
3961 3972 2002-04-15 Fernando Perez <fperez@colorado.edu>
3962 3973
3963 3974 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3964 3975 crash embedded instances because of the input cache falling out of
3965 3976 sync with the output counter.
3966 3977
3967 3978 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3968 3979 mode which calls pdb after an uncaught exception in IPython itself.
3969 3980
3970 3981 2002-04-14 Fernando Perez <fperez@colorado.edu>
3971 3982
3972 3983 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3973 3984 readline, fix it back after each call.
3974 3985
3975 3986 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3976 3987 method to force all access via __call__(), which guarantees that
3977 3988 traceback references are properly deleted.
3978 3989
3979 3990 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3980 3991 improve printing when pprint is in use.
3981 3992
3982 3993 2002-04-13 Fernando Perez <fperez@colorado.edu>
3983 3994
3984 3995 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3985 3996 exceptions aren't caught anymore. If the user triggers one, he
3986 3997 should know why he's doing it and it should go all the way up,
3987 3998 just like any other exception. So now @abort will fully kill the
3988 3999 embedded interpreter and the embedding code (unless that happens
3989 4000 to catch SystemExit).
3990 4001
3991 4002 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3992 4003 and a debugger() method to invoke the interactive pdb debugger
3993 4004 after printing exception information. Also added the corresponding
3994 4005 -pdb option and @pdb magic to control this feature, and updated
3995 4006 the docs. After a suggestion from Christopher Hart
3996 4007 (hart-AT-caltech.edu).
3997 4008
3998 4009 2002-04-12 Fernando Perez <fperez@colorado.edu>
3999 4010
4000 4011 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4001 4012 the exception handlers defined by the user (not the CrashHandler)
4002 4013 so that user exceptions don't trigger an ipython bug report.
4003 4014
4004 4015 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4005 4016 configurable (it should have always been so).
4006 4017
4007 4018 2002-03-26 Fernando Perez <fperez@colorado.edu>
4008 4019
4009 4020 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4010 4021 and there to fix embedding namespace issues. This should all be
4011 4022 done in a more elegant way.
4012 4023
4013 4024 2002-03-25 Fernando Perez <fperez@colorado.edu>
4014 4025
4015 4026 * IPython/genutils.py (get_home_dir): Try to make it work under
4016 4027 win9x also.
4017 4028
4018 4029 2002-03-20 Fernando Perez <fperez@colorado.edu>
4019 4030
4020 4031 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4021 4032 sys.displayhook untouched upon __init__.
4022 4033
4023 4034 2002-03-19 Fernando Perez <fperez@colorado.edu>
4024 4035
4025 4036 * Released 0.2.9 (for embedding bug, basically).
4026 4037
4027 4038 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4028 4039 exceptions so that enclosing shell's state can be restored.
4029 4040
4030 4041 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4031 4042 naming conventions in the .ipython/ dir.
4032 4043
4033 4044 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4034 4045 from delimiters list so filenames with - in them get expanded.
4035 4046
4036 4047 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4037 4048 sys.displayhook not being properly restored after an embedded call.
4038 4049
4039 4050 2002-03-18 Fernando Perez <fperez@colorado.edu>
4040 4051
4041 4052 * Released 0.2.8
4042 4053
4043 4054 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4044 4055 some files weren't being included in a -upgrade.
4045 4056 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4046 4057 on' so that the first tab completes.
4047 4058 (InteractiveShell.handle_magic): fixed bug with spaces around
4048 4059 quotes breaking many magic commands.
4049 4060
4050 4061 * setup.py: added note about ignoring the syntax error messages at
4051 4062 installation.
4052 4063
4053 4064 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4054 4065 streamlining the gnuplot interface, now there's only one magic @gp.
4055 4066
4056 4067 2002-03-17 Fernando Perez <fperez@colorado.edu>
4057 4068
4058 4069 * IPython/UserConfig/magic_gnuplot.py: new name for the
4059 4070 example-magic_pm.py file. Much enhanced system, now with a shell
4060 4071 for communicating directly with gnuplot, one command at a time.
4061 4072
4062 4073 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4063 4074 setting __name__=='__main__'.
4064 4075
4065 4076 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4066 4077 mini-shell for accessing gnuplot from inside ipython. Should
4067 4078 extend it later for grace access too. Inspired by Arnd's
4068 4079 suggestion.
4069 4080
4070 4081 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4071 4082 calling magic functions with () in their arguments. Thanks to Arnd
4072 4083 Baecker for pointing this to me.
4073 4084
4074 4085 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4075 4086 infinitely for integer or complex arrays (only worked with floats).
4076 4087
4077 4088 2002-03-16 Fernando Perez <fperez@colorado.edu>
4078 4089
4079 4090 * setup.py: Merged setup and setup_windows into a single script
4080 4091 which properly handles things for windows users.
4081 4092
4082 4093 2002-03-15 Fernando Perez <fperez@colorado.edu>
4083 4094
4084 4095 * Big change to the manual: now the magics are all automatically
4085 4096 documented. This information is generated from their docstrings
4086 4097 and put in a latex file included by the manual lyx file. This way
4087 4098 we get always up to date information for the magics. The manual
4088 4099 now also has proper version information, also auto-synced.
4089 4100
4090 4101 For this to work, an undocumented --magic_docstrings option was added.
4091 4102
4092 4103 2002-03-13 Fernando Perez <fperez@colorado.edu>
4093 4104
4094 4105 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4095 4106 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4096 4107
4097 4108 2002-03-12 Fernando Perez <fperez@colorado.edu>
4098 4109
4099 4110 * IPython/ultraTB.py (TermColors): changed color escapes again to
4100 4111 fix the (old, reintroduced) line-wrapping bug. Basically, if
4101 4112 \001..\002 aren't given in the color escapes, lines get wrapped
4102 4113 weirdly. But giving those screws up old xterms and emacs terms. So
4103 4114 I added some logic for emacs terms to be ok, but I can't identify old
4104 4115 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4105 4116
4106 4117 2002-03-10 Fernando Perez <fperez@colorado.edu>
4107 4118
4108 4119 * IPython/usage.py (__doc__): Various documentation cleanups and
4109 4120 updates, both in usage docstrings and in the manual.
4110 4121
4111 4122 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4112 4123 handling of caching. Set minimum acceptabe value for having a
4113 4124 cache at 20 values.
4114 4125
4115 4126 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4116 4127 install_first_time function to a method, renamed it and added an
4117 4128 'upgrade' mode. Now people can update their config directory with
4118 4129 a simple command line switch (-upgrade, also new).
4119 4130
4120 4131 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4121 4132 @file (convenient for automagic users under Python >= 2.2).
4122 4133 Removed @files (it seemed more like a plural than an abbrev. of
4123 4134 'file show').
4124 4135
4125 4136 * IPython/iplib.py (install_first_time): Fixed crash if there were
4126 4137 backup files ('~') in .ipython/ install directory.
4127 4138
4128 4139 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4129 4140 system. Things look fine, but these changes are fairly
4130 4141 intrusive. Test them for a few days.
4131 4142
4132 4143 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4133 4144 the prompts system. Now all in/out prompt strings are user
4134 4145 controllable. This is particularly useful for embedding, as one
4135 4146 can tag embedded instances with particular prompts.
4136 4147
4137 4148 Also removed global use of sys.ps1/2, which now allows nested
4138 4149 embeddings without any problems. Added command-line options for
4139 4150 the prompt strings.
4140 4151
4141 4152 2002-03-08 Fernando Perez <fperez@colorado.edu>
4142 4153
4143 4154 * IPython/UserConfig/example-embed-short.py (ipshell): added
4144 4155 example file with the bare minimum code for embedding.
4145 4156
4146 4157 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4147 4158 functionality for the embeddable shell to be activated/deactivated
4148 4159 either globally or at each call.
4149 4160
4150 4161 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4151 4162 rewriting the prompt with '--->' for auto-inputs with proper
4152 4163 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4153 4164 this is handled by the prompts class itself, as it should.
4154 4165
4155 4166 2002-03-05 Fernando Perez <fperez@colorado.edu>
4156 4167
4157 4168 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4158 4169 @logstart to avoid name clashes with the math log function.
4159 4170
4160 4171 * Big updates to X/Emacs section of the manual.
4161 4172
4162 4173 * Removed ipython_emacs. Milan explained to me how to pass
4163 4174 arguments to ipython through Emacs. Some day I'm going to end up
4164 4175 learning some lisp...
4165 4176
4166 4177 2002-03-04 Fernando Perez <fperez@colorado.edu>
4167 4178
4168 4179 * IPython/ipython_emacs: Created script to be used as the
4169 4180 py-python-command Emacs variable so we can pass IPython
4170 4181 parameters. I can't figure out how to tell Emacs directly to pass
4171 4182 parameters to IPython, so a dummy shell script will do it.
4172 4183
4173 4184 Other enhancements made for things to work better under Emacs'
4174 4185 various types of terminals. Many thanks to Milan Zamazal
4175 4186 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4176 4187
4177 4188 2002-03-01 Fernando Perez <fperez@colorado.edu>
4178 4189
4179 4190 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4180 4191 that loading of readline is now optional. This gives better
4181 4192 control to emacs users.
4182 4193
4183 4194 * IPython/ultraTB.py (__date__): Modified color escape sequences
4184 4195 and now things work fine under xterm and in Emacs' term buffers
4185 4196 (though not shell ones). Well, in emacs you get colors, but all
4186 4197 seem to be 'light' colors (no difference between dark and light
4187 4198 ones). But the garbage chars are gone, and also in xterms. It
4188 4199 seems that now I'm using 'cleaner' ansi sequences.
4189 4200
4190 4201 2002-02-21 Fernando Perez <fperez@colorado.edu>
4191 4202
4192 4203 * Released 0.2.7 (mainly to publish the scoping fix).
4193 4204
4194 4205 * IPython/Logger.py (Logger.logstate): added. A corresponding
4195 4206 @logstate magic was created.
4196 4207
4197 4208 * IPython/Magic.py: fixed nested scoping problem under Python
4198 4209 2.1.x (automagic wasn't working).
4199 4210
4200 4211 2002-02-20 Fernando Perez <fperez@colorado.edu>
4201 4212
4202 4213 * Released 0.2.6.
4203 4214
4204 4215 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4205 4216 option so that logs can come out without any headers at all.
4206 4217
4207 4218 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4208 4219 SciPy.
4209 4220
4210 4221 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4211 4222 that embedded IPython calls don't require vars() to be explicitly
4212 4223 passed. Now they are extracted from the caller's frame (code
4213 4224 snatched from Eric Jones' weave). Added better documentation to
4214 4225 the section on embedding and the example file.
4215 4226
4216 4227 * IPython/genutils.py (page): Changed so that under emacs, it just
4217 4228 prints the string. You can then page up and down in the emacs
4218 4229 buffer itself. This is how the builtin help() works.
4219 4230
4220 4231 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4221 4232 macro scoping: macros need to be executed in the user's namespace
4222 4233 to work as if they had been typed by the user.
4223 4234
4224 4235 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4225 4236 execute automatically (no need to type 'exec...'). They then
4226 4237 behave like 'true macros'. The printing system was also modified
4227 4238 for this to work.
4228 4239
4229 4240 2002-02-19 Fernando Perez <fperez@colorado.edu>
4230 4241
4231 4242 * IPython/genutils.py (page_file): new function for paging files
4232 4243 in an OS-independent way. Also necessary for file viewing to work
4233 4244 well inside Emacs buffers.
4234 4245 (page): Added checks for being in an emacs buffer.
4235 4246 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4236 4247 same bug in iplib.
4237 4248
4238 4249 2002-02-18 Fernando Perez <fperez@colorado.edu>
4239 4250
4240 4251 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4241 4252 of readline so that IPython can work inside an Emacs buffer.
4242 4253
4243 4254 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4244 4255 method signatures (they weren't really bugs, but it looks cleaner
4245 4256 and keeps PyChecker happy).
4246 4257
4247 4258 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4248 4259 for implementing various user-defined hooks. Currently only
4249 4260 display is done.
4250 4261
4251 4262 * IPython/Prompts.py (CachedOutput._display): changed display
4252 4263 functions so that they can be dynamically changed by users easily.
4253 4264
4254 4265 * IPython/Extensions/numeric_formats.py (num_display): added an
4255 4266 extension for printing NumPy arrays in flexible manners. It
4256 4267 doesn't do anything yet, but all the structure is in
4257 4268 place. Ultimately the plan is to implement output format control
4258 4269 like in Octave.
4259 4270
4260 4271 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4261 4272 methods are found at run-time by all the automatic machinery.
4262 4273
4263 4274 2002-02-17 Fernando Perez <fperez@colorado.edu>
4264 4275
4265 4276 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4266 4277 whole file a little.
4267 4278
4268 4279 * ToDo: closed this document. Now there's a new_design.lyx
4269 4280 document for all new ideas. Added making a pdf of it for the
4270 4281 end-user distro.
4271 4282
4272 4283 * IPython/Logger.py (Logger.switch_log): Created this to replace
4273 4284 logon() and logoff(). It also fixes a nasty crash reported by
4274 4285 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4275 4286
4276 4287 * IPython/iplib.py (complete): got auto-completion to work with
4277 4288 automagic (I had wanted this for a long time).
4278 4289
4279 4290 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4280 4291 to @file, since file() is now a builtin and clashes with automagic
4281 4292 for @file.
4282 4293
4283 4294 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4284 4295 of this was previously in iplib, which had grown to more than 2000
4285 4296 lines, way too long. No new functionality, but it makes managing
4286 4297 the code a bit easier.
4287 4298
4288 4299 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4289 4300 information to crash reports.
4290 4301
4291 4302 2002-02-12 Fernando Perez <fperez@colorado.edu>
4292 4303
4293 4304 * Released 0.2.5.
4294 4305
4295 4306 2002-02-11 Fernando Perez <fperez@colorado.edu>
4296 4307
4297 4308 * Wrote a relatively complete Windows installer. It puts
4298 4309 everything in place, creates Start Menu entries and fixes the
4299 4310 color issues. Nothing fancy, but it works.
4300 4311
4301 4312 2002-02-10 Fernando Perez <fperez@colorado.edu>
4302 4313
4303 4314 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4304 4315 os.path.expanduser() call so that we can type @run ~/myfile.py and
4305 4316 have thigs work as expected.
4306 4317
4307 4318 * IPython/genutils.py (page): fixed exception handling so things
4308 4319 work both in Unix and Windows correctly. Quitting a pager triggers
4309 4320 an IOError/broken pipe in Unix, and in windows not finding a pager
4310 4321 is also an IOError, so I had to actually look at the return value
4311 4322 of the exception, not just the exception itself. Should be ok now.
4312 4323
4313 4324 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4314 4325 modified to allow case-insensitive color scheme changes.
4315 4326
4316 4327 2002-02-09 Fernando Perez <fperez@colorado.edu>
4317 4328
4318 4329 * IPython/genutils.py (native_line_ends): new function to leave
4319 4330 user config files with os-native line-endings.
4320 4331
4321 4332 * README and manual updates.
4322 4333
4323 4334 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4324 4335 instead of StringType to catch Unicode strings.
4325 4336
4326 4337 * IPython/genutils.py (filefind): fixed bug for paths with
4327 4338 embedded spaces (very common in Windows).
4328 4339
4329 4340 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4330 4341 files under Windows, so that they get automatically associated
4331 4342 with a text editor. Windows makes it a pain to handle
4332 4343 extension-less files.
4333 4344
4334 4345 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4335 4346 warning about readline only occur for Posix. In Windows there's no
4336 4347 way to get readline, so why bother with the warning.
4337 4348
4338 4349 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4339 4350 for __str__ instead of dir(self), since dir() changed in 2.2.
4340 4351
4341 4352 * Ported to Windows! Tested on XP, I suspect it should work fine
4342 4353 on NT/2000, but I don't think it will work on 98 et al. That
4343 4354 series of Windows is such a piece of junk anyway that I won't try
4344 4355 porting it there. The XP port was straightforward, showed a few
4345 4356 bugs here and there (fixed all), in particular some string
4346 4357 handling stuff which required considering Unicode strings (which
4347 4358 Windows uses). This is good, but hasn't been too tested :) No
4348 4359 fancy installer yet, I'll put a note in the manual so people at
4349 4360 least make manually a shortcut.
4350 4361
4351 4362 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4352 4363 into a single one, "colors". This now controls both prompt and
4353 4364 exception color schemes, and can be changed both at startup
4354 4365 (either via command-line switches or via ipythonrc files) and at
4355 4366 runtime, with @colors.
4356 4367 (Magic.magic_run): renamed @prun to @run and removed the old
4357 4368 @run. The two were too similar to warrant keeping both.
4358 4369
4359 4370 2002-02-03 Fernando Perez <fperez@colorado.edu>
4360 4371
4361 4372 * IPython/iplib.py (install_first_time): Added comment on how to
4362 4373 configure the color options for first-time users. Put a <return>
4363 4374 request at the end so that small-terminal users get a chance to
4364 4375 read the startup info.
4365 4376
4366 4377 2002-01-23 Fernando Perez <fperez@colorado.edu>
4367 4378
4368 4379 * IPython/iplib.py (CachedOutput.update): Changed output memory
4369 4380 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4370 4381 input history we still use _i. Did this b/c these variable are
4371 4382 very commonly used in interactive work, so the less we need to
4372 4383 type the better off we are.
4373 4384 (Magic.magic_prun): updated @prun to better handle the namespaces
4374 4385 the file will run in, including a fix for __name__ not being set
4375 4386 before.
4376 4387
4377 4388 2002-01-20 Fernando Perez <fperez@colorado.edu>
4378 4389
4379 4390 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4380 4391 extra garbage for Python 2.2. Need to look more carefully into
4381 4392 this later.
4382 4393
4383 4394 2002-01-19 Fernando Perez <fperez@colorado.edu>
4384 4395
4385 4396 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4386 4397 display SyntaxError exceptions properly formatted when they occur
4387 4398 (they can be triggered by imported code).
4388 4399
4389 4400 2002-01-18 Fernando Perez <fperez@colorado.edu>
4390 4401
4391 4402 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4392 4403 SyntaxError exceptions are reported nicely formatted, instead of
4393 4404 spitting out only offset information as before.
4394 4405 (Magic.magic_prun): Added the @prun function for executing
4395 4406 programs with command line args inside IPython.
4396 4407
4397 4408 2002-01-16 Fernando Perez <fperez@colorado.edu>
4398 4409
4399 4410 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4400 4411 to *not* include the last item given in a range. This brings their
4401 4412 behavior in line with Python's slicing:
4402 4413 a[n1:n2] -> a[n1]...a[n2-1]
4403 4414 It may be a bit less convenient, but I prefer to stick to Python's
4404 4415 conventions *everywhere*, so users never have to wonder.
4405 4416 (Magic.magic_macro): Added @macro function to ease the creation of
4406 4417 macros.
4407 4418
4408 4419 2002-01-05 Fernando Perez <fperez@colorado.edu>
4409 4420
4410 4421 * Released 0.2.4.
4411 4422
4412 4423 * IPython/iplib.py (Magic.magic_pdef):
4413 4424 (InteractiveShell.safe_execfile): report magic lines and error
4414 4425 lines without line numbers so one can easily copy/paste them for
4415 4426 re-execution.
4416 4427
4417 4428 * Updated manual with recent changes.
4418 4429
4419 4430 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4420 4431 docstring printing when class? is called. Very handy for knowing
4421 4432 how to create class instances (as long as __init__ is well
4422 4433 documented, of course :)
4423 4434 (Magic.magic_doc): print both class and constructor docstrings.
4424 4435 (Magic.magic_pdef): give constructor info if passed a class and
4425 4436 __call__ info for callable object instances.
4426 4437
4427 4438 2002-01-04 Fernando Perez <fperez@colorado.edu>
4428 4439
4429 4440 * Made deep_reload() off by default. It doesn't always work
4430 4441 exactly as intended, so it's probably safer to have it off. It's
4431 4442 still available as dreload() anyway, so nothing is lost.
4432 4443
4433 4444 2002-01-02 Fernando Perez <fperez@colorado.edu>
4434 4445
4435 4446 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4436 4447 so I wanted an updated release).
4437 4448
4438 4449 2001-12-27 Fernando Perez <fperez@colorado.edu>
4439 4450
4440 4451 * IPython/iplib.py (InteractiveShell.interact): Added the original
4441 4452 code from 'code.py' for this module in order to change the
4442 4453 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4443 4454 the history cache would break when the user hit Ctrl-C, and
4444 4455 interact() offers no way to add any hooks to it.
4445 4456
4446 4457 2001-12-23 Fernando Perez <fperez@colorado.edu>
4447 4458
4448 4459 * setup.py: added check for 'MANIFEST' before trying to remove
4449 4460 it. Thanks to Sean Reifschneider.
4450 4461
4451 4462 2001-12-22 Fernando Perez <fperez@colorado.edu>
4452 4463
4453 4464 * Released 0.2.2.
4454 4465
4455 4466 * Finished (reasonably) writing the manual. Later will add the
4456 4467 python-standard navigation stylesheets, but for the time being
4457 4468 it's fairly complete. Distribution will include html and pdf
4458 4469 versions.
4459 4470
4460 4471 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4461 4472 (MayaVi author).
4462 4473
4463 4474 2001-12-21 Fernando Perez <fperez@colorado.edu>
4464 4475
4465 4476 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4466 4477 good public release, I think (with the manual and the distutils
4467 4478 installer). The manual can use some work, but that can go
4468 4479 slowly. Otherwise I think it's quite nice for end users. Next
4469 4480 summer, rewrite the guts of it...
4470 4481
4471 4482 * Changed format of ipythonrc files to use whitespace as the
4472 4483 separator instead of an explicit '='. Cleaner.
4473 4484
4474 4485 2001-12-20 Fernando Perez <fperez@colorado.edu>
4475 4486
4476 4487 * Started a manual in LyX. For now it's just a quick merge of the
4477 4488 various internal docstrings and READMEs. Later it may grow into a
4478 4489 nice, full-blown manual.
4479 4490
4480 4491 * Set up a distutils based installer. Installation should now be
4481 4492 trivially simple for end-users.
4482 4493
4483 4494 2001-12-11 Fernando Perez <fperez@colorado.edu>
4484 4495
4485 4496 * Released 0.2.0. First public release, announced it at
4486 4497 comp.lang.python. From now on, just bugfixes...
4487 4498
4488 4499 * Went through all the files, set copyright/license notices and
4489 4500 cleaned up things. Ready for release.
4490 4501
4491 4502 2001-12-10 Fernando Perez <fperez@colorado.edu>
4492 4503
4493 4504 * Changed the first-time installer not to use tarfiles. It's more
4494 4505 robust now and less unix-dependent. Also makes it easier for
4495 4506 people to later upgrade versions.
4496 4507
4497 4508 * Changed @exit to @abort to reflect the fact that it's pretty
4498 4509 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4499 4510 becomes significant only when IPyhton is embedded: in that case,
4500 4511 C-D closes IPython only, but @abort kills the enclosing program
4501 4512 too (unless it had called IPython inside a try catching
4502 4513 SystemExit).
4503 4514
4504 4515 * Created Shell module which exposes the actuall IPython Shell
4505 4516 classes, currently the normal and the embeddable one. This at
4506 4517 least offers a stable interface we won't need to change when
4507 4518 (later) the internals are rewritten. That rewrite will be confined
4508 4519 to iplib and ipmaker, but the Shell interface should remain as is.
4509 4520
4510 4521 * Added embed module which offers an embeddable IPShell object,
4511 4522 useful to fire up IPython *inside* a running program. Great for
4512 4523 debugging or dynamical data analysis.
4513 4524
4514 4525 2001-12-08 Fernando Perez <fperez@colorado.edu>
4515 4526
4516 4527 * Fixed small bug preventing seeing info from methods of defined
4517 4528 objects (incorrect namespace in _ofind()).
4518 4529
4519 4530 * Documentation cleanup. Moved the main usage docstrings to a
4520 4531 separate file, usage.py (cleaner to maintain, and hopefully in the
4521 4532 future some perlpod-like way of producing interactive, man and
4522 4533 html docs out of it will be found).
4523 4534
4524 4535 * Added @profile to see your profile at any time.
4525 4536
4526 4537 * Added @p as an alias for 'print'. It's especially convenient if
4527 4538 using automagic ('p x' prints x).
4528 4539
4529 4540 * Small cleanups and fixes after a pychecker run.
4530 4541
4531 4542 * Changed the @cd command to handle @cd - and @cd -<n> for
4532 4543 visiting any directory in _dh.
4533 4544
4534 4545 * Introduced _dh, a history of visited directories. @dhist prints
4535 4546 it out with numbers.
4536 4547
4537 4548 2001-12-07 Fernando Perez <fperez@colorado.edu>
4538 4549
4539 4550 * Released 0.1.22
4540 4551
4541 4552 * Made initialization a bit more robust against invalid color
4542 4553 options in user input (exit, not traceback-crash).
4543 4554
4544 4555 * Changed the bug crash reporter to write the report only in the
4545 4556 user's .ipython directory. That way IPython won't litter people's
4546 4557 hard disks with crash files all over the place. Also print on
4547 4558 screen the necessary mail command.
4548 4559
4549 4560 * With the new ultraTB, implemented LightBG color scheme for light
4550 4561 background terminals. A lot of people like white backgrounds, so I
4551 4562 guess we should at least give them something readable.
4552 4563
4553 4564 2001-12-06 Fernando Perez <fperez@colorado.edu>
4554 4565
4555 4566 * Modified the structure of ultraTB. Now there's a proper class
4556 4567 for tables of color schemes which allow adding schemes easily and
4557 4568 switching the active scheme without creating a new instance every
4558 4569 time (which was ridiculous). The syntax for creating new schemes
4559 4570 is also cleaner. I think ultraTB is finally done, with a clean
4560 4571 class structure. Names are also much cleaner (now there's proper
4561 4572 color tables, no need for every variable to also have 'color' in
4562 4573 its name).
4563 4574
4564 4575 * Broke down genutils into separate files. Now genutils only
4565 4576 contains utility functions, and classes have been moved to their
4566 4577 own files (they had enough independent functionality to warrant
4567 4578 it): ConfigLoader, OutputTrap, Struct.
4568 4579
4569 4580 2001-12-05 Fernando Perez <fperez@colorado.edu>
4570 4581
4571 4582 * IPython turns 21! Released version 0.1.21, as a candidate for
4572 4583 public consumption. If all goes well, release in a few days.
4573 4584
4574 4585 * Fixed path bug (files in Extensions/ directory wouldn't be found
4575 4586 unless IPython/ was explicitly in sys.path).
4576 4587
4577 4588 * Extended the FlexCompleter class as MagicCompleter to allow
4578 4589 completion of @-starting lines.
4579 4590
4580 4591 * Created __release__.py file as a central repository for release
4581 4592 info that other files can read from.
4582 4593
4583 4594 * Fixed small bug in logging: when logging was turned on in
4584 4595 mid-session, old lines with special meanings (!@?) were being
4585 4596 logged without the prepended comment, which is necessary since
4586 4597 they are not truly valid python syntax. This should make session
4587 4598 restores produce less errors.
4588 4599
4589 4600 * The namespace cleanup forced me to make a FlexCompleter class
4590 4601 which is nothing but a ripoff of rlcompleter, but with selectable
4591 4602 namespace (rlcompleter only works in __main__.__dict__). I'll try
4592 4603 to submit a note to the authors to see if this change can be
4593 4604 incorporated in future rlcompleter releases (Dec.6: done)
4594 4605
4595 4606 * More fixes to namespace handling. It was a mess! Now all
4596 4607 explicit references to __main__.__dict__ are gone (except when
4597 4608 really needed) and everything is handled through the namespace
4598 4609 dicts in the IPython instance. We seem to be getting somewhere
4599 4610 with this, finally...
4600 4611
4601 4612 * Small documentation updates.
4602 4613
4603 4614 * Created the Extensions directory under IPython (with an
4604 4615 __init__.py). Put the PhysicalQ stuff there. This directory should
4605 4616 be used for all special-purpose extensions.
4606 4617
4607 4618 * File renaming:
4608 4619 ipythonlib --> ipmaker
4609 4620 ipplib --> iplib
4610 4621 This makes a bit more sense in terms of what these files actually do.
4611 4622
4612 4623 * Moved all the classes and functions in ipythonlib to ipplib, so
4613 4624 now ipythonlib only has make_IPython(). This will ease up its
4614 4625 splitting in smaller functional chunks later.
4615 4626
4616 4627 * Cleaned up (done, I think) output of @whos. Better column
4617 4628 formatting, and now shows str(var) for as much as it can, which is
4618 4629 typically what one gets with a 'print var'.
4619 4630
4620 4631 2001-12-04 Fernando Perez <fperez@colorado.edu>
4621 4632
4622 4633 * Fixed namespace problems. Now builtin/IPyhton/user names get
4623 4634 properly reported in their namespace. Internal namespace handling
4624 4635 is finally getting decent (not perfect yet, but much better than
4625 4636 the ad-hoc mess we had).
4626 4637
4627 4638 * Removed -exit option. If people just want to run a python
4628 4639 script, that's what the normal interpreter is for. Less
4629 4640 unnecessary options, less chances for bugs.
4630 4641
4631 4642 * Added a crash handler which generates a complete post-mortem if
4632 4643 IPython crashes. This will help a lot in tracking bugs down the
4633 4644 road.
4634 4645
4635 4646 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4636 4647 which were boud to functions being reassigned would bypass the
4637 4648 logger, breaking the sync of _il with the prompt counter. This
4638 4649 would then crash IPython later when a new line was logged.
4639 4650
4640 4651 2001-12-02 Fernando Perez <fperez@colorado.edu>
4641 4652
4642 4653 * Made IPython a package. This means people don't have to clutter
4643 4654 their sys.path with yet another directory. Changed the INSTALL
4644 4655 file accordingly.
4645 4656
4646 4657 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4647 4658 sorts its output (so @who shows it sorted) and @whos formats the
4648 4659 table according to the width of the first column. Nicer, easier to
4649 4660 read. Todo: write a generic table_format() which takes a list of
4650 4661 lists and prints it nicely formatted, with optional row/column
4651 4662 separators and proper padding and justification.
4652 4663
4653 4664 * Released 0.1.20
4654 4665
4655 4666 * Fixed bug in @log which would reverse the inputcache list (a
4656 4667 copy operation was missing).
4657 4668
4658 4669 * Code cleanup. @config was changed to use page(). Better, since
4659 4670 its output is always quite long.
4660 4671
4661 4672 * Itpl is back as a dependency. I was having too many problems
4662 4673 getting the parametric aliases to work reliably, and it's just
4663 4674 easier to code weird string operations with it than playing %()s
4664 4675 games. It's only ~6k, so I don't think it's too big a deal.
4665 4676
4666 4677 * Found (and fixed) a very nasty bug with history. !lines weren't
4667 4678 getting cached, and the out of sync caches would crash
4668 4679 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4669 4680 division of labor a bit better. Bug fixed, cleaner structure.
4670 4681
4671 4682 2001-12-01 Fernando Perez <fperez@colorado.edu>
4672 4683
4673 4684 * Released 0.1.19
4674 4685
4675 4686 * Added option -n to @hist to prevent line number printing. Much
4676 4687 easier to copy/paste code this way.
4677 4688
4678 4689 * Created global _il to hold the input list. Allows easy
4679 4690 re-execution of blocks of code by slicing it (inspired by Janko's
4680 4691 comment on 'macros').
4681 4692
4682 4693 * Small fixes and doc updates.
4683 4694
4684 4695 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4685 4696 much too fragile with automagic. Handles properly multi-line
4686 4697 statements and takes parameters.
4687 4698
4688 4699 2001-11-30 Fernando Perez <fperez@colorado.edu>
4689 4700
4690 4701 * Version 0.1.18 released.
4691 4702
4692 4703 * Fixed nasty namespace bug in initial module imports.
4693 4704
4694 4705 * Added copyright/license notes to all code files (except
4695 4706 DPyGetOpt). For the time being, LGPL. That could change.
4696 4707
4697 4708 * Rewrote a much nicer README, updated INSTALL, cleaned up
4698 4709 ipythonrc-* samples.
4699 4710
4700 4711 * Overall code/documentation cleanup. Basically ready for
4701 4712 release. Only remaining thing: licence decision (LGPL?).
4702 4713
4703 4714 * Converted load_config to a class, ConfigLoader. Now recursion
4704 4715 control is better organized. Doesn't include the same file twice.
4705 4716
4706 4717 2001-11-29 Fernando Perez <fperez@colorado.edu>
4707 4718
4708 4719 * Got input history working. Changed output history variables from
4709 4720 _p to _o so that _i is for input and _o for output. Just cleaner
4710 4721 convention.
4711 4722
4712 4723 * Implemented parametric aliases. This pretty much allows the
4713 4724 alias system to offer full-blown shell convenience, I think.
4714 4725
4715 4726 * Version 0.1.17 released, 0.1.18 opened.
4716 4727
4717 4728 * dot_ipython/ipythonrc (alias): added documentation.
4718 4729 (xcolor): Fixed small bug (xcolors -> xcolor)
4719 4730
4720 4731 * Changed the alias system. Now alias is a magic command to define
4721 4732 aliases just like the shell. Rationale: the builtin magics should
4722 4733 be there for things deeply connected to IPython's
4723 4734 architecture. And this is a much lighter system for what I think
4724 4735 is the really important feature: allowing users to define quickly
4725 4736 magics that will do shell things for them, so they can customize
4726 4737 IPython easily to match their work habits. If someone is really
4727 4738 desperate to have another name for a builtin alias, they can
4728 4739 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4729 4740 works.
4730 4741
4731 4742 2001-11-28 Fernando Perez <fperez@colorado.edu>
4732 4743
4733 4744 * Changed @file so that it opens the source file at the proper
4734 4745 line. Since it uses less, if your EDITOR environment is
4735 4746 configured, typing v will immediately open your editor of choice
4736 4747 right at the line where the object is defined. Not as quick as
4737 4748 having a direct @edit command, but for all intents and purposes it
4738 4749 works. And I don't have to worry about writing @edit to deal with
4739 4750 all the editors, less does that.
4740 4751
4741 4752 * Version 0.1.16 released, 0.1.17 opened.
4742 4753
4743 4754 * Fixed some nasty bugs in the page/page_dumb combo that could
4744 4755 crash IPython.
4745 4756
4746 4757 2001-11-27 Fernando Perez <fperez@colorado.edu>
4747 4758
4748 4759 * Version 0.1.15 released, 0.1.16 opened.
4749 4760
4750 4761 * Finally got ? and ?? to work for undefined things: now it's
4751 4762 possible to type {}.get? and get information about the get method
4752 4763 of dicts, or os.path? even if only os is defined (so technically
4753 4764 os.path isn't). Works at any level. For example, after import os,
4754 4765 os?, os.path?, os.path.abspath? all work. This is great, took some
4755 4766 work in _ofind.
4756 4767
4757 4768 * Fixed more bugs with logging. The sanest way to do it was to add
4758 4769 to @log a 'mode' parameter. Killed two in one shot (this mode
4759 4770 option was a request of Janko's). I think it's finally clean
4760 4771 (famous last words).
4761 4772
4762 4773 * Added a page_dumb() pager which does a decent job of paging on
4763 4774 screen, if better things (like less) aren't available. One less
4764 4775 unix dependency (someday maybe somebody will port this to
4765 4776 windows).
4766 4777
4767 4778 * Fixed problem in magic_log: would lock of logging out if log
4768 4779 creation failed (because it would still think it had succeeded).
4769 4780
4770 4781 * Improved the page() function using curses to auto-detect screen
4771 4782 size. Now it can make a much better decision on whether to print
4772 4783 or page a string. Option screen_length was modified: a value 0
4773 4784 means auto-detect, and that's the default now.
4774 4785
4775 4786 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4776 4787 go out. I'll test it for a few days, then talk to Janko about
4777 4788 licences and announce it.
4778 4789
4779 4790 * Fixed the length of the auto-generated ---> prompt which appears
4780 4791 for auto-parens and auto-quotes. Getting this right isn't trivial,
4781 4792 with all the color escapes, different prompt types and optional
4782 4793 separators. But it seems to be working in all the combinations.
4783 4794
4784 4795 2001-11-26 Fernando Perez <fperez@colorado.edu>
4785 4796
4786 4797 * Wrote a regexp filter to get option types from the option names
4787 4798 string. This eliminates the need to manually keep two duplicate
4788 4799 lists.
4789 4800
4790 4801 * Removed the unneeded check_option_names. Now options are handled
4791 4802 in a much saner manner and it's easy to visually check that things
4792 4803 are ok.
4793 4804
4794 4805 * Updated version numbers on all files I modified to carry a
4795 4806 notice so Janko and Nathan have clear version markers.
4796 4807
4797 4808 * Updated docstring for ultraTB with my changes. I should send
4798 4809 this to Nathan.
4799 4810
4800 4811 * Lots of small fixes. Ran everything through pychecker again.
4801 4812
4802 4813 * Made loading of deep_reload an cmd line option. If it's not too
4803 4814 kosher, now people can just disable it. With -nodeep_reload it's
4804 4815 still available as dreload(), it just won't overwrite reload().
4805 4816
4806 4817 * Moved many options to the no| form (-opt and -noopt
4807 4818 accepted). Cleaner.
4808 4819
4809 4820 * Changed magic_log so that if called with no parameters, it uses
4810 4821 'rotate' mode. That way auto-generated logs aren't automatically
4811 4822 over-written. For normal logs, now a backup is made if it exists
4812 4823 (only 1 level of backups). A new 'backup' mode was added to the
4813 4824 Logger class to support this. This was a request by Janko.
4814 4825
4815 4826 * Added @logoff/@logon to stop/restart an active log.
4816 4827
4817 4828 * Fixed a lot of bugs in log saving/replay. It was pretty
4818 4829 broken. Now special lines (!@,/) appear properly in the command
4819 4830 history after a log replay.
4820 4831
4821 4832 * Tried and failed to implement full session saving via pickle. My
4822 4833 idea was to pickle __main__.__dict__, but modules can't be
4823 4834 pickled. This would be a better alternative to replaying logs, but
4824 4835 seems quite tricky to get to work. Changed -session to be called
4825 4836 -logplay, which more accurately reflects what it does. And if we
4826 4837 ever get real session saving working, -session is now available.
4827 4838
4828 4839 * Implemented color schemes for prompts also. As for tracebacks,
4829 4840 currently only NoColor and Linux are supported. But now the
4830 4841 infrastructure is in place, based on a generic ColorScheme
4831 4842 class. So writing and activating new schemes both for the prompts
4832 4843 and the tracebacks should be straightforward.
4833 4844
4834 4845 * Version 0.1.13 released, 0.1.14 opened.
4835 4846
4836 4847 * Changed handling of options for output cache. Now counter is
4837 4848 hardwired starting at 1 and one specifies the maximum number of
4838 4849 entries *in the outcache* (not the max prompt counter). This is
4839 4850 much better, since many statements won't increase the cache
4840 4851 count. It also eliminated some confusing options, now there's only
4841 4852 one: cache_size.
4842 4853
4843 4854 * Added 'alias' magic function and magic_alias option in the
4844 4855 ipythonrc file. Now the user can easily define whatever names he
4845 4856 wants for the magic functions without having to play weird
4846 4857 namespace games. This gives IPython a real shell-like feel.
4847 4858
4848 4859 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4849 4860 @ or not).
4850 4861
4851 4862 This was one of the last remaining 'visible' bugs (that I know
4852 4863 of). I think if I can clean up the session loading so it works
4853 4864 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4854 4865 about licensing).
4855 4866
4856 4867 2001-11-25 Fernando Perez <fperez@colorado.edu>
4857 4868
4858 4869 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4859 4870 there's a cleaner distinction between what ? and ?? show.
4860 4871
4861 4872 * Added screen_length option. Now the user can define his own
4862 4873 screen size for page() operations.
4863 4874
4864 4875 * Implemented magic shell-like functions with automatic code
4865 4876 generation. Now adding another function is just a matter of adding
4866 4877 an entry to a dict, and the function is dynamically generated at
4867 4878 run-time. Python has some really cool features!
4868 4879
4869 4880 * Renamed many options to cleanup conventions a little. Now all
4870 4881 are lowercase, and only underscores where needed. Also in the code
4871 4882 option name tables are clearer.
4872 4883
4873 4884 * Changed prompts a little. Now input is 'In [n]:' instead of
4874 4885 'In[n]:='. This allows it the numbers to be aligned with the
4875 4886 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4876 4887 Python (it was a Mathematica thing). The '...' continuation prompt
4877 4888 was also changed a little to align better.
4878 4889
4879 4890 * Fixed bug when flushing output cache. Not all _p<n> variables
4880 4891 exist, so their deletion needs to be wrapped in a try:
4881 4892
4882 4893 * Figured out how to properly use inspect.formatargspec() (it
4883 4894 requires the args preceded by *). So I removed all the code from
4884 4895 _get_pdef in Magic, which was just replicating that.
4885 4896
4886 4897 * Added test to prefilter to allow redefining magic function names
4887 4898 as variables. This is ok, since the @ form is always available,
4888 4899 but whe should allow the user to define a variable called 'ls' if
4889 4900 he needs it.
4890 4901
4891 4902 * Moved the ToDo information from README into a separate ToDo.
4892 4903
4893 4904 * General code cleanup and small bugfixes. I think it's close to a
4894 4905 state where it can be released, obviously with a big 'beta'
4895 4906 warning on it.
4896 4907
4897 4908 * Got the magic function split to work. Now all magics are defined
4898 4909 in a separate class. It just organizes things a bit, and now
4899 4910 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4900 4911 was too long).
4901 4912
4902 4913 * Changed @clear to @reset to avoid potential confusions with
4903 4914 the shell command clear. Also renamed @cl to @clear, which does
4904 4915 exactly what people expect it to from their shell experience.
4905 4916
4906 4917 Added a check to the @reset command (since it's so
4907 4918 destructive, it's probably a good idea to ask for confirmation).
4908 4919 But now reset only works for full namespace resetting. Since the
4909 4920 del keyword is already there for deleting a few specific
4910 4921 variables, I don't see the point of having a redundant magic
4911 4922 function for the same task.
4912 4923
4913 4924 2001-11-24 Fernando Perez <fperez@colorado.edu>
4914 4925
4915 4926 * Updated the builtin docs (esp. the ? ones).
4916 4927
4917 4928 * Ran all the code through pychecker. Not terribly impressed with
4918 4929 it: lots of spurious warnings and didn't really find anything of
4919 4930 substance (just a few modules being imported and not used).
4920 4931
4921 4932 * Implemented the new ultraTB functionality into IPython. New
4922 4933 option: xcolors. This chooses color scheme. xmode now only selects
4923 4934 between Plain and Verbose. Better orthogonality.
4924 4935
4925 4936 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4926 4937 mode and color scheme for the exception handlers. Now it's
4927 4938 possible to have the verbose traceback with no coloring.
4928 4939
4929 4940 2001-11-23 Fernando Perez <fperez@colorado.edu>
4930 4941
4931 4942 * Version 0.1.12 released, 0.1.13 opened.
4932 4943
4933 4944 * Removed option to set auto-quote and auto-paren escapes by
4934 4945 user. The chances of breaking valid syntax are just too high. If
4935 4946 someone *really* wants, they can always dig into the code.
4936 4947
4937 4948 * Made prompt separators configurable.
4938 4949
4939 4950 2001-11-22 Fernando Perez <fperez@colorado.edu>
4940 4951
4941 4952 * Small bugfixes in many places.
4942 4953
4943 4954 * Removed the MyCompleter class from ipplib. It seemed redundant
4944 4955 with the C-p,C-n history search functionality. Less code to
4945 4956 maintain.
4946 4957
4947 4958 * Moved all the original ipython.py code into ipythonlib.py. Right
4948 4959 now it's just one big dump into a function called make_IPython, so
4949 4960 no real modularity has been gained. But at least it makes the
4950 4961 wrapper script tiny, and since ipythonlib is a module, it gets
4951 4962 compiled and startup is much faster.
4952 4963
4953 4964 This is a reasobably 'deep' change, so we should test it for a
4954 4965 while without messing too much more with the code.
4955 4966
4956 4967 2001-11-21 Fernando Perez <fperez@colorado.edu>
4957 4968
4958 4969 * Version 0.1.11 released, 0.1.12 opened for further work.
4959 4970
4960 4971 * Removed dependency on Itpl. It was only needed in one place. It
4961 4972 would be nice if this became part of python, though. It makes life
4962 4973 *a lot* easier in some cases.
4963 4974
4964 4975 * Simplified the prefilter code a bit. Now all handlers are
4965 4976 expected to explicitly return a value (at least a blank string).
4966 4977
4967 4978 * Heavy edits in ipplib. Removed the help system altogether. Now
4968 4979 obj?/?? is used for inspecting objects, a magic @doc prints
4969 4980 docstrings, and full-blown Python help is accessed via the 'help'
4970 4981 keyword. This cleans up a lot of code (less to maintain) and does
4971 4982 the job. Since 'help' is now a standard Python component, might as
4972 4983 well use it and remove duplicate functionality.
4973 4984
4974 4985 Also removed the option to use ipplib as a standalone program. By
4975 4986 now it's too dependent on other parts of IPython to function alone.
4976 4987
4977 4988 * Fixed bug in genutils.pager. It would crash if the pager was
4978 4989 exited immediately after opening (broken pipe).
4979 4990
4980 4991 * Trimmed down the VerboseTB reporting a little. The header is
4981 4992 much shorter now and the repeated exception arguments at the end
4982 4993 have been removed. For interactive use the old header seemed a bit
4983 4994 excessive.
4984 4995
4985 4996 * Fixed small bug in output of @whos for variables with multi-word
4986 4997 types (only first word was displayed).
4987 4998
4988 4999 2001-11-17 Fernando Perez <fperez@colorado.edu>
4989 5000
4990 5001 * Version 0.1.10 released, 0.1.11 opened for further work.
4991 5002
4992 5003 * Modified dirs and friends. dirs now *returns* the stack (not
4993 5004 prints), so one can manipulate it as a variable. Convenient to
4994 5005 travel along many directories.
4995 5006
4996 5007 * Fixed bug in magic_pdef: would only work with functions with
4997 5008 arguments with default values.
4998 5009
4999 5010 2001-11-14 Fernando Perez <fperez@colorado.edu>
5000 5011
5001 5012 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5002 5013 example with IPython. Various other minor fixes and cleanups.
5003 5014
5004 5015 * Version 0.1.9 released, 0.1.10 opened for further work.
5005 5016
5006 5017 * Added sys.path to the list of directories searched in the
5007 5018 execfile= option. It used to be the current directory and the
5008 5019 user's IPYTHONDIR only.
5009 5020
5010 5021 2001-11-13 Fernando Perez <fperez@colorado.edu>
5011 5022
5012 5023 * Reinstated the raw_input/prefilter separation that Janko had
5013 5024 initially. This gives a more convenient setup for extending the
5014 5025 pre-processor from the outside: raw_input always gets a string,
5015 5026 and prefilter has to process it. We can then redefine prefilter
5016 5027 from the outside and implement extensions for special
5017 5028 purposes.
5018 5029
5019 5030 Today I got one for inputting PhysicalQuantity objects
5020 5031 (from Scientific) without needing any function calls at
5021 5032 all. Extremely convenient, and it's all done as a user-level
5022 5033 extension (no IPython code was touched). Now instead of:
5023 5034 a = PhysicalQuantity(4.2,'m/s**2')
5024 5035 one can simply say
5025 5036 a = 4.2 m/s**2
5026 5037 or even
5027 5038 a = 4.2 m/s^2
5028 5039
5029 5040 I use this, but it's also a proof of concept: IPython really is
5030 5041 fully user-extensible, even at the level of the parsing of the
5031 5042 command line. It's not trivial, but it's perfectly doable.
5032 5043
5033 5044 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5034 5045 the problem of modules being loaded in the inverse order in which
5035 5046 they were defined in
5036 5047
5037 5048 * Version 0.1.8 released, 0.1.9 opened for further work.
5038 5049
5039 5050 * Added magics pdef, source and file. They respectively show the
5040 5051 definition line ('prototype' in C), source code and full python
5041 5052 file for any callable object. The object inspector oinfo uses
5042 5053 these to show the same information.
5043 5054
5044 5055 * Version 0.1.7 released, 0.1.8 opened for further work.
5045 5056
5046 5057 * Separated all the magic functions into a class called Magic. The
5047 5058 InteractiveShell class was becoming too big for Xemacs to handle
5048 5059 (de-indenting a line would lock it up for 10 seconds while it
5049 5060 backtracked on the whole class!)
5050 5061
5051 5062 FIXME: didn't work. It can be done, but right now namespaces are
5052 5063 all messed up. Do it later (reverted it for now, so at least
5053 5064 everything works as before).
5054 5065
5055 5066 * Got the object introspection system (magic_oinfo) working! I
5056 5067 think this is pretty much ready for release to Janko, so he can
5057 5068 test it for a while and then announce it. Pretty much 100% of what
5058 5069 I wanted for the 'phase 1' release is ready. Happy, tired.
5059 5070
5060 5071 2001-11-12 Fernando Perez <fperez@colorado.edu>
5061 5072
5062 5073 * Version 0.1.6 released, 0.1.7 opened for further work.
5063 5074
5064 5075 * Fixed bug in printing: it used to test for truth before
5065 5076 printing, so 0 wouldn't print. Now checks for None.
5066 5077
5067 5078 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5068 5079 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5069 5080 reaches by hand into the outputcache. Think of a better way to do
5070 5081 this later.
5071 5082
5072 5083 * Various small fixes thanks to Nathan's comments.
5073 5084
5074 5085 * Changed magic_pprint to magic_Pprint. This way it doesn't
5075 5086 collide with pprint() and the name is consistent with the command
5076 5087 line option.
5077 5088
5078 5089 * Changed prompt counter behavior to be fully like
5079 5090 Mathematica's. That is, even input that doesn't return a result
5080 5091 raises the prompt counter. The old behavior was kind of confusing
5081 5092 (getting the same prompt number several times if the operation
5082 5093 didn't return a result).
5083 5094
5084 5095 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5085 5096
5086 5097 * Fixed -Classic mode (wasn't working anymore).
5087 5098
5088 5099 * Added colored prompts using Nathan's new code. Colors are
5089 5100 currently hardwired, they can be user-configurable. For
5090 5101 developers, they can be chosen in file ipythonlib.py, at the
5091 5102 beginning of the CachedOutput class def.
5092 5103
5093 5104 2001-11-11 Fernando Perez <fperez@colorado.edu>
5094 5105
5095 5106 * Version 0.1.5 released, 0.1.6 opened for further work.
5096 5107
5097 5108 * Changed magic_env to *return* the environment as a dict (not to
5098 5109 print it). This way it prints, but it can also be processed.
5099 5110
5100 5111 * Added Verbose exception reporting to interactive
5101 5112 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5102 5113 traceback. Had to make some changes to the ultraTB file. This is
5103 5114 probably the last 'big' thing in my mental todo list. This ties
5104 5115 in with the next entry:
5105 5116
5106 5117 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5107 5118 has to specify is Plain, Color or Verbose for all exception
5108 5119 handling.
5109 5120
5110 5121 * Removed ShellServices option. All this can really be done via
5111 5122 the magic system. It's easier to extend, cleaner and has automatic
5112 5123 namespace protection and documentation.
5113 5124
5114 5125 2001-11-09 Fernando Perez <fperez@colorado.edu>
5115 5126
5116 5127 * Fixed bug in output cache flushing (missing parameter to
5117 5128 __init__). Other small bugs fixed (found using pychecker).
5118 5129
5119 5130 * Version 0.1.4 opened for bugfixing.
5120 5131
5121 5132 2001-11-07 Fernando Perez <fperez@colorado.edu>
5122 5133
5123 5134 * Version 0.1.3 released, mainly because of the raw_input bug.
5124 5135
5125 5136 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5126 5137 and when testing for whether things were callable, a call could
5127 5138 actually be made to certain functions. They would get called again
5128 5139 once 'really' executed, with a resulting double call. A disaster
5129 5140 in many cases (list.reverse() would never work!).
5130 5141
5131 5142 * Removed prefilter() function, moved its code to raw_input (which
5132 5143 after all was just a near-empty caller for prefilter). This saves
5133 5144 a function call on every prompt, and simplifies the class a tiny bit.
5134 5145
5135 5146 * Fix _ip to __ip name in magic example file.
5136 5147
5137 5148 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5138 5149 work with non-gnu versions of tar.
5139 5150
5140 5151 2001-11-06 Fernando Perez <fperez@colorado.edu>
5141 5152
5142 5153 * Version 0.1.2. Just to keep track of the recent changes.
5143 5154
5144 5155 * Fixed nasty bug in output prompt routine. It used to check 'if
5145 5156 arg != None...'. Problem is, this fails if arg implements a
5146 5157 special comparison (__cmp__) which disallows comparing to
5147 5158 None. Found it when trying to use the PhysicalQuantity module from
5148 5159 ScientificPython.
5149 5160
5150 5161 2001-11-05 Fernando Perez <fperez@colorado.edu>
5151 5162
5152 5163 * Also added dirs. Now the pushd/popd/dirs family functions
5153 5164 basically like the shell, with the added convenience of going home
5154 5165 when called with no args.
5155 5166
5156 5167 * pushd/popd slightly modified to mimic shell behavior more
5157 5168 closely.
5158 5169
5159 5170 * Added env,pushd,popd from ShellServices as magic functions. I
5160 5171 think the cleanest will be to port all desired functions from
5161 5172 ShellServices as magics and remove ShellServices altogether. This
5162 5173 will provide a single, clean way of adding functionality
5163 5174 (shell-type or otherwise) to IP.
5164 5175
5165 5176 2001-11-04 Fernando Perez <fperez@colorado.edu>
5166 5177
5167 5178 * Added .ipython/ directory to sys.path. This way users can keep
5168 5179 customizations there and access them via import.
5169 5180
5170 5181 2001-11-03 Fernando Perez <fperez@colorado.edu>
5171 5182
5172 5183 * Opened version 0.1.1 for new changes.
5173 5184
5174 5185 * Changed version number to 0.1.0: first 'public' release, sent to
5175 5186 Nathan and Janko.
5176 5187
5177 5188 * Lots of small fixes and tweaks.
5178 5189
5179 5190 * Minor changes to whos format. Now strings are shown, snipped if
5180 5191 too long.
5181 5192
5182 5193 * Changed ShellServices to work on __main__ so they show up in @who
5183 5194
5184 5195 * Help also works with ? at the end of a line:
5185 5196 ?sin and sin?
5186 5197 both produce the same effect. This is nice, as often I use the
5187 5198 tab-complete to find the name of a method, but I used to then have
5188 5199 to go to the beginning of the line to put a ? if I wanted more
5189 5200 info. Now I can just add the ? and hit return. Convenient.
5190 5201
5191 5202 2001-11-02 Fernando Perez <fperez@colorado.edu>
5192 5203
5193 5204 * Python version check (>=2.1) added.
5194 5205
5195 5206 * Added LazyPython documentation. At this point the docs are quite
5196 5207 a mess. A cleanup is in order.
5197 5208
5198 5209 * Auto-installer created. For some bizarre reason, the zipfiles
5199 5210 module isn't working on my system. So I made a tar version
5200 5211 (hopefully the command line options in various systems won't kill
5201 5212 me).
5202 5213
5203 5214 * Fixes to Struct in genutils. Now all dictionary-like methods are
5204 5215 protected (reasonably).
5205 5216
5206 5217 * Added pager function to genutils and changed ? to print usage
5207 5218 note through it (it was too long).
5208 5219
5209 5220 * Added the LazyPython functionality. Works great! I changed the
5210 5221 auto-quote escape to ';', it's on home row and next to '. But
5211 5222 both auto-quote and auto-paren (still /) escapes are command-line
5212 5223 parameters.
5213 5224
5214 5225
5215 5226 2001-11-01 Fernando Perez <fperez@colorado.edu>
5216 5227
5217 5228 * Version changed to 0.0.7. Fairly large change: configuration now
5218 5229 is all stored in a directory, by default .ipython. There, all
5219 5230 config files have normal looking names (not .names)
5220 5231
5221 5232 * Version 0.0.6 Released first to Lucas and Archie as a test
5222 5233 run. Since it's the first 'semi-public' release, change version to
5223 5234 > 0.0.6 for any changes now.
5224 5235
5225 5236 * Stuff I had put in the ipplib.py changelog:
5226 5237
5227 5238 Changes to InteractiveShell:
5228 5239
5229 5240 - Made the usage message a parameter.
5230 5241
5231 5242 - Require the name of the shell variable to be given. It's a bit
5232 5243 of a hack, but allows the name 'shell' not to be hardwire in the
5233 5244 magic (@) handler, which is problematic b/c it requires
5234 5245 polluting the global namespace with 'shell'. This in turn is
5235 5246 fragile: if a user redefines a variable called shell, things
5236 5247 break.
5237 5248
5238 5249 - magic @: all functions available through @ need to be defined
5239 5250 as magic_<name>, even though they can be called simply as
5240 5251 @<name>. This allows the special command @magic to gather
5241 5252 information automatically about all existing magic functions,
5242 5253 even if they are run-time user extensions, by parsing the shell
5243 5254 instance __dict__ looking for special magic_ names.
5244 5255
5245 5256 - mainloop: added *two* local namespace parameters. This allows
5246 5257 the class to differentiate between parameters which were there
5247 5258 before and after command line initialization was processed. This
5248 5259 way, later @who can show things loaded at startup by the
5249 5260 user. This trick was necessary to make session saving/reloading
5250 5261 really work: ideally after saving/exiting/reloading a session,
5251 5262 *everythin* should look the same, including the output of @who. I
5252 5263 was only able to make this work with this double namespace
5253 5264 trick.
5254 5265
5255 5266 - added a header to the logfile which allows (almost) full
5256 5267 session restoring.
5257 5268
5258 5269 - prepend lines beginning with @ or !, with a and log
5259 5270 them. Why? !lines: may be useful to know what you did @lines:
5260 5271 they may affect session state. So when restoring a session, at
5261 5272 least inform the user of their presence. I couldn't quite get
5262 5273 them to properly re-execute, but at least the user is warned.
5263 5274
5264 5275 * Started ChangeLog.
@@ -1,398 +1,402 b''
1 1 ;;; ipython.el --- Adds support for IPython to python-mode.el
2 2
3 3 ;; Copyright (C) 2002, 2003, 2004, 2005 Alexander Schmolck
4 4 ;; Author: Alexander Schmolck
5 5 ;; Keywords: ipython python languages oop
6 6 ;; URL: http://ipython.scipy.org
7 7 ;; Compatibility: Emacs21, XEmacs21
8 8 ;; FIXME: #$@! INPUT RING
9 (defconst ipython-version "$Revision: 565 $"
9 (defconst ipython-version "$Revision: 1211 $"
10 10 "VC version number.")
11 11
12 12 ;;; Commentary
13 13 ;; This library makes all the functionality python-mode has when running with
14 14 ;; the normal python-interpreter available for ipython, too. It also enables a
15 15 ;; persistent py-shell command history accross sessions (if you exit python
16 16 ;; with C-d in py-shell) and defines the command `ipython-to-doctest', which
17 17 ;; can be used to convert bits of a ipython session into something that can be
18 18 ;; used for doctests. To install, put this file somewhere in your emacs
19 19 ;; `load-path' [1] and add the following line to your ~/.emacs file (the first
20 20 ;; line only needed if the default (``"ipython"``) is wrong)::
21 21 ;;
22 22 ;; (setq ipython-command "/SOME-PATH/ipython")
23 23 ;; (require 'ipython)
24 24 ;;
25 25 ;; Ipython will be set as the default python shell, but only if the ipython
26 26 ;; executable is in the path. For ipython sessions autocompletion with <tab>
27 27 ;; is also enabled (experimental feature!). Please also note that all the
28 28 ;; terminal functions in py-shell are handled by emacs's comint, **not** by
29 29 ;; (i)python, so importing readline etc. will have 0 effect.
30 30 ;;
31 31 ;; To start an interactive ipython session run `py-shell' with ``M-x py-shell``
32 32 ;; (or the default keybinding ``C-c C-!``).
33 33 ;;
34 34 ;; NOTE: This mode is currently somewhat alpha and although I hope that it
35 35 ;; will work fine for most cases, doing certain things (like the
36 36 ;; autocompletion and a decent scheme to switch between python interpreters)
37 37 ;; properly will also require changes to ipython that will likely have to wait
38 38 ;; for a larger rewrite scheduled some time in the future.
39 39 ;;
40 40 ;; Also note that you currently NEED THE CVS VERSION OF PYTHON.EL.
41 41 ;;
42 42 ;; Further note that I don't know whether this runs under windows or not and
43 43 ;; that if it doesn't I can't really help much, not being afflicted myself.
44 44 ;;
45 45 ;;
46 46 ;; Hints for effective usage
47 47 ;; -------------------------
48 48 ;;
49 49 ;; - IMO the best feature by far of the ipython/emacs combo is how much easier it
50 50 ;; makes it to find and fix bugs thanks to the ``@pdb on``/ pdbtrack combo. Try
51 51 ;; it: first in the ipython to shell do ``@pdb on`` then do something that will
52 52 ;; raise an exception (FIXME nice example) -- and be amazed how easy it is to
53 53 ;; inspect the live objects in each stack frames and to jump to the
54 54 ;; corresponding sourcecode locations as you walk up and down the stack trace
55 55 ;; (even without ``%pdb on`` you can always use ``C-c -`` (`py-up-exception')
56 56 ;; to jump to the corresponding source code locations).
57 57 ;;
58 58 ;; - emacs gives you much more powerful commandline editing and output searching
59 59 ;; capabilities than ipython-standalone -- isearch is your friend if you
60 60 ;; quickly want to print 'DEBUG ...' to stdout out etc.
61 61 ;;
62 62 ;; - This is not really specific to ipython, but for more convenient history
63 63 ;; access you might want to add something like the following to *the beggining*
64 64 ;; of your ``.emacs`` (if you want behavior that's more similar to stand-alone
65 65 ;; ipython, you can change ``meta p`` etc. for ``control p``)::
66 66 ;;
67 67 ;; (require 'comint)
68 68 ;; (define-key comint-mode-map [(meta p)]
69 69 ;; 'comint-previous-matching-input-from-input)
70 70 ;; (define-key comint-mode-map [(meta n)]
71 71 ;; 'comint-next-matching-input-from-input)
72 72 ;; (define-key comint-mode-map [(control meta n)]
73 73 ;; 'comint-next-input)
74 74 ;; (define-key comint-mode-map [(control meta p)]
75 75 ;; 'comint-previous-input)
76 76 ;;
77 77 ;; - Be aware that if you customize py-python-command previously, this value
78 78 ;; will override what ipython.el does (because loading the customization
79 79 ;; variables comes later).
80 80 ;;
81 81 ;; Please send comments and feedback to the ipython-list
82 82 ;; (<ipython-user@scipy.net>) where I (a.s.) or someone else will try to
83 83 ;; answer them (it helps if you specify your emacs version, OS etc;
84 84 ;; familiarity with <http://www.catb.org/~esr/faqs/smart-questions.html> might
85 85 ;; speed up things further).
86 86 ;;
87 87 ;; Footnotes:
88 88 ;;
89 89 ;; [1] If you don't know what `load-path' is, C-h v load-path will tell
90 90 ;; you; if required you can also add a new directory. So assuming that
91 91 ;; ipython.el resides in ~/el/, put this in your emacs:
92 92 ;;
93 93 ;;
94 94 ;; (add-to-list 'load-path "~/el")
95 95 ;; (setq ipython-command "/some-path/ipython")
96 96 ;; (require 'ipython)
97 97 ;;
98 98 ;;
99 99 ;;
100 100 ;;
101 101 ;; TODO:
102 102 ;; - do autocompletion properly
103 103 ;; - implement a proper switching between python interpreters
104 104 ;;
105 105 ;; BUGS:
106 106 ;; - neither::
107 107 ;;
108 108 ;; (py-shell "-c print 'FOOBAR'")
109 109 ;;
110 110 ;; nor::
111 111 ;;
112 112 ;; (let ((py-python-command-args (append py-python-command-args
113 113 ;; '("-c" "print 'FOOBAR'"))))
114 114 ;; (py-shell))
115 115 ;;
116 116 ;; seem to print anything as they should
117 117 ;;
118 118 ;; - look into init priority issues with `py-python-command' (if it's set
119 119 ;; via custom)
120 120
121 121
122 122 ;;; Code
123 123 (require 'cl)
124 124 (require 'shell)
125 125 (require 'executable)
126 126 (require 'ansi-color)
127 127
128 128 (defcustom ipython-command "ipython"
129 129 "*Shell command used to start ipython."
130 130 :type 'string
131 131 :group 'python)
132 132
133 133 ;; Users can set this to nil
134 134 (defvar py-shell-initial-switch-buffers t
135 135 "If nil, don't switch to the *Python* buffer on the first call to
136 136 `py-shell'.")
137 137
138 138 (defvar ipython-backup-of-py-python-command nil
139 139 "HACK")
140 140
141 141
142 142 (defvar ipython-de-input-prompt-regexp "\\(?:
143 143 In \\[[0-9]+\\]: *.*
144 144 ----+> \\(.*
145 145 \\)[\n]?\\)\\|\\(?:
146 146 In \\[[0-9]+\\]: *\\(.*
147 147 \\)\\)\\|^[ ]\\{3\\}[.]\\{3,\\}: *\\(.*
148 148 \\)"
149 149 "A regular expression to match the IPython input prompt and the python
150 150 command after it. The first match group is for a command that is rewritten,
151 151 the second for a 'normal' command, and the third for a multiline command.")
152 152 (defvar ipython-de-output-prompt-regexp "^Out\\[[0-9]+\\]: "
153 153 "A regular expression to match the output prompt of IPython.")
154 154
155 155
156 156 (if (not (executable-find ipython-command))
157 157 (message (format "Can't find executable %s - ipython.el *NOT* activated!!!"
158 158 ipython-command))
159 159 ;; XXX load python-mode, so that we can screw around with its variables
160 160 ;; this has the disadvantage that python-mode is loaded even if no
161 161 ;; python-file is ever edited etc. but it means that `py-shell' works
162 162 ;; without loading a python-file first. Obviously screwing around with
163 163 ;; python-mode's variables like this is a mess, but well.
164 164 (require 'python-mode)
165 165 ;; turn on ansi colors for ipython and activate completion
166 166 (defun ipython-shell-hook ()
167 167 ;; the following is to synchronize dir-changes
168 168 (make-local-variable 'shell-dirstack)
169 169 (setq shell-dirstack nil)
170 170 (make-local-variable 'shell-last-dir)
171 171 (setq shell-last-dir nil)
172 172 (make-local-variable 'shell-dirtrackp)
173 173 (setq shell-dirtrackp t)
174 174 (add-hook 'comint-input-filter-functions 'shell-directory-tracker nil t)
175 175
176 176 (ansi-color-for-comint-mode-on)
177 177 (define-key py-shell-map [tab] 'ipython-complete)
178 178 ;;XXX this is really just a cheap hack, it only completes symbols in the
179 179 ;;interactive session -- useful nonetheless.
180 180 (define-key py-mode-map [(meta tab)] 'ipython-complete))
181 181 (add-hook 'py-shell-hook 'ipython-shell-hook)
182 182 ;; Regular expression that describes tracebacks for IPython in context and
183 183 ;; verbose mode.
184 184
185 185 ;;Adapt python-mode settings for ipython.
186 186 ;; (this works for %xmode 'verbose' or 'context')
187 187
188 188 ;; XXX putative regexps for syntax errors; unfortunately the
189 189 ;; current python-mode traceback-line-re scheme is too primitive,
190 190 ;; so it's either matching syntax errors, *or* everything else
191 191 ;; (XXX: should ask Fernando for a change)
192 192 ;;"^ File \"\\(.*?\\)\", line \\([0-9]+\\).*\n.*\n.*\nSyntaxError:"
193 193 ;;^ File \"\\(.*?\\)\", line \\([0-9]+\\)"
194 194 (setq py-traceback-line-re
195 195 "\\(^[^\t ].+?\\.py\\).*\n +[0-9]+[^\00]*?\n-+> \\([0-9]+\\) +")
196 196
197 197 (setq py-shell-input-prompt-1-regexp "^In \\[[0-9]+\\]: *"
198 198 py-shell-input-prompt-2-regexp "^ [.][.][.]+: *" )
199 199 ;; select a suitable color-scheme
200 200 (unless (member "-colors" py-python-command-args)
201 201 (setq py-python-command-args
202 202 (nconc py-python-command-args
203 203 (list "-colors"
204 204 (cond
205 205 ((eq frame-background-mode 'dark)
206 206 "DarkBG")
207 207 ((eq frame-background-mode 'light)
208 208 "LightBG")
209 209 (t ; default (backg-mode isn't always set by XEmacs)
210 210 "LightBG"))))))
211 211 (unless (equal ipython-backup-of-py-python-command py-python-command)
212 212 (setq ipython-backup-of-py-python-command py-python-command))
213 213 (setq py-python-command ipython-command))
214 214
215 215
216 216 ;; MODIFY py-shell so that it loads the editing history
217 217 (defadvice py-shell (around py-shell-with-history)
218 218 "Add persistent command-history support (in
219 219 $PYTHONHISTORY (or \"~/.ipython/history\", if we use IPython)). Also, if
220 220 `py-shell-initial-switch-buffers' is nil, it only switches to *Python* if that
221 221 buffer already exists."
222 222 (if (comint-check-proc "*Python*")
223 223 ad-do-it
224 224 (setq comint-input-ring-file-name
225 225 (if (string-equal py-python-command ipython-command)
226 226 (concat (or (getenv "IPYTHONDIR") "~/.ipython") "/history")
227 227 (or (getenv "PYTHONHISTORY") "~/.python-history.py")))
228 228 (comint-read-input-ring t)
229 229 (let ((buf (current-buffer)))
230 230 ad-do-it
231 231 (unless py-shell-initial-switch-buffers
232 232 (switch-to-buffer-other-window buf)))))
233 233 (ad-activate 'py-shell)
234 234 ;; (defadvice py-execute-region (before py-execute-buffer-ensure-process)
235 235 ;; "HACK: test that ipython is already running before executing something.
236 236 ;; Doing this properly seems not worth the bother (unless people actually
237 237 ;; request it)."
238 238 ;; (unless (comint-check-proc "*Python*")
239 239 ;; (error "Sorry you have to first do M-x py-shell to send something to ipython.")))
240 240 ;; (ad-activate 'py-execute-region)
241 241
242 242 (defadvice py-execute-region (around py-execute-buffer-ensure-process)
243 243 "HACK: if `py-shell' is not active or ASYNC is explicitly desired, fall back
244 244 to python instead of ipython."
245 245 (let ((py-python-command (if (and (comint-check-proc "*Python*") (not async))
246 246 py-python-command
247 247 ipython-backup-of-py-python-command)))
248 248 ad-do-it))
249 249 (ad-activate 'py-execute-region)
250 250
251 251 (defun ipython-to-doctest (start end)
252 252 "Transform a cut-and-pasted bit from an IPython session into something that
253 253 looks like it came from a normal interactive python session, so that it can
254 254 be used in doctests. Example:
255 255
256 256
257 257 In [1]: import sys
258 258
259 259 In [2]: sys.stdout.write 'Hi!\n'
260 260 ------> sys.stdout.write ('Hi!\n')
261 261 Hi!
262 262
263 263 In [3]: 3 + 4
264 264 Out[3]: 7
265 265
266 266 gets converted to:
267 267
268 268 >>> import sys
269 269 >>> sys.stdout.write ('Hi!\n')
270 270 Hi!
271 271 >>> 3 + 4
272 272 7
273 273
274 274 "
275 275 (interactive "*r\n")
276 276 ;(message (format "###DEBUG s:%de:%d" start end))
277 277 (save-excursion
278 278 (save-match-data
279 279 ;; replace ``In [3]: bla`` with ``>>> bla`` and
280 280 ;; ``... : bla`` with ``... bla``
281 281 (goto-char start)
282 282 (while (re-search-forward ipython-de-input-prompt-regexp end t)
283 283 ;(message "finding 1")
284 284 (cond ((match-string 3) ;continued
285 285 (replace-match "... \\3" t nil))
286 286 (t
287 287 (replace-match ">>> \\1\\2" t nil))))
288 288 ;; replace ``
289 289 (goto-char start)
290 290 (while (re-search-forward ipython-de-output-prompt-regexp end t)
291 291 (replace-match "" t nil)))))
292 292
293 293 (defvar ipython-completion-command-string
294 294 "print ';'.join(__IP.Completer.all_completions('%s')) #PYTHON-MODE SILENT\n"
295 295 "The string send to ipython to query for all possible completions")
296 296
297 297
298 298 ;; xemacs doesn't have `comint-preoutput-filter-functions' so we'll try the
299 299 ;; following wonderful hack to work around this case
300 300 (if (featurep 'xemacs)
301 301 ;;xemacs
302 302 (defun ipython-complete ()
303 303 "Try to complete the python symbol before point. Only knows about the stuff
304 304 in the current *Python* session."
305 305 (interactive)
306 306 (let* ((ugly-return nil)
307 307 (sep ";")
308 (python-process (or (get-buffer-process (current-buffer))
309 ;XXX hack for .py buffers
310 (get-process py-which-bufname)))
308 311 ;; XXX currently we go backwards to find the beginning of an
309 312 ;; expression part; a more powerful approach in the future might be
310 313 ;; to let ipython have the complete line, so that context can be used
311 314 ;; to do things like filename completion etc.
312 315 (beg (save-excursion (skip-chars-backward "a-z0-9A-Z_." (point-at-bol))
313 316 (point)))
314 317 (end (point))
315 318 (pattern (buffer-substring-no-properties beg end))
316 319 (completions nil)
317 320 (completion-table nil)
318 321 completion
319 322 (comint-output-filter-functions
320 323 (append comint-output-filter-functions
321 324 '(ansi-color-filter-apply
322 325 (lambda (string)
323 326 ;(message (format "DEBUG filtering: %s" string))
324 327 (setq ugly-return (concat ugly-return string))
325 328 (delete-region comint-last-output-start
326 329 (process-mark (get-buffer-process (current-buffer)))))))))
327 330 ;(message (format "#DEBUG pattern: '%s'" pattern))
328 (process-send-string (or (get-buffer-process (current-buffer))
329 (get-process py-which-bufname)) ;XXX hack for .py buffers
331 (process-send-string python-process
330 332 (format ipython-completion-command-string pattern))
331 (accept-process-output (get-buffer-process (current-buffer)))
333 (accept-process-output python-process)
332 334 ;(message (format "DEBUG return: %s" ugly-return))
333 335 (setq completions
334 336 (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
335 337 (setq completion-table (loop for str in completions
336 338 collect (list str nil)))
337 339 (setq completion (try-completion pattern completion-table))
338 340 (cond ((eq completion t))
339 341 ((null completion)
340 342 (message "Can't find completion for \"%s\"" pattern)
341 343 (ding))
342 344 ((not (string= pattern completion))
343 345 (delete-region beg end)
344 346 (insert completion))
345 347 (t
346 348 (message "Making completion list...")
347 349 (with-output-to-temp-buffer "*Python Completions*"
348 350 (display-completion-list (all-completions pattern completion-table)))
349 351 (message "Making completion list...%s" "done")))))
350 352 ;; emacs
351 353 (defun ipython-complete ()
352 354 "Try to complete the python symbol before point. Only knows about the stuff
353 355 in the current *Python* session."
354 356 (interactive)
355 357 (let* ((ugly-return nil)
356 358 (sep ";")
359 (python-process (or (get-buffer-process (current-buffer))
360 ;XXX hack for .py buffers
361 (get-process py-which-bufname)))
357 362 ;; XXX currently we go backwards to find the beginning of an
358 363 ;; expression part; a more powerful approach in the future might be
359 364 ;; to let ipython have the complete line, so that context can be used
360 365 ;; to do things like filename completion etc.
361 366 (beg (save-excursion (skip-chars-backward "a-z0-9A-Z_." (point-at-bol))
362 367 (point)))
363 368 (end (point))
364 369 (pattern (buffer-substring-no-properties beg end))
365 370 (completions nil)
366 371 (completion-table nil)
367 372 completion
368 373 (comint-preoutput-filter-functions
369 374 (append comint-preoutput-filter-functions
370 375 '(ansi-color-filter-apply
371 376 (lambda (string)
372 377 (setq ugly-return (concat ugly-return string))
373 378 "")))))
374 (process-send-string (or (get-buffer-process (current-buffer))
375 (get-process py-which-bufname)) ;XXX hack for .py buffers
379 (process-send-string python-process
376 380 (format ipython-completion-command-string pattern))
377 (accept-process-output (get-buffer-process (current-buffer)))
381 (accept-process-output python-process)
378 382 (setq completions
379 383 (split-string (substring ugly-return 0 (position ?\n ugly-return)) sep))
380 384 ;(message (format "DEBUG completions: %S" completions))
381 385 (setq completion-table (loop for str in completions
382 386 collect (list str nil)))
383 387 (setq completion (try-completion pattern completion-table))
384 388 (cond ((eq completion t))
385 389 ((null completion)
386 390 (message "Can't find completion for \"%s\"" pattern)
387 391 (ding))
388 392 ((not (string= pattern completion))
389 393 (delete-region beg end)
390 394 (insert completion))
391 395 (t
392 396 (message "Making completion list...")
393 397 (with-output-to-temp-buffer "*IPython Completions*"
394 398 (display-completion-list (all-completions pattern completion-table)))
395 399 (message "Making completion list...%s" "done")))))
396 400 )
397 401
398 402 (provide 'ipython)
@@ -1,9505 +1,9515 b''
1 1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 2 \lyxformat 221
3 3 \textclass article
4 4 \begin_preamble
5 5 %\usepackage{ae,aecompl}
6 6 \usepackage{color}
7 7
8 8 % A few colors to replace the defaults for certain link types
9 9 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
10 10 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
11 11 \definecolor{darkred}{rgb}{.52,0.08,0.01}
12 12 \definecolor{darkgreen}{rgb}{.12,.54,.11}
13 13
14 14 % Use and configure listings package for nicely formatted code
15 15 \usepackage{listings}
16 16 \lstset{
17 17 language=Python,
18 18 basicstyle=\small\ttfamily,
19 19 commentstyle=\ttfamily\color{blue},
20 20 stringstyle=\ttfamily\color{darkorange},
21 21 showstringspaces=false,
22 22 breaklines=true,
23 23 postbreak = \space\dots
24 24 }
25 25
26 26 \usepackage[%pdftex, % needed for pdflatex
27 27 breaklinks=true, % so long urls are correctly broken across lines
28 28 colorlinks=true,
29 29 urlcolor=blue,
30 30 linkcolor=darkred,
31 31 citecolor=darkgreen,
32 32 ]{hyperref}
33 33
34 34 \usepackage{html}
35 35
36 36 % This helps prevent overly long lines that stretch beyond the margins
37 37 \sloppy
38 38
39 39 % Define a \codelist command which either uses listings for latex, or
40 40 % plain verbatim for html (since latex2html doesn't understand the
41 41 % listings package).
42 42 \usepackage{verbatim}
43 43 \newcommand{\codelist}[1] {
44 44 \latex{\lstinputlisting{#1}}
45 45 \html{\verbatiminput{#1}}
46 46 }
47 47 \end_preamble
48 48 \language english
49 49 \inputencoding latin1
50 50 \fontscheme palatino
51 51 \graphics default
52 52 \paperfontsize 11
53 53 \spacing single
54 54 \papersize Default
55 55 \paperpackage a4
56 56 \use_geometry 1
57 57 \use_amsmath 0
58 58 \use_natbib 0
59 59 \use_numerical_citations 0
60 60 \paperorientation portrait
61 61 \leftmargin 1in
62 62 \topmargin 1in
63 63 \rightmargin 1in
64 64 \bottommargin 1in
65 65 \secnumdepth 3
66 66 \tocdepth 3
67 67 \paragraph_separation skip
68 68 \defskip medskip
69 69 \quotes_language english
70 70 \quotes_times 2
71 71 \papercolumns 1
72 72 \papersides 2
73 73 \paperpagestyle fancy
74 74
75 75 \layout Title
76 76
77 77 IPython
78 78 \newline
79 79
80 80 \size larger
81 81 An enhanced Interactive Python
82 82 \size large
83 83
84 84 \newline
85 85 User Manual, v.
86 86 __version__
87 87 \layout Author
88 88
89 89 Fernando P�rez
90 90 \begin_inset Foot
91 91 collapsed true
92 92
93 93 \layout Standard
94 94
95 95
96 96 \size scriptsize
97 97 Department of Applied Mathematics, University of Colorado at Boulder.
98 98
99 99 \family typewriter
100 100 <Fernando.Perez@colorado.edu>
101 101 \end_inset
102 102
103 103
104 104 \layout Standard
105 105
106 106
107 107 \begin_inset ERT
108 108 status Collapsed
109 109
110 110 \layout Standard
111 111
112 112 \backslash
113 113 latex{
114 114 \end_inset
115 115
116 116
117 117 \begin_inset LatexCommand \tableofcontents{}
118 118
119 119 \end_inset
120 120
121 121
122 122 \begin_inset ERT
123 123 status Collapsed
124 124
125 125 \layout Standard
126 126 }
127 127 \end_inset
128 128
129 129
130 130 \layout Standard
131 131
132 132
133 133 \begin_inset ERT
134 134 status Open
135 135
136 136 \layout Standard
137 137
138 138 \backslash
139 139 html{
140 140 \backslash
141 141 bodytext{bgcolor=#ffffff}}
142 142 \end_inset
143 143
144 144
145 145 \layout Section
146 146 \pagebreak_top
147 147 Overview
148 148 \layout Standard
149 149
150 150 One of Python's most useful features is its interactive interpreter.
151 151 This system allows very fast testing of ideas without the overhead of creating
152 152 test files as is typical in most programming languages.
153 153 However, the interpreter supplied with the standard Python distribution
154 154 is somewhat limited for extended interactive use.
155 155 \layout Standard
156 156
157 157 IPython is a free software project (released under the BSD license) which
158 158 tries to:
159 159 \layout Enumerate
160 160
161 161 Provide an interactive shell superior to Python's default.
162 162 IPython has many features for object introspection, system shell access,
163 163 and its own special command system for adding functionality when working
164 164 interactively.
165 165 It tries to be a very efficient environment both for Python code development
166 166 and for exploration of problems using Python objects (in situations like
167 167 data analysis).
168 168 \layout Enumerate
169 169
170 170 Serve as an embeddable, ready to use interpreter for your own programs.
171 171 IPython can be started with a single call from inside another program,
172 172 providing access to the current namespace.
173 173 This can be very useful both for debugging purposes and for situations
174 174 where a blend of batch-processing and interactive exploration are needed.
175 175 \layout Enumerate
176 176
177 177 Offer a flexible framework which can be used as the base environment for
178 178 other systems with Python as the underlying language.
179 179 Specifically scientific environments like Mathematica, IDL and Matlab inspired
180 180 its design, but similar ideas can be useful in many fields.
181 181 \layout Enumerate
182 182
183 183 Allow interactive testing of threaded graphical toolkits.
184 184 IPython has support for interactive, non-blocking control of GTK, Qt and
185 185 WX applications via special threading flags.
186 186 The normal Python shell can only do this for Tkinter applications.
187 187 \layout Subsection
188 188
189 189 Main features
190 190 \layout Itemize
191 191
192 192 Dynamic object introspection.
193 193 One can access docstrings, function definition prototypes, source code,
194 194 source files and other details of any object accessible to the interpreter
195 195 with a single keystroke (`
196 196 \family typewriter
197 197 ?
198 198 \family default
199 199 ', and using `
200 200 \family typewriter
201 201 ??
202 202 \family default
203 203 ' provides additional detail).
204 204 \layout Itemize
205 205
206 206 Searching through modules and namespaces with `
207 207 \family typewriter
208 208 *
209 209 \family default
210 210 ' wildcards, both when using the `
211 211 \family typewriter
212 212 ?
213 213 \family default
214 214 ' system and via the
215 215 \family typewriter
216 216 %psearch
217 217 \family default
218 218 command.
219 219 \layout Itemize
220 220
221 221 Completion in the local namespace, by typing TAB at the prompt.
222 222 This works for keywords, methods, variables and files in the current directory.
223 223 This is supported via the readline library, and full access to configuring
224 224 readline's behavior is provided.
225 225 \layout Itemize
226 226
227 227 Numbered input/output prompts with command history (persistent across sessions
228 228 and tied to each profile), full searching in this history and caching of
229 229 all input and output.
230 230 \layout Itemize
231 231
232 232 User-extensible `magic' commands.
233 233 A set of commands prefixed with
234 234 \family typewriter
235 235 %
236 236 \family default
237 237 is available for controlling IPython itself and provides directory control,
238 238 namespace information and many aliases to common system shell commands.
239 239 \layout Itemize
240 240
241 241 Alias facility for defining your own system aliases.
242 242 \layout Itemize
243 243
244 244 Complete system shell access.
245 245 Lines starting with ! are passed directly to the system shell, and using
246 246 !! captures shell output into python variables for further use.
247 247 \layout Itemize
248 248
249 249 Background execution of Python commands in a separate thread.
250 250 IPython has an internal job manager called
251 251 \family typewriter
252 252 jobs
253 253 \family default
254 254 , and a conveninence backgrounding magic function called
255 255 \family typewriter
256 256 %bg
257 257 \family default
258 258 .
259 259 \layout Itemize
260 260
261 261 The ability to expand python variables when calling the system shell.
262 262 In a shell command, any python variable prefixed with
263 263 \family typewriter
264 264 $
265 265 \family default
266 266 is expanded.
267 267 A double
268 268 \family typewriter
269 269 $$
270 270 \family default
271 271 allows passing a literal
272 272 \family typewriter
273 273 $
274 274 \family default
275 275 to the shell (for access to shell and environment variables like
276 276 \family typewriter
277 277 $PATH
278 278 \family default
279 279 ).
280 280 \layout Itemize
281 281
282 282 Filesystem navigation, via a magic
283 283 \family typewriter
284 284 %cd
285 285 \family default
286 286 command, along with a persistent bookmark system (using
287 287 \family typewriter
288 288 %bookmark
289 289 \family default
290 290 ) for fast access to frequently visited directories.
291 291 \layout Itemize
292 292
293 293 A lightweight persistence framework via the
294 294 \family typewriter
295 295 %store
296 296 \family default
297 297 command, which allows you to save arbitrary Python variables.
298 298 These get restored automatically when your session restarts.
299 299 \layout Itemize
300 300
301 301 Automatic indentation (optional) of code as you type (through the readline
302 302 library).
303 303 \layout Itemize
304 304
305 305 Macro system for quickly re-executing multiple lines of previous input with
306 306 a single name.
307 307 Macros can be stored persistently via
308 308 \family typewriter
309 309 %store
310 310 \family default
311 311 and edited via
312 312 \family typewriter
313 313 %edit
314 314 \family default
315 315 .
316 316
317 317 \layout Itemize
318 318
319 319 Session logging (you can then later use these logs as code in your programs).
320 320 Logs can optionally timestamp all input, and also store session output
321 321 (marked as comments, so the log remains valid Python source code).
322 322 \layout Itemize
323 323
324 324 Session restoring: logs can be replayed to restore a previous session to
325 325 the state where you left it.
326 326 \layout Itemize
327 327
328 328 Verbose and colored exception traceback printouts.
329 329 Easier to parse visually, and in verbose mode they produce a lot of useful
330 330 debugging information (basically a terminal version of the cgitb module).
331 331 \layout Itemize
332 332
333 333 Auto-parentheses: callable objects can be executed without parentheses:
334 334
335 335 \family typewriter
336 336 `sin 3'
337 337 \family default
338 338 is automatically converted to
339 339 \family typewriter
340 340 `sin(3)
341 341 \family default
342 342 '.
343 343 \layout Itemize
344 344
345 345 Auto-quoting: using `
346 346 \family typewriter
347 347 ,
348 348 \family default
349 349 ' or `
350 350 \family typewriter
351 351 ;
352 352 \family default
353 353 ' as the first character forces auto-quoting of the rest of the line:
354 354 \family typewriter
355 355 `,my_function a\SpecialChar ~
356 356 b'
357 357 \family default
358 358 becomes automatically
359 359 \family typewriter
360 360 `my_function("a","b")'
361 361 \family default
362 362 , while
363 363 \family typewriter
364 364 `;my_function a\SpecialChar ~
365 365 b'
366 366 \family default
367 367 becomes
368 368 \family typewriter
369 369 `my_function("a b")'
370 370 \family default
371 371 .
372 372 \layout Itemize
373 373
374 374 Extensible input syntax.
375 375 You can define filters that pre-process user input to simplify input in
376 376 special situations.
377 377 This allows for example pasting multi-line code fragments which start with
378 378
379 379 \family typewriter
380 380 `>>>'
381 381 \family default
382 382 or
383 383 \family typewriter
384 384 `...'
385 385 \family default
386 386 such as those from other python sessions or the standard Python documentation.
387 387 \layout Itemize
388 388
389 389 Flexible configuration system.
390 390 It uses a configuration file which allows permanent setting of all command-line
391 391 options, module loading, code and file execution.
392 392 The system allows recursive file inclusion, so you can have a base file
393 393 with defaults and layers which load other customizations for particular
394 394 projects.
395 395 \layout Itemize
396 396
397 397 Embeddable.
398 398 You can call IPython as a python shell inside your own python programs.
399 399 This can be used both for debugging code or for providing interactive abilities
400 400 to your programs with knowledge about the local namespaces (very useful
401 401 in debugging and data analysis situations).
402 402 \layout Itemize
403 403
404 404 Easy debugger access.
405 405 You can set IPython to call up an enhanced version of the Python debugger
406 406 (
407 407 \family typewriter
408 408 pdb
409 409 \family default
410 410 ) every time there is an uncaught exception.
411 411 This drops you inside the code which triggered the exception with all the
412 412 data live and it is possible to navigate the stack to rapidly isolate the
413 413 source of a bug.
414 414 The
415 415 \family typewriter
416 416 %run
417 417 \family default
418 418 magic command --with the
419 419 \family typewriter
420 420 -d
421 421 \family default
422 422 option-- can run any script under
423 423 \family typewriter
424 424 pdb
425 425 \family default
426 426 's control, automatically setting initial breakpoints for you.
427 427 This version of
428 428 \family typewriter
429 429 pdb
430 430 \family default
431 431 has IPython-specific improvements, including tab-completion and traceback
432 432 coloring support.
433 433 \layout Itemize
434 434
435 435 Profiler support.
436 436 You can run single statements (similar to
437 437 \family typewriter
438 438 profile.run()
439 439 \family default
440 440 ) or complete programs under the profiler's control.
441 441 While this is possible with the standard
442 442 \family typewriter
443 443 profile
444 444 \family default
445 445 module, IPython wraps this functionality with magic commands (see
446 446 \family typewriter
447 447 `%prun'
448 448 \family default
449 449 and
450 450 \family typewriter
451 451 `%run -p
452 452 \family default
453 453 ') convenient for rapid interactive work.
454 454 \layout Subsection
455 455
456 456 Portability and Python requirements
457 457 \layout Standard
458 458
459 459
460 460 \series bold
461 461 Python requirements:
462 462 \series default
463 463 IPython requires with Python version 2.3 or newer.
464 464 If you are still using Python 2.2 and can not upgrade, the last version
465 465 of IPython which worked with Python 2.2 was 0.6.15, so you will have to use
466 466 that.
467 467 \layout Standard
468 468
469 469 IPython is developed under
470 470 \series bold
471 471 Linux
472 472 \series default
473 473 , but it should work in any reasonable Unix-type system (tested OK under
474 474 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
475 475 \layout Standard
476 476
477 477
478 478 \series bold
479 479 Mac OS X
480 480 \series default
481 481 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
482 482 Livermore for the information).
483 483 Thanks to Andrea Riciputi, Fink support is available.
484 484 \layout Standard
485 485
486 486
487 487 \series bold
488 488 CygWin
489 489 \series default
490 490 : it works mostly OK, though some users have reported problems with prompt
491 491 coloring.
492 492 No satisfactory solution to this has been found so far, you may want to
493 493 disable colors permanently in the
494 494 \family typewriter
495 495 ipythonrc
496 496 \family default
497 497 configuration file if you experience problems.
498 498 If you have proper color support under cygwin, please post to the IPython
499 499 mailing list so this issue can be resolved for all users.
500 500 \layout Standard
501 501
502 502
503 503 \series bold
504 504 Windows
505 505 \series default
506 506 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
507 507 Section\SpecialChar ~
508 508
509 509 \begin_inset LatexCommand \ref{sub:Under-Windows}
510 510
511 511 \end_inset
512 512
513 513 describes installation details for Windows, including some additional tools
514 514 needed on this platform.
515 515 \layout Standard
516 516
517 517 Windows 9x support is present, and has been reported to work fine (at least
518 518 on WinME).
519 519 \layout Standard
520 520
521 521 Note, that I have very little access to and experience with Windows development.
522 522 However, an excellent group of Win32 users (led by Ville Vainio), consistenly
523 523 contribute bugfixes and platform-specific enhancements, so they more than
524 524 make up for my deficiencies on that front.
525 525 In fact, Win32 users report using IPython as a system shell (see Sec.\SpecialChar ~
526 526
527 527 \begin_inset LatexCommand \ref{sec:IPython-as-shell}
528 528
529 529 \end_inset
530 530
531 531 for details), as it offers a level of control and features which the default
532 532
533 533 \family typewriter
534 534 cmd.exe
535 535 \family default
536 536 doesn't provide.
537 537 \layout Subsection
538 538
539 539 Location
540 540 \layout Standard
541 541
542 542 IPython is generously hosted at
543 543 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
544 544
545 545 \end_inset
546 546
547 547 by the Enthought, Inc and the SciPy project.
548 548 This site offers downloads, subversion access, mailing lists and a bug
549 549 tracking system.
550 550 I am very grateful to Enthought (
551 551 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
552 552
553 553 \end_inset
554 554
555 555 ) and all of the SciPy team for their contribution.
556 556 \layout Section
557 557
558 558
559 559 \begin_inset LatexCommand \label{sec:install}
560 560
561 561 \end_inset
562 562
563 563 Installation
564 564 \layout Subsection
565 565
566 566 Instant instructions
567 567 \layout Standard
568 568
569 569 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
570 570 download, then install with
571 571 \family typewriter
572 572 `python setup.py install'
573 573 \family default
574 574 .
575 575 Under Windows, double-click on the provided
576 576 \family typewriter
577 577 .exe
578 578 \family default
579 579 binary installer.
580 580 \layout Standard
581 581
582 582 Then, take a look at Sections
583 583 \begin_inset LatexCommand \ref{sec:good_config}
584 584
585 585 \end_inset
586 586
587 587 for configuring things optimally and
588 588 \begin_inset LatexCommand \ref{sec:quick_tips}
589 589
590 590 \end_inset
591 591
592 592 for quick tips on efficient use of IPython.
593 593 You can later refer to the rest of the manual for all the gory details.
594 594 \layout Standard
595 595
596 596 See the notes in sec.
597 597
598 598 \begin_inset LatexCommand \ref{sec:upgrade}
599 599
600 600 \end_inset
601 601
602 602 for upgrading IPython versions.
603 603 \layout Subsection
604 604
605 605 Detailed Unix instructions (Linux, Mac OS X, etc.)
606 606 \layout Standard
607 607
608 608 For RPM based systems, simply install the supplied package in the usual
609 609 manner.
610 610 If you download the tar archive, the process is:
611 611 \layout Enumerate
612 612
613 613 Unzip/untar the
614 614 \family typewriter
615 615 ipython-XXX.tar.gz
616 616 \family default
617 617 file wherever you want (
618 618 \family typewriter
619 619 XXX
620 620 \family default
621 621 is the version number).
622 622 It will make a directory called
623 623 \family typewriter
624 624 ipython-XXX.
625 625
626 626 \family default
627 627 Change into that directory where you will find the files
628 628 \family typewriter
629 629 README
630 630 \family default
631 631 and
632 632 \family typewriter
633 633 setup.py
634 634 \family default
635 635 .
636 636
637 637 \family typewriter
638 638 O
639 639 \family default
640 640 nce you've completed the installation, you can safely remove this directory.
641 641
642 642 \layout Enumerate
643 643
644 644 If you are installing over a previous installation of version 0.2.0 or earlier,
645 645 first remove your
646 646 \family typewriter
647 647 $HOME/.ipython
648 648 \family default
649 649 directory, since the configuration file format has changed somewhat (the
650 650 '=' were removed from all option specifications).
651 651 Or you can call ipython with the
652 652 \family typewriter
653 653 -upgrade
654 654 \family default
655 655 option and it will do this automatically for you.
656 656 \layout Enumerate
657 657
658 658 IPython uses distutils, so you can install it by simply typing at the system
659 659 prompt (don't type the
660 660 \family typewriter
661 661 $
662 662 \family default
663 663 )
664 664 \newline
665 665
666 666 \family typewriter
667 667 $ python setup.py install
668 668 \family default
669 669
670 670 \newline
671 671 Note that this assumes you have root access to your machine.
672 672 If you don't have root access or don't want IPython to go in the default
673 673 python directories, you'll need to use the
674 674 \begin_inset ERT
675 675 status Collapsed
676 676
677 677 \layout Standard
678 678
679 679 \backslash
680 680 verb|--home|
681 681 \end_inset
682 682
683 683 option (or
684 684 \begin_inset ERT
685 685 status Collapsed
686 686
687 687 \layout Standard
688 688
689 689 \backslash
690 690 verb|--prefix|
691 691 \end_inset
692 692
693 693 ).
694 694 For example:
695 695 \newline
696 696
697 697 \begin_inset ERT
698 698 status Collapsed
699 699
700 700 \layout Standard
701 701
702 702 \backslash
703 703 verb|$ python setup.py install --home $HOME/local|
704 704 \end_inset
705 705
706 706
707 707 \newline
708 708 will install IPython into
709 709 \family typewriter
710 710 $HOME/local
711 711 \family default
712 712 and its subdirectories (creating them if necessary).
713 713 \newline
714 714 You can type
715 715 \newline
716 716
717 717 \begin_inset ERT
718 718 status Collapsed
719 719
720 720 \layout Standard
721 721
722 722 \backslash
723 723 verb|$ python setup.py --help|
724 724 \end_inset
725 725
726 726
727 727 \newline
728 728 for more details.
729 729 \newline
730 730 Note that if you change the default location for
731 731 \begin_inset ERT
732 732 status Collapsed
733 733
734 734 \layout Standard
735 735
736 736 \backslash
737 737 verb|--home|
738 738 \end_inset
739 739
740 740 at installation, IPython may end up installed at a location which is not
741 741 part of your
742 742 \family typewriter
743 743 $PYTHONPATH
744 744 \family default
745 745 environment variable.
746 746 In this case, you'll need to configure this variable to include the actual
747 747 directory where the
748 748 \family typewriter
749 749 IPython/
750 750 \family default
751 751 directory ended (typically the value you give to
752 752 \begin_inset ERT
753 753 status Collapsed
754 754
755 755 \layout Standard
756 756
757 757 \backslash
758 758 verb|--home|
759 759 \end_inset
760 760
761 761 plus
762 762 \family typewriter
763 763 /lib/python
764 764 \family default
765 765 ).
766 766 \layout Subsubsection
767 767
768 768 Mac OSX information
769 769 \layout Standard
770 770
771 771 Under OSX, there is a choice you need to make.
772 772 Apple ships its own build of Python, which lives in the core OSX filesystem
773 773 hierarchy.
774 774 You can also manually install a separate Python, either purely by hand
775 775 (typically in
776 776 \family typewriter
777 777 /usr/local
778 778 \family default
779 779 ) or by using Fink, which puts everything under
780 780 \family typewriter
781 781 /sw
782 782 \family default
783 783 .
784 784 Which route to follow is a matter of personal preference, as I've seen
785 785 users who favor each of the approaches.
786 786 Here I will simply list the known installation issues under OSX, along
787 787 with their solutions.
788 788 \layout Standard
789 789
790 790 This page:
791 791 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
792 792
793 793 \end_inset
794 794
795 795 contains information on this topic, with additional details on how to make
796 796 IPython and matplotlib play nicely under OSX.
797 797 \layout Subsubsection*
798 798
799 799 GUI problems
800 800 \layout Standard
801 801
802 802 The following instructions apply to an install of IPython under OSX from
803 803 unpacking the
804 804 \family typewriter
805 805 .tar.gz
806 806 \family default
807 807 distribution and installing it for the default Python interpreter shipped
808 808 by Apple.
809 809 If you are using a fink install, fink will take care of these details for
810 810 you, by installing IPython against fink's Python.
811 811 \layout Standard
812 812
813 813 IPython offers various forms of support for interacting with graphical applicati
814 814 ons from the command line, from simple Tk apps (which are in principle always
815 815 supported by Python) to interactive control of WX, Qt and GTK apps.
816 816 Under OSX, however, this requires that ipython is installed by calling
817 817 the special
818 818 \family typewriter
819 819 pythonw
820 820 \family default
821 821 script at installation time, which takes care of coordinating things with
822 822 Apple's graphical environment.
823 823 \layout Standard
824 824
825 825 So when installing under OSX, it is best to use the following command:
826 826 \family typewriter
827 827
828 828 \newline
829 829
830 830 \family default
831 831
832 832 \begin_inset ERT
833 833 status Collapsed
834 834
835 835 \layout Standard
836 836
837 837 \backslash
838 838 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
839 839 \end_inset
840 840
841 841
842 842 \newline
843 843 or
844 844 \newline
845 845
846 846 \begin_inset ERT
847 847 status Collapsed
848 848
849 849 \layout Standard
850 850
851 851 \backslash
852 852 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
853 853 \end_inset
854 854
855 855
856 856 \newline
857 857 depending on where you like to keep hand-installed executables.
858 858 \layout Standard
859 859
860 860 The resulting script will have an appropriate shebang line (the first line
861 861 in the script whic begins with
862 862 \family typewriter
863 863 #!...
864 864 \family default
865 865 ) such that the ipython interpreter can interact with the OS X GUI.
866 866 If the installed version does not work and has a shebang line that points
867 867 to, for example, just
868 868 \family typewriter
869 869 /usr/bin/python
870 870 \family default
871 871 , then you might have a stale, cached version in your
872 872 \family typewriter
873 873 build/scripts-<python-version>
874 874 \family default
875 875 directory.
876 876 Delete that directory and rerun the
877 877 \family typewriter
878 878 setup.py
879 879 \family default
880 880 .
881 881
882 882 \layout Standard
883 883
884 884 It is also a good idea to use the special flag
885 885 \begin_inset ERT
886 886 status Collapsed
887 887
888 888 \layout Standard
889 889
890 890 \backslash
891 891 verb|--install-scripts|
892 892 \end_inset
893 893
894 894 as indicated above, to ensure that the ipython scripts end up in a location
895 895 which is part of your
896 896 \family typewriter
897 897 $PATH
898 898 \family default
899 899 .
900 900 Otherwise Apple's Python will put the scripts in an internal directory
901 901 not available by default at the command line (if you use
902 902 \family typewriter
903 903 /usr/local/bin
904 904 \family default
905 905 , you need to make sure this is in your
906 906 \family typewriter
907 907 $PATH
908 908 \family default
909 909 , which may not be true by default).
910 910 \layout Subsubsection*
911 911
912 912 Readline problems
913 913 \layout Standard
914 914
915 915 By default, the Python version shipped by Apple does
916 916 \emph on
917 917 not
918 918 \emph default
919 919 include the readline library, so central to IPython's behavior.
920 920 If you install IPython against Apple's Python, you will not have arrow
921 921 keys, tab completion, etc.
922 922 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
923 923 \newline
924 924
925 925 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
926 926
927 927 \end_inset
928 928
929 929
930 930 \layout Standard
931 931
932 932 If you are using OSX 10.4 (Tiger), after installing this package you need
933 933 to either:
934 934 \layout Enumerate
935 935
936 936 move
937 937 \family typewriter
938 938 readline.so
939 939 \family default
940 940 from
941 941 \family typewriter
942 942 /Library/Python/2.3
943 943 \family default
944 944 to
945 945 \family typewriter
946 946 /Library/Python/2.3/site-packages
947 947 \family default
948 948 , or
949 949 \layout Enumerate
950 950
951 951 install
952 952 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
953 953
954 954 \end_inset
955 955
956 956
957 957 \layout Standard
958 958
959 959 Users installing against Fink's Python or a properly hand-built one should
960 960 not have this problem.
961 961 \layout Subsubsection*
962 962
963 963 DarwinPorts
964 964 \layout Standard
965 965
966 966 I report here a message from an OSX user, who suggests an alternative means
967 967 of using IPython under this operating system with good results.
968 968 Please let me know of any updates that may be useful for this section.
969 969 His message is reproduced verbatim below:
970 970 \layout Quote
971 971
972 972 From: Markus Banfi
973 973 \family typewriter
974 974 <markus.banfi-AT-mospheira.net>
975 975 \layout Quote
976 976
977 977 As a MacOS X (10.4.2) user I prefer to install software using DawinPorts instead
978 978 of Fink.
979 979 I had no problems installing ipython with DarwinPorts.
980 980 It's just:
981 981 \layout Quote
982 982
983 983
984 984 \family typewriter
985 985 sudo port install py-ipython
986 986 \layout Quote
987 987
988 988 It automatically resolved all dependencies (python24, readline, py-readline).
989 989 So far I did not encounter any problems with the DarwinPorts port of ipython.
990 990
991 991 \layout Subsection
992 992
993 993
994 994 \begin_inset LatexCommand \label{sub:Under-Windows}
995 995
996 996 \end_inset
997 997
998 998 Windows instructions
999 999 \layout Standard
1000 1000
1001 1001 Some of IPython's very useful features are:
1002 1002 \layout Itemize
1003 1003
1004 1004 Integrated readline support (Tab-based file, object and attribute completion,
1005 1005 input history across sessions, editable command line, etc.)
1006 1006 \layout Itemize
1007 1007
1008 1008 Coloring of prompts, code and tracebacks.
1009 1009 \layout Standard
1010 1010
1011 1011 These, by default, are only available under Unix-like operating systems.
1012 1012 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
1013 1013 from them.
1014 1014 His readline library implements both GNU readline functionality and color
1015 1015 support, so that IPython under Windows XP/2k can be as friendly and powerful
1016 1016 as under Unix-like environments.
1017 1017 \layout Standard
1018 1018
1019 1019 The
1020 1020 \family typewriter
1021 1021 readline
1022 1022 \family default
1023 1023 extension needs two other libraries to work, so in all you need:
1024 1024 \layout Enumerate
1025 1025
1026 1026
1027 1027 \family typewriter
1028 1028 PyWin32
1029 1029 \family default
1030 1030 from
1031 1031 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
1032 1032
1033 1033 \end_inset
1034 1034
1035 1035 .
1036 1036 \layout Enumerate
1037 1037
1038 1038
1039 1039 \family typewriter
1040 1040 CTypes
1041 1041 \family default
1042 1042 from
1043 1043 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1044 1044
1045 1045 \end_inset
1046 1046
1047 1047 (you
1048 1048 \emph on
1049 1049 must
1050 1050 \emph default
1051 1051 use version 0.9.1 or newer).
1052 1052 \layout Enumerate
1053 1053
1054 1054
1055 1055 \family typewriter
1056 1056 Readline
1057 1057 \family default
1058 1058 for Windows from
1059 1059 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
1060 1060
1061 1061 \end_inset
1062 1062
1063 1063 .
1064 1064 \layout Standard
1065 1065
1066 1066
1067 1067 \series bold
1068 1068 Warning about a broken readline-like library:
1069 1069 \series default
1070 1070 several users have reported problems stemming from using the pseudo-readline
1071 1071 library at
1072 1072 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
1073 1073
1074 1074 \end_inset
1075 1075
1076 1076 .
1077 1077 This is a broken library which, while called readline, only implements
1078 1078 an incomplete subset of the readline API.
1079 1079 Since it is still called readline, it fools IPython's detection mechanisms
1080 1080 and causes unpredictable crashes later.
1081 1081 If you wish to use IPython under Windows, you must NOT use this library,
1082 1082 which for all purposes is (at least as of version 1.6) terminally broken.
1083 1083 \layout Subsubsection
1084 1084
1085 1085 Installation procedure
1086 1086 \layout Standard
1087 1087
1088 1088 Once you have the above installed, from the IPython download directory grab
1089 1089 the
1090 1090 \family typewriter
1091 1091 ipython-XXX.win32.exe
1092 1092 \family default
1093 1093 file, where
1094 1094 \family typewriter
1095 1095 XXX
1096 1096 \family default
1097 1097 represents the version number.
1098 1098 This is a regular windows executable installer, which you can simply double-cli
1099 1099 ck to install.
1100 1100 It will add an entry for IPython to your Start Menu, as well as registering
1101 1101 IPython in the Windows list of applications, so you can later uninstall
1102 1102 it from the Control Panel.
1103 1103
1104 1104 \layout Standard
1105 1105
1106 1106 IPython tries to install the configuration information in a directory named
1107 1107
1108 1108 \family typewriter
1109 1109 .ipython
1110 1110 \family default
1111 1111 (
1112 1112 \family typewriter
1113 1113 _ipython
1114 1114 \family default
1115 1115 under Windows) located in your `home' directory.
1116 1116 IPython sets this directory by looking for a
1117 1117 \family typewriter
1118 1118 HOME
1119 1119 \family default
1120 1120 environment variable; if such a variable does not exist, it uses
1121 1121 \family typewriter
1122 1122 HOMEDRIVE
1123 1123 \backslash
1124 1124 HOMEPATH
1125 1125 \family default
1126 1126 (these are always defined by Windows).
1127 1127 This typically gives something like
1128 1128 \family typewriter
1129 1129 C:
1130 1130 \backslash
1131 1131 Documents and Settings
1132 1132 \backslash
1133 1133 YourUserName
1134 1134 \family default
1135 1135 , but your local details may vary.
1136 1136 In this directory you will find all the files that configure IPython's
1137 1137 defaults, and you can put there your profiles and extensions.
1138 1138 This directory is automatically added by IPython to
1139 1139 \family typewriter
1140 1140 sys.path
1141 1141 \family default
1142 1142 , so anything you place there can be found by
1143 1143 \family typewriter
1144 1144 import
1145 1145 \family default
1146 1146 statements.
1147 1147 \layout Paragraph
1148 1148
1149 1149 Upgrading
1150 1150 \layout Standard
1151 1151
1152 1152 For an IPython upgrade, you should first uninstall the previous version.
1153 1153 This will ensure that all files and directories (such as the documentation)
1154 1154 which carry embedded version strings in their names are properly removed.
1155 1155 \layout Paragraph
1156 1156
1157 1157 Manual installation under Win32
1158 1158 \layout Standard
1159 1159
1160 1160 In case the automatic installer does not work for some reason, you can download
1161 1161 the
1162 1162 \family typewriter
1163 1163 ipython-XXX.tar.gz
1164 1164 \family default
1165 1165 file, which contains the full IPython source distribution (the popular
1166 1166 WinZip can read
1167 1167 \family typewriter
1168 1168 .tar.gz
1169 1169 \family default
1170 1170 files).
1171 1171 After uncompressing the archive, you can install it at a command terminal
1172 1172 just like any other Python module, by using
1173 1173 \family typewriter
1174 1174 `python setup.py install'
1175 1175 \family default
1176 1176 .
1177 1177
1178 1178 \layout Standard
1179 1179
1180 1180 After the installation, run the supplied
1181 1181 \family typewriter
1182 1182 win32_manual_post_install.py
1183 1183 \family default
1184 1184 script, which creates the necessary Start Menu shortcuts for you.
1185 1185 \layout Subsection
1186 1186
1187 1187
1188 1188 \begin_inset LatexCommand \label{sec:upgrade}
1189 1189
1190 1190 \end_inset
1191 1191
1192 1192 Upgrading from a previous version
1193 1193 \layout Standard
1194 1194
1195 1195 If you are upgrading from a previous version of IPython, after doing the
1196 1196 routine installation described above, you should call IPython with the
1197 1197
1198 1198 \family typewriter
1199 1199 -upgrade
1200 1200 \family default
1201 1201 option the first time you run your new copy.
1202 1202 This will automatically update your configuration directory while preserving
1203 1203 copies of your old files.
1204 1204 You can then later merge back any personal customizations you may have
1205 1205 made into the new files.
1206 1206 It is a good idea to do this as there may be new options available in the
1207 1207 new configuration files which you will not have.
1208 1208 \layout Standard
1209 1209
1210 1210 Under Windows, if you don't know how to call python scripts with arguments
1211 1211 from a command line, simply delete the old config directory and IPython
1212 1212 will make a new one.
1213 1213 Win2k and WinXP users will find it in
1214 1214 \family typewriter
1215 1215 C:
1216 1216 \backslash
1217 1217 Documents and Settings
1218 1218 \backslash
1219 1219 YourUserName
1220 1220 \backslash
1221 1221 _ipython
1222 1222 \family default
1223 1223 , and Win 9x users under
1224 1224 \family typewriter
1225 1225 C:
1226 1226 \backslash
1227 1227 Program Files
1228 1228 \backslash
1229 1229 IPython
1230 1230 \backslash
1231 1231 _ipython.
1232 1232 \layout Section
1233 1233
1234 1234
1235 1235 \begin_inset LatexCommand \label{sec:good_config}
1236 1236
1237 1237 \end_inset
1238 1238
1239 1239
1240 1240 \begin_inset OptArg
1241 1241 collapsed true
1242 1242
1243 1243 \layout Standard
1244 1244
1245 1245 Initial configuration
1246 1246 \begin_inset ERT
1247 1247 status Collapsed
1248 1248
1249 1249 \layout Standard
1250 1250
1251 1251 \backslash
1252 1252 ldots
1253 1253 \end_inset
1254 1254
1255 1255
1256 1256 \end_inset
1257 1257
1258 1258 Initial configuration of your environment
1259 1259 \layout Standard
1260 1260
1261 1261 This section will help you set various things in your environment for your
1262 1262 IPython sessions to be as efficient as possible.
1263 1263 All of IPython's configuration information, along with several example
1264 1264 files, is stored in a directory named by default
1265 1265 \family typewriter
1266 1266 $HOME/.ipython
1267 1267 \family default
1268 1268 .
1269 1269 You can change this by defining the environment variable
1270 1270 \family typewriter
1271 1271 IPYTHONDIR
1272 1272 \family default
1273 1273 , or at runtime with the command line option
1274 1274 \family typewriter
1275 1275 -ipythondir
1276 1276 \family default
1277 1277 .
1278 1278 \layout Standard
1279 1279
1280 1280 If all goes well, the first time you run IPython it should automatically
1281 1281 create a user copy of the config directory for you, based on its builtin
1282 1282 defaults.
1283 1283 You can look at the files it creates to learn more about configuring the
1284 1284 system.
1285 1285 The main file you will modify to configure IPython's behavior is called
1286 1286
1287 1287 \family typewriter
1288 1288 ipythonrc
1289 1289 \family default
1290 1290 (with a
1291 1291 \family typewriter
1292 1292 .ini
1293 1293 \family default
1294 1294 extension under Windows), included for reference in Sec.
1295 1295
1296 1296 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1297 1297
1298 1298 \end_inset
1299 1299
1300 1300 .
1301 1301 This file is very commented and has many variables you can change to suit
1302 1302 your taste, you can find more details in Sec.
1303 1303
1304 1304 \begin_inset LatexCommand \ref{sec:customization}
1305 1305
1306 1306 \end_inset
1307 1307
1308 1308 .
1309 1309 Here we discuss the basic things you will want to make sure things are
1310 1310 working properly from the beginning.
1311 1311 \layout Subsection
1312 1312
1313 1313
1314 1314 \begin_inset LatexCommand \label{sec:help-access}
1315 1315
1316 1316 \end_inset
1317 1317
1318 1318 Access to the Python help system
1319 1319 \layout Standard
1320 1320
1321 1321 This is true for Python in general (not just for IPython): you should have
1322 1322 an environment variable called
1323 1323 \family typewriter
1324 1324 PYTHONDOCS
1325 1325 \family default
1326 1326 pointing to the directory where your HTML Python documentation lives.
1327 1327 In my system it's
1328 1328 \family typewriter
1329 1329 /usr/share/doc/python-docs-2.3.4/html
1330 1330 \family default
1331 1331 , check your local details or ask your systems administrator.
1332 1332
1333 1333 \layout Standard
1334 1334
1335 1335 This is the directory which holds the HTML version of the Python manuals.
1336 1336 Unfortunately it seems that different Linux distributions package these
1337 1337 files differently, so you may have to look around a bit.
1338 1338 Below I show the contents of this directory on my system for reference:
1339 1339 \layout Standard
1340 1340
1341 1341
1342 1342 \family typewriter
1343 1343 [html]> ls
1344 1344 \newline
1345 1345 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/
1346 1346 about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1347 1347 \layout Standard
1348 1348
1349 1349 You should really make sure this variable is correctly set so that Python's
1350 1350 pydoc-based help system works.
1351 1351 It is a powerful and convenient system with full access to the Python manuals
1352 1352 and all modules accessible to you.
1353 1353 \layout Standard
1354 1354
1355 1355 Under Windows it seems that pydoc finds the documentation automatically,
1356 1356 so no extra setup appears necessary.
1357 1357 \layout Subsection
1358 1358
1359 1359 Editor
1360 1360 \layout Standard
1361 1361
1362 1362 The
1363 1363 \family typewriter
1364 1364 %edit
1365 1365 \family default
1366 1366 command (and its alias
1367 1367 \family typewriter
1368 1368 %ed
1369 1369 \family default
1370 1370 ) will invoke the editor set in your environment as
1371 1371 \family typewriter
1372 1372 EDITOR
1373 1373 \family default
1374 1374 .
1375 1375 If this variable is not set, it will default to
1376 1376 \family typewriter
1377 1377 vi
1378 1378 \family default
1379 1379 under Linux/Unix and to
1380 1380 \family typewriter
1381 1381 notepad
1382 1382 \family default
1383 1383 under Windows.
1384 1384 You may want to set this variable properly and to a lightweight editor
1385 1385 which doesn't take too long to start (that is, something other than a new
1386 1386 instance of
1387 1387 \family typewriter
1388 1388 Emacs
1389 1389 \family default
1390 1390 ).
1391 1391 This way you can edit multi-line code quickly and with the power of a real
1392 1392 editor right inside IPython.
1393 1393
1394 1394 \layout Standard
1395 1395
1396 1396 If you are a dedicated
1397 1397 \family typewriter
1398 1398 Emacs
1399 1399 \family default
1400 1400 user, you should set up the
1401 1401 \family typewriter
1402 1402 Emacs
1403 1403 \family default
1404 1404 server so that new requests are handled by the original process.
1405 1405 This means that almost no time is spent in handling the request (assuming
1406 1406 an
1407 1407 \family typewriter
1408 1408 Emacs
1409 1409 \family default
1410 1410 process is already running).
1411 1411 For this to work, you need to set your
1412 1412 \family typewriter
1413 1413 EDITOR
1414 1414 \family default
1415 1415 environment variable to
1416 1416 \family typewriter
1417 1417 'emacsclient'
1418 1418 \family default
1419 1419 .
1420 1420
1421 1421 \family typewriter
1422 1422
1423 1423 \family default
1424 1424 The code below, supplied by Francois Pinard, can then be used in your
1425 1425 \family typewriter
1426 1426 .emacs
1427 1427 \family default
1428 1428 file to enable the server:
1429 1429 \layout Standard
1430 1430
1431 1431
1432 1432 \family typewriter
1433 1433 (defvar server-buffer-clients)
1434 1434 \newline
1435 1435 (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
1436 1436 \newline
1437 1437
1438 1438 \begin_inset ERT
1439 1439 status Collapsed
1440 1440
1441 1441 \layout Standard
1442 1442
1443 1443 \backslash
1444 1444 hspace*{0mm}
1445 1445 \end_inset
1446 1446
1447 1447 \SpecialChar ~
1448 1448 \SpecialChar ~
1449 1449 (server-start)
1450 1450 \newline
1451 1451
1452 1452 \begin_inset ERT
1453 1453 status Collapsed
1454 1454
1455 1455 \layout Standard
1456 1456
1457 1457 \backslash
1458 1458 hspace*{0mm}
1459 1459 \end_inset
1460 1460
1461 1461 \SpecialChar ~
1462 1462 \SpecialChar ~
1463 1463 (defun fp-kill-server-with-buffer-routine ()
1464 1464 \newline
1465 1465
1466 1466 \begin_inset ERT
1467 1467 status Collapsed
1468 1468
1469 1469 \layout Standard
1470 1470
1471 1471 \backslash
1472 1472 hspace*{0mm}
1473 1473 \end_inset
1474 1474
1475 1475 \SpecialChar ~
1476 1476 \SpecialChar ~
1477 1477 \SpecialChar ~
1478 1478 \SpecialChar ~
1479 1479 (and server-buffer-clients (server-done)))
1480 1480 \newline
1481 1481
1482 1482 \begin_inset ERT
1483 1483 status Collapsed
1484 1484
1485 1485 \layout Standard
1486 1486
1487 1487 \backslash
1488 1488 hspace*{0mm}
1489 1489 \end_inset
1490 1490
1491 1491 \SpecialChar ~
1492 1492 \SpecialChar ~
1493 1493 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1494 1494 \layout Standard
1495 1495
1496 1496 You can also set the value of this editor via the commmand-line option '-
1497 1497 \family typewriter
1498 1498 editor'
1499 1499 \family default
1500 1500 or in your
1501 1501 \family typewriter
1502 1502 ipythonrc
1503 1503 \family default
1504 1504 file.
1505 1505 This is useful if you wish to use specifically for IPython an editor different
1506 1506 from your typical default (and for Windows users who tend to use fewer
1507 1507 environment variables).
1508 1508 \layout Subsection
1509 1509
1510 1510 Color
1511 1511 \layout Standard
1512 1512
1513 1513 The default IPython configuration has most bells and whistles turned on
1514 1514 (they're pretty safe).
1515 1515 But there's one that
1516 1516 \emph on
1517 1517 may
1518 1518 \emph default
1519 1519 cause problems on some systems: the use of color on screen for displaying
1520 1520 information.
1521 1521 This is very useful, since IPython can show prompts and exception tracebacks
1522 1522 with various colors, display syntax-highlighted source code, and in general
1523 1523 make it easier to visually parse information.
1524 1524 \layout Standard
1525 1525
1526 1526 The following terminals seem to handle the color sequences fine:
1527 1527 \layout Itemize
1528 1528
1529 1529 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1530 1530 \layout Itemize
1531 1531
1532 1532 CDE terminal (tested under Solaris).
1533 1533 This one boldfaces light colors.
1534 1534 \layout Itemize
1535 1535
1536 1536 (X)Emacs buffers.
1537 1537 See sec.
1538 1538 \begin_inset LatexCommand \ref{sec:emacs}
1539 1539
1540 1540 \end_inset
1541 1541
1542 1542 for more details on using IPython with (X)Emacs.
1543 1543 \layout Itemize
1544 1544
1545 1545 A Windows (XP/2k) command prompt
1546 1546 \emph on
1547 1547 with Gary Bishop's support extensions
1548 1548 \emph default
1549 1549 .
1550 1550 Gary's extensions are discussed in Sec.\SpecialChar ~
1551 1551
1552 1552 \begin_inset LatexCommand \ref{sub:Under-Windows}
1553 1553
1554 1554 \end_inset
1555 1555
1556 1556 .
1557 1557 \layout Itemize
1558 1558
1559 1559 A Windows (XP/2k) CygWin shell.
1560 1560 Although some users have reported problems; it is not clear whether there
1561 1561 is an issue for everyone or only under specific configurations.
1562 1562 If you have full color support under cygwin, please post to the IPython
1563 1563 mailing list so this issue can be resolved for all users.
1564 1564 \layout Standard
1565 1565
1566 1566 These have shown problems:
1567 1567 \layout Itemize
1568 1568
1569 1569 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1570 1570 or ssh.
1571 1571 \layout Itemize
1572 1572
1573 1573 Windows native command prompt in WinXP/2k,
1574 1574 \emph on
1575 1575 without
1576 1576 \emph default
1577 1577 Gary Bishop's extensions.
1578 1578 Once Gary's readline library is installed, the normal WinXP/2k command
1579 1579 prompt works perfectly.
1580 1580 \layout Standard
1581 1581
1582 1582 Currently the following color schemes are available:
1583 1583 \layout Itemize
1584 1584
1585 1585
1586 1586 \family typewriter
1587 1587 NoColor
1588 1588 \family default
1589 1589 : uses no color escapes at all (all escapes are empty
1590 1590 \begin_inset Quotes eld
1591 1591 \end_inset
1592 1592
1593 1593
1594 1594 \begin_inset Quotes eld
1595 1595 \end_inset
1596 1596
1597 1597 strings).
1598 1598 This 'scheme' is thus fully safe to use in any terminal.
1599 1599 \layout Itemize
1600 1600
1601 1601
1602 1602 \family typewriter
1603 1603 Linux
1604 1604 \family default
1605 1605 : works well in Linux console type environments: dark background with light
1606 1606 fonts.
1607 1607 It uses bright colors for information, so it is difficult to read if you
1608 1608 have a light colored background.
1609 1609 \layout Itemize
1610 1610
1611 1611
1612 1612 \family typewriter
1613 1613 LightBG
1614 1614 \family default
1615 1615 : the basic colors are similar to those in the
1616 1616 \family typewriter
1617 1617 Linux
1618 1618 \family default
1619 1619 scheme but darker.
1620 1620 It is easy to read in terminals with light backgrounds.
1621 1621 \layout Standard
1622 1622
1623 1623 IPython uses colors for two main groups of things: prompts and tracebacks
1624 1624 which are directly printed to the terminal, and the object introspection
1625 1625 system which passes large sets of data through a pager.
1626 1626 \layout Subsubsection
1627 1627
1628 1628 Input/Output prompts and exception tracebacks
1629 1629 \layout Standard
1630 1630
1631 1631 You can test whether the colored prompts and tracebacks work on your system
1632 1632 interactively by typing
1633 1633 \family typewriter
1634 1634 '%colors Linux'
1635 1635 \family default
1636 1636 at the prompt (use '
1637 1637 \family typewriter
1638 1638 %colors LightBG'
1639 1639 \family default
1640 1640 if your terminal has a light background).
1641 1641 If the input prompt shows garbage like:
1642 1642 \newline
1643 1643
1644 1644 \family typewriter
1645 1645 [0;32mIn [[1;32m1[0;32m]: [0;00m
1646 1646 \family default
1647 1647
1648 1648 \newline
1649 1649 instead of (in color) something like:
1650 1650 \newline
1651 1651
1652 1652 \family typewriter
1653 1653 In [1]:
1654 1654 \family default
1655 1655
1656 1656 \newline
1657 1657 this means that your terminal doesn't properly handle color escape sequences.
1658 1658 You can go to a 'no color' mode by typing '
1659 1659 \family typewriter
1660 1660 %colors NoColor
1661 1661 \family default
1662 1662 '.
1663 1663
1664 1664 \layout Standard
1665 1665
1666 You can try using a different terminal emulator program.
1666 You can try using a different terminal emulator program (Emacs users, see
1667 below).
1667 1668 To permanently set your color preferences, edit the file
1668 1669 \family typewriter
1669 1670 $HOME/.ipython/ipythonrc
1670 1671 \family default
1671 1672 and set the
1672 1673 \family typewriter
1673 1674 colors
1674 1675 \family default
1675 1676 option to the desired value.
1676 1677 \layout Subsubsection
1677 1678
1678 1679 Object details (types, docstrings, source code, etc.)
1679 1680 \layout Standard
1680 1681
1681 1682 IPython has a set of special functions for studying the objects you are
1682 1683 working with, discussed in detail in Sec.
1683 1684
1684 1685 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1685 1686
1686 1687 \end_inset
1687 1688
1688 1689 .
1689 1690 But this system relies on passing information which is longer than your
1690 1691 screen through a data pager, such as the common Unix
1691 1692 \family typewriter
1692 1693 less
1693 1694 \family default
1694 1695 and
1695 1696 \family typewriter
1696 1697 more
1697 1698 \family default
1698 1699 programs.
1699 1700 In order to be able to see this information in color, your pager needs
1700 1701 to be properly configured.
1701 1702 I strongly recommend using
1702 1703 \family typewriter
1703 1704 less
1704 1705 \family default
1705 1706 instead of
1706 1707 \family typewriter
1707 1708 more
1708 1709 \family default
1709 1710 , as it seems that
1710 1711 \family typewriter
1711 1712 more
1712 1713 \family default
1713 1714 simply can not understand colored text correctly.
1714 1715 \layout Standard
1715 1716
1716 1717 In order to configure
1717 1718 \family typewriter
1718 1719 less
1719 1720 \family default
1720 1721 as your default pager, do the following:
1721 1722 \layout Enumerate
1722 1723
1723 1724 Set the environment
1724 1725 \family typewriter
1725 1726 PAGER
1726 1727 \family default
1727 1728 variable to
1728 1729 \family typewriter
1729 1730 less
1730 1731 \family default
1731 1732 .
1732 1733 \layout Enumerate
1733 1734
1734 1735 Set the environment
1735 1736 \family typewriter
1736 1737 LESS
1737 1738 \family default
1738 1739 variable to
1739 1740 \family typewriter
1740 1741 -r
1741 1742 \family default
1742 1743 (plus any other options you always want to pass to
1743 1744 \family typewriter
1744 1745 less
1745 1746 \family default
1746 1747 by default).
1747 1748 This tells
1748 1749 \family typewriter
1749 1750 less
1750 1751 \family default
1751 1752 to properly interpret control sequences, which is how color information
1752 1753 is given to your terminal.
1753 1754 \layout Standard
1754 1755
1755 1756 For the
1756 1757 \family typewriter
1757 1758 csh
1758 1759 \family default
1759 1760 or
1760 1761 \family typewriter
1761 1762 tcsh
1762 1763 \family default
1763 1764 shells, add to your
1764 1765 \family typewriter
1765 1766 ~/.cshrc
1766 1767 \family default
1767 1768 file the lines:
1768 1769 \layout Standard
1769 1770
1770 1771
1771 1772 \family typewriter
1772 1773 setenv PAGER less
1773 1774 \newline
1774 1775 setenv LESS -r
1775 1776 \layout Standard
1776 1777
1777 1778 There is similar syntax for other Unix shells, look at your system documentation
1778 1779 for details.
1779 1780 \layout Standard
1780 1781
1781 1782 If you are on a system which lacks proper data pagers (such as Windows),
1782 1783 IPython will use a very limited builtin pager.
1783 1784 \layout Subsection
1784 1785
1785 1786
1786 1787 \begin_inset LatexCommand \label{sec:emacs}
1787 1788
1788 1789 \end_inset
1789 1790
1790 1791 (X)Emacs configuration
1791 1792 \layout Standard
1792 1793
1793 1794 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
1794 1795 (X)Emacs and IPython get along very well.
1795 1796
1796 1797 \layout Standard
1797 1798
1798 1799
1799 1800 \series bold
1800 1801 Important note:
1801 1802 \series default
1802 1803 You will need to use a recent enough version of
1803 1804 \family typewriter
1804 1805 python-mode.el
1805 1806 \family default
1806 1807 , along with the file
1807 1808 \family typewriter
1808 1809 ipython.el
1809 1810 \family default
1810 1811 .
1811 1812 You can check that the version you have of
1812 1813 \family typewriter
1813 1814 python-mode.el
1814 1815 \family default
1815 1816 is new enough by either looking at the revision number in the file itself,
1816 1817 or asking for it in (X)Emacs via
1817 1818 \family typewriter
1818 1819 M-x py-version
1819 1820 \family default
1820 1821 .
1821 1822 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
1822 1823 \layout Standard
1823 1824
1824 1825 The file
1825 1826 \family typewriter
1826 1827 ipython.el
1827 1828 \family default
1828 1829 is included with the IPython distribution, in the documentation directory
1829 1830 (where this manual resides in PDF and HTML formats).
1830 1831 \layout Standard
1831 1832
1832 1833 Once you put these files in your Emacs path, all you need in your
1833 1834 \family typewriter
1834 1835 .emacs
1835 1836 \family default
1836 1837 file is:
1837 \layout Standard
1838
1838 \layout LyX-Code
1839 1839
1840 \family typewriter
1841 1840 (require 'ipython)
1842 1841 \layout Standard
1843 1842
1844 1843 This should give you full support for executing code snippets via IPython,
1845 1844 opening IPython as your Python shell via
1846 1845 \family typewriter
1847 1846 C-c\SpecialChar ~
1848 1847 !
1849 1848 \family default
1850 1849 , etc.
1851 1850
1851 \layout Standard
1852
1853 If you happen to get garbage instead of colored prompts as described in
1854 the previous section, you may need to set also in your
1855 \family typewriter
1856 .emacs
1857 \family default
1858 file:
1859 \layout LyX-Code
1860
1861 (setq ansi-color-for-comint-mode t)
1852 1862 \layout Subsubsection*
1853 1863
1854 1864 Notes
1855 1865 \layout Itemize
1856 1866
1857 1867 There is one caveat you should be aware of: you must start the IPython shell
1858 1868
1859 1869 \emph on
1860 1870 before
1861 1871 \emph default
1862 1872 attempting to execute any code regions via
1863 1873 \family typewriter
1864 1874 C-c\SpecialChar ~
1865 1875 |
1866 1876 \family default
1867 1877 .
1868 1878 Simply type
1869 1879 \family typewriter
1870 1880 C-c\SpecialChar ~
1871 1881 !
1872 1882 \family default
1873 1883 to start IPython before passing any code regions to the interpreter, and
1874 1884 you shouldn't experience any problems.
1875 1885 \newline
1876 1886 This is due to a bug in Python itself, which has been fixed for Python 2.3,
1877 1887 but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]).
1878 1888 \layout Itemize
1879 1889
1880 1890 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
1881 1891 ts should be directed to him through the IPython mailing lists.
1882 1892
1883 1893 \layout Itemize
1884 1894
1885 1895 This code is still somewhat experimental so it's a bit rough around the
1886 1896 edges (although in practice, it works quite well).
1887 1897 \layout Itemize
1888 1898
1889 1899 Be aware that if you customize
1890 1900 \family typewriter
1891 1901 py-python-command
1892 1902 \family default
1893 1903 previously, this value will override what
1894 1904 \family typewriter
1895 1905 ipython.el
1896 1906 \family default
1897 1907 does (because loading the customization variables comes later).
1898 1908 \layout Section
1899 1909
1900 1910
1901 1911 \begin_inset LatexCommand \label{sec:quick_tips}
1902 1912
1903 1913 \end_inset
1904 1914
1905 1915 Quick tips
1906 1916 \layout Standard
1907 1917
1908 1918 IPython can be used as an improved replacement for the Python prompt, and
1909 1919 for that you don't really need to read any more of this manual.
1910 1920 But in this section we'll try to summarize a few tips on how to make the
1911 1921 most effective use of it for everyday Python development, highlighting
1912 1922 things you might miss in the rest of the manual (which is getting long).
1913 1923 We'll give references to parts in the manual which provide more detail
1914 1924 when appropriate.
1915 1925 \layout Standard
1916 1926
1917 1927 The following article by Jeremy Jones provides an introductory tutorial
1918 1928 about IPython:
1919 1929 \newline
1920 1930
1921 1931 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
1922 1932
1923 1933 \end_inset
1924 1934
1925 1935
1926 1936 \layout Itemize
1927 1937
1928 1938 The TAB key.
1929 1939 TAB-completion, especially for attributes, is a convenient way to explore
1930 1940 the structure of any object you're dealing with.
1931 1941 Simply type
1932 1942 \family typewriter
1933 1943 object_name.<TAB>
1934 1944 \family default
1935 1945 and a list of the object's attributes will be printed (see sec.
1936 1946
1937 1947 \begin_inset LatexCommand \ref{sec:readline}
1938 1948
1939 1949 \end_inset
1940 1950
1941 1951 for more).
1942 1952 Tab completion also works on file and directory names, which combined with
1943 1953 IPython's alias system allows you to do from within IPython many of the
1944 1954 things you normally would need the system shell for.
1945 1955
1946 1956 \layout Itemize
1947 1957
1948 1958 Explore your objects.
1949 1959 Typing
1950 1960 \family typewriter
1951 1961 object_name?
1952 1962 \family default
1953 1963 will print all sorts of details about any object, including docstrings,
1954 1964 function definition lines (for call arguments) and constructor details
1955 1965 for classes.
1956 1966 The magic commands
1957 1967 \family typewriter
1958 1968 %pdoc
1959 1969 \family default
1960 1970 ,
1961 1971 \family typewriter
1962 1972 %pdef
1963 1973 \family default
1964 1974 ,
1965 1975 \family typewriter
1966 1976 %psource
1967 1977 \family default
1968 1978 and
1969 1979 \family typewriter
1970 1980 %pfile
1971 1981 \family default
1972 1982 will respectively print the docstring, function definition line, full source
1973 1983 code and the complete file for any object (when they can be found).
1974 1984 If automagic is on (it is by default), you don't need to type the '
1975 1985 \family typewriter
1976 1986 %
1977 1987 \family default
1978 1988 ' explicitly.
1979 1989 See sec.
1980 1990
1981 1991 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1982 1992
1983 1993 \end_inset
1984 1994
1985 1995 for more.
1986 1996 \layout Itemize
1987 1997
1988 1998 The
1989 1999 \family typewriter
1990 2000 %run
1991 2001 \family default
1992 2002 magic command allows you to run any python script and load all of its data
1993 2003 directly into the interactive namespace.
1994 2004 Since the file is re-read from disk each time, changes you make to it are
1995 2005 reflected immediately (in contrast to the behavior of
1996 2006 \family typewriter
1997 2007 import
1998 2008 \family default
1999 2009 ).
2000 2010 I rarely use
2001 2011 \family typewriter
2002 2012 import
2003 2013 \family default
2004 2014 for code I am testing, relying on
2005 2015 \family typewriter
2006 2016 %run
2007 2017 \family default
2008 2018 instead.
2009 2019 See sec.
2010 2020
2011 2021 \begin_inset LatexCommand \ref{sec:magic}
2012 2022
2013 2023 \end_inset
2014 2024
2015 2025 for more on this and other magic commands, or type the name of any magic
2016 2026 command and ? to get details on it.
2017 2027 See also sec.
2018 2028
2019 2029 \begin_inset LatexCommand \ref{sec:dreload}
2020 2030
2021 2031 \end_inset
2022 2032
2023 2033 for a recursive reload command.
2024 2034 \newline
2025 2035
2026 2036 \family typewriter
2027 2037 %run
2028 2038 \family default
2029 2039 also has special flags for timing the execution of your scripts (
2030 2040 \family typewriter
2031 2041 -t
2032 2042 \family default
2033 2043 ) and for executing them under the control of either Python's
2034 2044 \family typewriter
2035 2045 pdb
2036 2046 \family default
2037 2047 debugger (
2038 2048 \family typewriter
2039 2049 -d
2040 2050 \family default
2041 2051 ) or profiler (
2042 2052 \family typewriter
2043 2053 -p
2044 2054 \family default
2045 2055 ).
2046 2056 With all of these,
2047 2057 \family typewriter
2048 2058 %run
2049 2059 \family default
2050 2060 can be used as the main tool for efficient interactive development of code
2051 2061 which you write in your editor of choice.
2052 2062 \layout Itemize
2053 2063
2054 2064 Use the Python debugger,
2055 2065 \family typewriter
2056 2066 pdb
2057 2067 \family default
2058 2068
2059 2069 \begin_inset Foot
2060 2070 collapsed true
2061 2071
2062 2072 \layout Standard
2063 2073
2064 2074 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2065 2075 to IPython's improved debugger and profiler support.
2066 2076 \end_inset
2067 2077
2068 2078 .
2069 2079 The
2070 2080 \family typewriter
2071 2081 %pdb
2072 2082 \family default
2073 2083 command allows you to toggle on and off the automatic invocation of an
2074 2084 IPython-enhanced
2075 2085 \family typewriter
2076 2086 pdb
2077 2087 \family default
2078 2088 debugger (with coloring, tab completion and more) at any uncaught exception.
2079 2089 The advantage of this is that
2080 2090 \family typewriter
2081 2091 pdb
2082 2092 \family default
2083 2093 starts
2084 2094 \emph on
2085 2095 inside
2086 2096 \emph default
2087 2097 the function where the exception occurred, with all data still available.
2088 2098 You can print variables, see code, execute statements and even walk up
2089 2099 and down the call stack to track down the true source of the problem (which
2090 2100 often is many layers in the stack above where the exception gets triggered).
2091 2101 \newline
2092 2102 Running programs with
2093 2103 \family typewriter
2094 2104 %run
2095 2105 \family default
2096 2106 and pdb active can be an efficient to develop and debug code, in many cases
2097 2107 eliminating the need for
2098 2108 \family typewriter
2099 2109 print
2100 2110 \family default
2101 2111 statements or external debugging tools.
2102 2112 I often simply put a
2103 2113 \family typewriter
2104 2114 1/0
2105 2115 \family default
2106 2116 in a place where I want to take a look so that pdb gets called, quickly
2107 2117 view whatever variables I need to or test various pieces of code and then
2108 2118 remove the
2109 2119 \family typewriter
2110 2120 1/0
2111 2121 \family default
2112 2122 .
2113 2123 \newline
2114 2124 Note also that `
2115 2125 \family typewriter
2116 2126 %run -d
2117 2127 \family default
2118 2128 ' activates
2119 2129 \family typewriter
2120 2130 pdb
2121 2131 \family default
2122 2132 and automatically sets initial breakpoints for you to step through your
2123 2133 code, watch variables, etc.
2124 2134 See Sec.\SpecialChar ~
2125 2135
2126 2136 \begin_inset LatexCommand \ref{sec:cache_output}
2127 2137
2128 2138 \end_inset
2129 2139
2130 2140 for details.
2131 2141 \layout Itemize
2132 2142
2133 2143 Use the output cache.
2134 2144 All output results are automatically stored in a global dictionary named
2135 2145
2136 2146 \family typewriter
2137 2147 Out
2138 2148 \family default
2139 2149 and variables named
2140 2150 \family typewriter
2141 2151 _1
2142 2152 \family default
2143 2153 ,
2144 2154 \family typewriter
2145 2155 _2
2146 2156 \family default
2147 2157 , etc.
2148 2158 alias them.
2149 2159 For example, the result of input line 4 is available either as
2150 2160 \family typewriter
2151 2161 Out[4]
2152 2162 \family default
2153 2163 or as
2154 2164 \family typewriter
2155 2165 _4
2156 2166 \family default
2157 2167 .
2158 2168 Additionally, three variables named
2159 2169 \family typewriter
2160 2170 _
2161 2171 \family default
2162 2172 ,
2163 2173 \family typewriter
2164 2174 __
2165 2175 \family default
2166 2176 and
2167 2177 \family typewriter
2168 2178 ___
2169 2179 \family default
2170 2180 are always kept updated with the for the last three results.
2171 2181 This allows you to recall any previous result and further use it for new
2172 2182 calculations.
2173 2183 See Sec.\SpecialChar ~
2174 2184
2175 2185 \begin_inset LatexCommand \ref{sec:cache_output}
2176 2186
2177 2187 \end_inset
2178 2188
2179 2189 for more.
2180 2190 \layout Itemize
2181 2191
2182 2192 Put a '
2183 2193 \family typewriter
2184 2194 ;
2185 2195 \family default
2186 2196 ' at the end of a line to supress the printing of output.
2187 2197 This is useful when doing calculations which generate long output you are
2188 2198 not interested in seeing.
2189 2199 The
2190 2200 \family typewriter
2191 2201 _*
2192 2202 \family default
2193 2203 variables and the
2194 2204 \family typewriter
2195 2205 Out[]
2196 2206 \family default
2197 2207 list do get updated with the contents of the output, even if it is not
2198 2208 printed.
2199 2209 You can thus still access the generated results this way for further processing.
2200 2210 \layout Itemize
2201 2211
2202 2212 A similar system exists for caching input.
2203 2213 All input is stored in a global list called
2204 2214 \family typewriter
2205 2215 In
2206 2216 \family default
2207 2217 , so you can re-execute lines 22 through 28 plus line 34 by typing
2208 2218 \family typewriter
2209 2219 'exec In[22:29]+In[34]'
2210 2220 \family default
2211 2221 (using Python slicing notation).
2212 2222 If you need to execute the same set of lines often, you can assign them
2213 2223 to a macro with the
2214 2224 \family typewriter
2215 2225 %macro
2216 2226 \family default
2217 2227
2218 2228 \family typewriter
2219 2229 function.
2220 2230
2221 2231 \family default
2222 2232 See sec.
2223 2233
2224 2234 \begin_inset LatexCommand \ref{sec:cache_input}
2225 2235
2226 2236 \end_inset
2227 2237
2228 2238 for more.
2229 2239 \layout Itemize
2230 2240
2231 2241 Use your input history.
2232 2242 The
2233 2243 \family typewriter
2234 2244 %hist
2235 2245 \family default
2236 2246 command can show you all previous input, without line numbers if desired
2237 2247 (option
2238 2248 \family typewriter
2239 2249 -n
2240 2250 \family default
2241 2251 ) so you can directly copy and paste code either back in IPython or in a
2242 2252 text editor.
2243 2253 You can also save all your history by turning on logging via
2244 2254 \family typewriter
2245 2255 %logstart
2246 2256 \family default
2247 2257 ; these logs can later be either reloaded as IPython sessions or used as
2248 2258 code for your programs.
2249 2259 \layout Itemize
2250 2260
2251 2261 Define your own system aliases.
2252 2262 Even though IPython gives you access to your system shell via the
2253 2263 \family typewriter
2254 2264 !
2255 2265 \family default
2256 2266 prefix, it is convenient to have aliases to the system commands you use
2257 2267 most often.
2258 2268 This allows you to work seamlessly from inside IPython with the same commands
2259 2269 you are used to in your system shell.
2260 2270 \newline
2261 2271 IPython comes with some pre-defined aliases and a complete system for changing
2262 2272 directories, both via a stack (see
2263 2273 \family typewriter
2264 2274 %pushd
2265 2275 \family default
2266 2276 ,
2267 2277 \family typewriter
2268 2278 %popd
2269 2279 \family default
2270 2280 and
2271 2281 \family typewriter
2272 2282 %ds
2273 2283 \family default
2274 2284 ) and via direct
2275 2285 \family typewriter
2276 2286 %cd
2277 2287 \family default
2278 2288 .
2279 2289 The latter keeps a history of visited directories and allows you to go
2280 2290 to any previously visited one.
2281 2291 \layout Itemize
2282 2292
2283 2293 Use Python to manipulate the results of system commands.
2284 2294 The `
2285 2295 \family typewriter
2286 2296 !!
2287 2297 \family default
2288 2298 ' special syntax, and the
2289 2299 \family typewriter
2290 2300 %sc
2291 2301 \family default
2292 2302 and
2293 2303 \family typewriter
2294 2304 %sx
2295 2305 \family default
2296 2306 magic commands allow you to capture system output into Python variables.
2297 2307 \layout Itemize
2298 2308
2299 2309 Expand python variables when calling the shell (either via
2300 2310 \family typewriter
2301 2311 `!'
2302 2312 \family default
2303 2313 and
2304 2314 \family typewriter
2305 2315 `!!'
2306 2316 \family default
2307 2317 or via aliases) by prepending a
2308 2318 \family typewriter
2309 2319 $
2310 2320 \family default
2311 2321 in front of them.
2312 2322 You can also expand complete python expressions.
2313 2323 See sec.\SpecialChar ~
2314 2324
2315 2325 \begin_inset LatexCommand \ref{sub:System-shell-access}
2316 2326
2317 2327 \end_inset
2318 2328
2319 2329 for more.
2320 2330 \layout Itemize
2321 2331
2322 2332 Use profiles to maintain different configurations (modules to load, function
2323 2333 definitions, option settings) for particular tasks.
2324 2334 You can then have customized versions of IPython for specific purposes.
2325 2335 See sec.\SpecialChar ~
2326 2336
2327 2337 \begin_inset LatexCommand \ref{sec:profiles}
2328 2338
2329 2339 \end_inset
2330 2340
2331 2341 for more.
2332 2342 \layout Itemize
2333 2343
2334 2344 Embed IPython in your programs.
2335 2345 A few lines of code are enough to load a complete IPython inside your own
2336 2346 programs, giving you the ability to work with your data interactively after
2337 2347 automatic processing has been completed.
2338 2348 See sec.\SpecialChar ~
2339 2349
2340 2350 \begin_inset LatexCommand \ref{sec:embed}
2341 2351
2342 2352 \end_inset
2343 2353
2344 2354 for more.
2345 2355 \layout Itemize
2346 2356
2347 2357 Use the Python profiler.
2348 2358 When dealing with performance issues, the
2349 2359 \family typewriter
2350 2360 %run
2351 2361 \family default
2352 2362 command with a
2353 2363 \family typewriter
2354 2364 -p
2355 2365 \family default
2356 2366 option allows you to run complete programs under the control of the Python
2357 2367 profiler.
2358 2368 The
2359 2369 \family typewriter
2360 2370 %prun
2361 2371 \family default
2362 2372 command does a similar job for single Python expressions (like function
2363 2373 calls).
2364 2374 \layout Itemize
2365 2375
2366 2376 Use the IPython.demo.Demo class to load any Python script as an interactive
2367 2377 demo.
2368 2378 With a minimal amount of simple markup, you can control the execution of
2369 2379 the script, stopping as needed.
2370 2380 See sec.\SpecialChar ~
2371 2381
2372 2382 \begin_inset LatexCommand \ref{sec:interactive-demos}
2373 2383
2374 2384 \end_inset
2375 2385
2376 2386 for more.
2377 2387 \layout Subsection
2378 2388
2379 2389 Source code handling tips
2380 2390 \layout Standard
2381 2391
2382 2392 IPython is a line-oriented program, without full control of the terminal.
2383 2393 Therefore, it doesn't support true multiline editing.
2384 2394 However, it has a number of useful tools to help you in dealing effectively
2385 2395 with more complex editing.
2386 2396 \layout Standard
2387 2397
2388 2398 The
2389 2399 \family typewriter
2390 2400 %edit
2391 2401 \family default
2392 2402 command gives a reasonable approximation of multiline editing, by invoking
2393 2403 your favorite editor on the spot.
2394 2404 IPython will execute the code you type in there as if it were typed interactive
2395 2405 ly.
2396 2406 Type
2397 2407 \family typewriter
2398 2408 %edit?
2399 2409 \family default
2400 2410 for the full details on the edit command.
2401 2411 \layout Standard
2402 2412
2403 2413 If you have typed various commands during a session, which you'd like to
2404 2414 reuse, IPython provides you with a number of tools.
2405 2415 Start by using
2406 2416 \family typewriter
2407 2417 %hist
2408 2418 \family default
2409 2419 to see your input history, so you can see the line numbers of all input.
2410 2420 Let us say that you'd like to reuse lines 10 through 20, plus lines 24
2411 2421 and 28.
2412 2422 All the commands below can operate on these with the syntax
2413 2423 \layout LyX-Code
2414 2424
2415 2425 %command 10-20 24 28
2416 2426 \layout Standard
2417 2427
2418 2428 where the command given can be:
2419 2429 \layout Itemize
2420 2430
2421 2431
2422 2432 \family typewriter
2423 2433 %macro <macroname>
2424 2434 \family default
2425 2435 : this stores the lines into a variable which, when called at the prompt,
2426 2436 re-executes the input.
2427 2437 Macros can be edited later using
2428 2438 \family typewriter
2429 2439 `%edit macroname
2430 2440 \family default
2431 2441 ', and they can be stored persistently across sessions with `
2432 2442 \family typewriter
2433 2443 %store macroname
2434 2444 \family default
2435 2445 ' (the storage system is per-profile).
2436 2446 The combination of quick macros, persistent storage and editing, allows
2437 2447 you to easily refine quick-and-dirty interactive input into permanent utilities
2438 2448 , always available both in IPython and as files for general reuse.
2439 2449 \layout Itemize
2440 2450
2441 2451
2442 2452 \family typewriter
2443 2453 %edit
2444 2454 \family default
2445 2455 : this will open a text editor with those lines pre-loaded for further modificat
2446 2456 ion.
2447 2457 It will then execute the resulting file's contents as if you had typed
2448 2458 it at the prompt.
2449 2459 \layout Itemize
2450 2460
2451 2461
2452 2462 \family typewriter
2453 2463 %save <filename>
2454 2464 \family default
2455 2465 : this saves the lines directly to a named file on disk.
2456 2466 \layout Standard
2457 2467
2458 2468 While
2459 2469 \family typewriter
2460 2470 %macro
2461 2471 \family default
2462 2472 saves input lines into memory for interactive re-execution, sometimes you'd
2463 2473 like to save your input directly to a file.
2464 2474 The
2465 2475 \family typewriter
2466 2476 %save
2467 2477 \family default
2468 2478 magic does this: its input sytnax is the same as
2469 2479 \family typewriter
2470 2480 %macro
2471 2481 \family default
2472 2482 , but it saves your input directly to a Python file.
2473 2483 Note that the
2474 2484 \family typewriter
2475 2485 %logstart
2476 2486 \family default
2477 2487 command also saves input, but it logs
2478 2488 \emph on
2479 2489 all
2480 2490 \emph default
2481 2491 input to disk (though you can temporarily suspend it and reactivate it
2482 2492 with
2483 2493 \family typewriter
2484 2494 %logoff/%logon
2485 2495 \family default
2486 2496 );
2487 2497 \family typewriter
2488 2498 %save
2489 2499 \family default
2490 2500 allows you to select which lines of input you need to save.
2491 2501 \layout Subsubsection*
2492 2502
2493 2503 Lightweight 'version control'
2494 2504 \layout Standard
2495 2505
2496 2506 When you call
2497 2507 \family typewriter
2498 2508 %edit
2499 2509 \family default
2500 2510 with no arguments, IPython opens an empty editor with a temporary file,
2501 2511 and it returns the contents of your editing session as a string variable.
2502 2512 Thanks to IPython's output caching mechanism, this is automatically stored:
2503 2513 \layout LyX-Code
2504 2514
2505 2515 In [1]: %edit
2506 2516 \layout LyX-Code
2507 2517
2508 2518 IPython will make a temporary file named: /tmp/ipython_edit_yR-HCN.py
2509 2519 \layout LyX-Code
2510 2520
2511 2521 Editing...
2512 2522 done.
2513 2523 Executing edited code...
2514 2524 \layout LyX-Code
2515 2525
2516 2526 hello - this is a temporary file
2517 2527 \layout LyX-Code
2518 2528
2519 2529 Out[1]: "print 'hello - this is a temporary file'
2520 2530 \backslash
2521 2531 n"
2522 2532 \layout Standard
2523 2533
2524 2534 Now, if you call
2525 2535 \family typewriter
2526 2536 `%edit -p'
2527 2537 \family default
2528 2538 , IPython tries to open an editor with the same data as the last time you
2529 2539 used
2530 2540 \family typewriter
2531 2541 %edit
2532 2542 \family default
2533 2543 .
2534 2544 So if you haven't used
2535 2545 \family typewriter
2536 2546 %edit
2537 2547 \family default
2538 2548 in the meantime, this same contents will reopen; however, it will be done
2539 2549 in a
2540 2550 \emph on
2541 2551 new file
2542 2552 \emph default
2543 2553 .
2544 2554 This means that if you make changes and you later want to find an old version,
2545 2555 you can always retrieve it by using its output number, via
2546 2556 \family typewriter
2547 2557 `%edit _NN'
2548 2558 \family default
2549 2559 , where
2550 2560 \family typewriter
2551 2561 NN
2552 2562 \family default
2553 2563 is the number of the output prompt.
2554 2564 \layout Standard
2555 2565
2556 2566 Continuing with the example above, this should illustrate this idea:
2557 2567 \layout LyX-Code
2558 2568
2559 2569 In [2]: edit -p
2560 2570 \layout LyX-Code
2561 2571
2562 2572 IPython will make a temporary file named: /tmp/ipython_edit_nA09Qk.py
2563 2573 \layout LyX-Code
2564 2574
2565 2575 Editing...
2566 2576 done.
2567 2577 Executing edited code...
2568 2578 \layout LyX-Code
2569 2579
2570 2580 hello - now I made some changes
2571 2581 \layout LyX-Code
2572 2582
2573 2583 Out[2]: "print 'hello - now I made some changes'
2574 2584 \backslash
2575 2585 n"
2576 2586 \layout LyX-Code
2577 2587
2578 2588 In [3]: edit _1
2579 2589 \layout LyX-Code
2580 2590
2581 2591 IPython will make a temporary file named: /tmp/ipython_edit_gy6-zD.py
2582 2592 \layout LyX-Code
2583 2593
2584 2594 Editing...
2585 2595 done.
2586 2596 Executing edited code...
2587 2597 \layout LyX-Code
2588 2598
2589 2599 hello - this is a temporary file
2590 2600 \layout LyX-Code
2591 2601
2592 2602 IPython version control at work :)
2593 2603 \layout LyX-Code
2594 2604
2595 2605 Out[3]: "print 'hello - this is a temporary file'
2596 2606 \backslash
2597 2607 nprint 'IPython version control at work :)'
2598 2608 \backslash
2599 2609 n"
2600 2610 \layout Standard
2601 2611
2602 2612 This section was written after a contribution by Alexander Belchenko on
2603 2613 the IPython user list.
2604 2614 \layout LyX-Code
2605 2615
2606 2616 \layout Subsection
2607 2617
2608 2618 Effective logging
2609 2619 \layout Standard
2610 2620
2611 2621 A very useful suggestion sent in by Robert Kern follows:
2612 2622 \layout Standard
2613 2623
2614 2624 I recently happened on a nifty way to keep tidy per-project log files.
2615 2625 I made a profile for my project (which is called "parkfield").
2616 2626 \layout LyX-Code
2617 2627
2618 2628 include ipythonrc
2619 2629 \layout LyX-Code
2620 2630
2621 2631 # cancel earlier logfile invocation:
2622 2632 \layout LyX-Code
2623 2633
2624 2634 logfile ''
2625 2635 \layout LyX-Code
2626 2636
2627 2637 execute import time
2628 2638 \layout LyX-Code
2629 2639
2630 2640 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
2631 2641 \layout LyX-Code
2632 2642
2633 2643 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
2634 2644 \layout Standard
2635 2645
2636 2646 I also added a shell alias for convenience:
2637 2647 \layout LyX-Code
2638 2648
2639 2649 alias parkfield="ipython -pylab -profile parkfield"
2640 2650 \layout Standard
2641 2651
2642 2652 Now I have a nice little directory with everything I ever type in, organized
2643 2653 by project and date.
2644 2654 \layout Standard
2645 2655
2646 2656
2647 2657 \series bold
2648 2658 Contribute your own:
2649 2659 \series default
2650 2660 If you have your own favorite tip on using IPython efficiently for a certain
2651 2661 task (especially things which can't be done in the normal Python interpreter),
2652 2662 don't hesitate to send it!
2653 2663 \layout Section
2654 2664
2655 2665 Command-line use
2656 2666 \layout Standard
2657 2667
2658 2668 You start IPython with the command:
2659 2669 \layout Standard
2660 2670
2661 2671
2662 2672 \family typewriter
2663 2673 $ ipython [options] files
2664 2674 \layout Standard
2665 2675
2666 2676 If invoked with no options, it executes all the files listed in sequence
2667 2677 and drops you into the interpreter while still acknowledging any options
2668 2678 you may have set in your ipythonrc file.
2669 2679 This behavior is different from standard Python, which when called as
2670 2680 \family typewriter
2671 2681 python -i
2672 2682 \family default
2673 2683 will only execute one file and ignore your configuration setup.
2674 2684 \layout Standard
2675 2685
2676 2686 Please note that some of the configuration options are not available at
2677 2687 the command line, simply because they are not practical here.
2678 2688 Look into your ipythonrc configuration file for details on those.
2679 2689 This file typically installed in the
2680 2690 \family typewriter
2681 2691 $HOME/.ipython
2682 2692 \family default
2683 2693 directory.
2684 2694 For Windows users,
2685 2695 \family typewriter
2686 2696 $HOME
2687 2697 \family default
2688 2698 resolves to
2689 2699 \family typewriter
2690 2700 C:
2691 2701 \backslash
2692 2702
2693 2703 \backslash
2694 2704 Documents and Settings
2695 2705 \backslash
2696 2706
2697 2707 \backslash
2698 2708 YourUserName
2699 2709 \family default
2700 2710 in most instances.
2701 2711 In the rest of this text, we will refer to this directory as
2702 2712 \family typewriter
2703 2713 IPYTHONDIR
2704 2714 \family default
2705 2715 .
2706 2716 \layout Subsection
2707 2717
2708 2718
2709 2719 \begin_inset LatexCommand \label{sec:threading-opts}
2710 2720
2711 2721 \end_inset
2712 2722
2713 2723 Special Threading Options
2714 2724 \layout Standard
2715 2725
2716 2726 The following special options are ONLY valid at the beginning of the command
2717 2727 line, and not later.
2718 2728 This is because they control the initial- ization of ipython itself, before
2719 2729 the normal option-handling mechanism is active.
2720 2730 \layout List
2721 2731 \labelwidthstring 00.00.0000
2722 2732
2723 2733
2724 2734 \family typewriter
2725 2735 \series bold
2726 2736 -gthread,\SpecialChar ~
2727 2737 -qthread,\SpecialChar ~
2728 2738 -wthread,\SpecialChar ~
2729 2739 -pylab:
2730 2740 \family default
2731 2741 \series default
2732 2742 Only
2733 2743 \emph on
2734 2744 one
2735 2745 \emph default
2736 2746 of these can be given, and it can only be given as the first option passed
2737 2747 to IPython (it will have no effect in any other position).
2738 2748 They provide threading support for the GTK Qt and WXPython toolkits, and
2739 2749 for the matplotlib library.
2740 2750 \layout List
2741 2751 \labelwidthstring 00.00.0000
2742 2752
2743 2753 \SpecialChar ~
2744 2754 With any of the first three options, IPython starts running a separate
2745 2755 thread for the graphical toolkit's operation, so that you can open and
2746 2756 control graphical elements from within an IPython command line, without
2747 2757 blocking.
2748 2758 All three provide essentially the same functionality, respectively for
2749 2759 GTK, QT and WXWidgets (via their Python interfaces).
2750 2760 \layout List
2751 2761 \labelwidthstring 00.00.0000
2752 2762
2753 2763 \SpecialChar ~
2754 2764 Note that with
2755 2765 \family typewriter
2756 2766 -wthread
2757 2767 \family default
2758 2768 , you can additionally use the -wxversion option to request a specific version
2759 2769 of wx to be used.
2760 2770 This requires that you have the
2761 2771 \family typewriter
2762 2772 wxversion
2763 2773 \family default
2764 2774 Python module installed, which is part of recent wxPython distributions.
2765 2775 \layout List
2766 2776 \labelwidthstring 00.00.0000
2767 2777
2768 2778 \SpecialChar ~
2769 2779 If
2770 2780 \family typewriter
2771 2781 -pylab
2772 2782 \family default
2773 2783 is given, IPython loads special support for the mat plotlib library (
2774 2784 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
2775 2785
2776 2786 \end_inset
2777 2787
2778 2788 ), allowing interactive usage of any of its backends as defined in the user's
2779 2789
2780 2790 \family typewriter
2781 2791 ~/.matplotlib/matplotlibrc
2782 2792 \family default
2783 2793 file.
2784 2794 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
2785 2795 of matplotlib backend requires it.
2786 2796 It also modifies the
2787 2797 \family typewriter
2788 2798 %run
2789 2799 \family default
2790 2800 command to correctly execute (without blocking) any matplotlib-based script
2791 2801 which calls
2792 2802 \family typewriter
2793 2803 show()
2794 2804 \family default
2795 2805 at the end.
2796 2806
2797 2807 \layout List
2798 2808 \labelwidthstring 00.00.0000
2799 2809
2800 2810
2801 2811 \family typewriter
2802 2812 \series bold
2803 2813 -tk
2804 2814 \family default
2805 2815 \series default
2806 2816 The
2807 2817 \family typewriter
2808 2818 -g/q/wthread
2809 2819 \family default
2810 2820 options, and
2811 2821 \family typewriter
2812 2822 -pylab
2813 2823 \family default
2814 2824 (if matplotlib is configured to use GTK, Qt or WX), will normally block
2815 2825 Tk graphical interfaces.
2816 2826 This means that when either GTK, Qt or WX threading is active, any attempt
2817 2827 to open a Tk GUI will result in a dead window, and possibly cause the Python
2818 2828 interpreter to crash.
2819 2829 An extra option,
2820 2830 \family typewriter
2821 2831 -tk
2822 2832 \family default
2823 2833 , is available to address this issue.
2824 2834 It can
2825 2835 \emph on
2826 2836 only
2827 2837 \emph default
2828 2838 be given as a
2829 2839 \emph on
2830 2840 second
2831 2841 \emph default
2832 2842 option after any of the above (
2833 2843 \family typewriter
2834 2844 -gthread
2835 2845 \family default
2836 2846 ,
2837 2847 \family typewriter
2838 2848 -wthread
2839 2849 \family default
2840 2850 or
2841 2851 \family typewriter
2842 2852 -pylab
2843 2853 \family default
2844 2854 ).
2845 2855 \layout List
2846 2856 \labelwidthstring 00.00.0000
2847 2857
2848 2858 \SpecialChar ~
2849 2859 If
2850 2860 \family typewriter
2851 2861 -tk
2852 2862 \family default
2853 2863 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
2854 2864 This is however potentially unreliable, and you will have to test on your
2855 2865 platform and Python configuration to determine whether it works for you.
2856 2866 Debian users have reported success, apparently due to the fact that Debian
2857 2867 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
2858 2868 Under other Linux environments (such as Fedora Core 2/3), this option has
2859 2869 caused random crashes and lockups of the Python interpreter.
2860 2870 Under other operating systems (Mac OSX and Windows), you'll need to try
2861 2871 it to find out, since currently no user reports are available.
2862 2872 \layout List
2863 2873 \labelwidthstring 00.00.0000
2864 2874
2865 2875 \SpecialChar ~
2866 2876 There is unfortunately no way for IPython to determine at run time whether
2867 2877
2868 2878 \family typewriter
2869 2879 -tk
2870 2880 \family default
2871 2881 will work reliably or not, so you will need to do some experiments before
2872 2882 relying on it for regular work.
2873 2883
2874 2884 \layout Subsection
2875 2885
2876 2886
2877 2887 \begin_inset LatexCommand \label{sec:cmd-line-opts}
2878 2888
2879 2889 \end_inset
2880 2890
2881 2891 Regular Options
2882 2892 \layout Standard
2883 2893
2884 2894 After the above threading options have been given, regular options can follow
2885 2895 in any order.
2886 2896 All options can be abbreviated to their shortest non-ambiguous form and
2887 2897 are case-sensitive.
2888 2898 One or two dashes can be used.
2889 2899 Some options have an alternate short form, indicated after a
2890 2900 \family typewriter
2891 2901 |
2892 2902 \family default
2893 2903 .
2894 2904 \layout Standard
2895 2905
2896 2906 Most options can also be set from your ipythonrc configuration file.
2897 2907 See the provided example for more details on what the options do.
2898 2908 Options given at the command line override the values set in the ipythonrc
2899 2909 file.
2900 2910 \layout Standard
2901 2911
2902 2912 All options with a
2903 2913 \family typewriter
2904 2914 [no]
2905 2915 \family default
2906 2916 prepended can be specified in negated form (
2907 2917 \family typewriter
2908 2918 -nooption
2909 2919 \family default
2910 2920 instead of
2911 2921 \family typewriter
2912 2922 -option
2913 2923 \family default
2914 2924 ) to turn the feature off.
2915 2925 \layout List
2916 2926 \labelwidthstring 00.00.0000
2917 2927
2918 2928
2919 2929 \family typewriter
2920 2930 \series bold
2921 2931 -help
2922 2932 \family default
2923 2933 \series default
2924 2934 : print a help message and exit.
2925 2935 \layout List
2926 2936 \labelwidthstring 00.00.0000
2927 2937
2928 2938
2929 2939 \family typewriter
2930 2940 \series bold
2931 2941 -pylab:
2932 2942 \family default
2933 2943 \series default
2934 2944 this can
2935 2945 \emph on
2936 2946 only
2937 2947 \emph default
2938 2948 be given as the
2939 2949 \emph on
2940 2950 first
2941 2951 \emph default
2942 2952 option passed to IPython (it will have no effect in any other position).
2943 2953 It adds special support for the matplotlib library (
2944 2954 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
2945 2955
2946 2956 \end_inset
2947 2957
2948 2958 ), allowing interactive usage of any of its backends as defined in the user's
2949 2959
2950 2960 \family typewriter
2951 2961 .matplotlibrc
2952 2962 \family default
2953 2963 file.
2954 2964 It automatically activates GTK or WX threading for IPyhton if the choice
2955 2965 of matplotlib backend requires it.
2956 2966 It also modifies the
2957 2967 \family typewriter
2958 2968 %run
2959 2969 \family default
2960 2970 command to correctly execute (without blocking) any matplotlib-based script
2961 2971 which calls
2962 2972 \family typewriter
2963 2973 show()
2964 2974 \family default
2965 2975 at the end.
2966 2976 See Sec.\SpecialChar ~
2967 2977
2968 2978 \begin_inset LatexCommand \ref{sec:matplotlib-support}
2969 2979
2970 2980 \end_inset
2971 2981
2972 2982 for more details.
2973 2983 \layout List
2974 2984 \labelwidthstring 00.00.0000
2975 2985
2976 2986
2977 2987 \family typewriter
2978 2988 \series bold
2979 2989 -autocall <val>:
2980 2990 \family default
2981 2991 \series default
2982 2992 Make IPython automatically call any callable object even if you didn't
2983 2993 type explicit parentheses.
2984 2994 For example, `str 43' becomes `str(43)' automatically.
2985 2995 The value can be `0' to disable the feature, `1' for
2986 2996 \emph on
2987 2997 smart
2988 2998 \emph default
2989 2999 autocall, where it is not applied if there are no more arguments on the
2990 3000 line, and `2' for
2991 3001 \emph on
2992 3002 full
2993 3003 \emph default
2994 3004 autocall, where all callable objects are automatically called (even if
2995 3005 no arguments are present).
2996 3006 The default is `1'.
2997 3007 \layout List
2998 3008 \labelwidthstring 00.00.0000
2999 3009
3000 3010
3001 3011 \family typewriter
3002 3012 \series bold
3003 3013 -[no]autoindent:
3004 3014 \family default
3005 3015 \series default
3006 3016 Turn automatic indentation on/off.
3007 3017 \layout List
3008 3018 \labelwidthstring 00.00.0000
3009 3019
3010 3020
3011 3021 \family typewriter
3012 3022 \series bold
3013 3023 -[no]automagic
3014 3024 \series default
3015 3025 :
3016 3026 \family default
3017 3027 make magic commands automatic (without needing their first character to
3018 3028 be
3019 3029 \family typewriter
3020 3030 %
3021 3031 \family default
3022 3032 ).
3023 3033 Type
3024 3034 \family typewriter
3025 3035 %magic
3026 3036 \family default
3027 3037 at the IPython prompt for more information.
3028 3038 \layout List
3029 3039 \labelwidthstring 00.00.0000
3030 3040
3031 3041
3032 3042 \family typewriter
3033 3043 \series bold
3034 3044 -[no]autoedit_syntax:
3035 3045 \family default
3036 3046 \series default
3037 3047 When a syntax error occurs after editing a file, automatically open the
3038 3048 file to the trouble causing line for convenient fixing.
3039 3049
3040 3050 \layout List
3041 3051 \labelwidthstring 00.00.0000
3042 3052
3043 3053
3044 3054 \family typewriter
3045 3055 \series bold
3046 3056 -[no]banner
3047 3057 \series default
3048 3058 :
3049 3059 \family default
3050 3060 Print the initial information banner (default on).
3051 3061 \layout List
3052 3062 \labelwidthstring 00.00.0000
3053 3063
3054 3064
3055 3065 \family typewriter
3056 3066 \series bold
3057 3067 -c\SpecialChar ~
3058 3068 <command>:
3059 3069 \family default
3060 3070 \series default
3061 3071 execute the given command string, and set sys.argv to
3062 3072 \family typewriter
3063 3073 ['c']
3064 3074 \family default
3065 3075 .
3066 3076 This is similar to the
3067 3077 \family typewriter
3068 3078 -c
3069 3079 \family default
3070 3080 option in the normal Python interpreter.
3071 3081
3072 3082 \layout List
3073 3083 \labelwidthstring 00.00.0000
3074 3084
3075 3085
3076 3086 \family typewriter
3077 3087 \series bold
3078 3088 -cache_size|cs\SpecialChar ~
3079 3089 <n>
3080 3090 \series default
3081 3091 :
3082 3092 \family default
3083 3093 size of the output cache (maximum number of entries to hold in memory).
3084 3094 The default is 1000, you can change it permanently in your config file.
3085 3095 Setting it to 0 completely disables the caching system, and the minimum
3086 3096 value accepted is 20 (if you provide a value less than 20, it is reset
3087 3097 to 0 and a warning is issued) This limit is defined because otherwise you'll
3088 3098 spend more time re-flushing a too small cache than working.
3089 3099 \layout List
3090 3100 \labelwidthstring 00.00.0000
3091 3101
3092 3102
3093 3103 \family typewriter
3094 3104 \series bold
3095 3105 -classic|cl
3096 3106 \series default
3097 3107 :
3098 3108 \family default
3099 3109 Gives IPython a similar feel to the classic Python prompt.
3100 3110 \layout List
3101 3111 \labelwidthstring 00.00.0000
3102 3112
3103 3113
3104 3114 \family typewriter
3105 3115 \series bold
3106 3116 -colors\SpecialChar ~
3107 3117 <scheme>:
3108 3118 \family default
3109 3119 \series default
3110 3120 Color scheme for prompts and exception reporting.
3111 3121 Currently implemented: NoColor, Linux and LightBG.
3112 3122 \layout List
3113 3123 \labelwidthstring 00.00.0000
3114 3124
3115 3125
3116 3126 \family typewriter
3117 3127 \series bold
3118 3128 -[no]color_info:
3119 3129 \family default
3120 3130 \series default
3121 3131 IPython can display information about objects via a set of functions, and
3122 3132 optionally can use colors for this, syntax highlighting source code and
3123 3133 various other elements.
3124 3134 However, because this information is passed through a pager (like 'less')
3125 3135 and many pagers get confused with color codes, this option is off by default.
3126 3136 You can test it and turn it on permanently in your ipythonrc file if it
3127 3137 works for you.
3128 3138 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
3129 3139 that in RedHat 7.2 doesn't.
3130 3140 \layout List
3131 3141 \labelwidthstring 00.00.0000
3132 3142
3133 3143 \SpecialChar ~
3134 3144 Test it and turn it on permanently if it works with your system.
3135 3145 The magic function
3136 3146 \family typewriter
3137 3147 %color_info
3138 3148 \family default
3139 3149 allows you to toggle this interactively for testing.
3140 3150 \layout List
3141 3151 \labelwidthstring 00.00.0000
3142 3152
3143 3153
3144 3154 \family typewriter
3145 3155 \series bold
3146 3156 -[no]debug
3147 3157 \family default
3148 3158 \series default
3149 3159 : Show information about the loading process.
3150 3160 Very useful to pin down problems with your configuration files or to get
3151 3161 details about session restores.
3152 3162 \layout List
3153 3163 \labelwidthstring 00.00.0000
3154 3164
3155 3165
3156 3166 \family typewriter
3157 3167 \series bold
3158 3168 -[no]deep_reload
3159 3169 \series default
3160 3170 :
3161 3171 \family default
3162 3172 IPython can use the
3163 3173 \family typewriter
3164 3174 deep_reload
3165 3175 \family default
3166 3176 module which reloads changes in modules recursively (it replaces the
3167 3177 \family typewriter
3168 3178 reload()
3169 3179 \family default
3170 3180 function, so you don't need to change anything to use it).
3171 3181
3172 3182 \family typewriter
3173 3183 deep_reload()
3174 3184 \family default
3175 3185 forces a full reload of modules whose code may have changed, which the
3176 3186 default
3177 3187 \family typewriter
3178 3188 reload()
3179 3189 \family default
3180 3190 function does not.
3181 3191 \layout List
3182 3192 \labelwidthstring 00.00.0000
3183 3193
3184 3194 \SpecialChar ~
3185 3195 When deep_reload is off, IPython will use the normal
3186 3196 \family typewriter
3187 3197 reload()
3188 3198 \family default
3189 3199 , but deep_reload will still be available as
3190 3200 \family typewriter
3191 3201 dreload()
3192 3202 \family default
3193 3203 .
3194 3204 This feature is off by default [which means that you have both normal
3195 3205 \family typewriter
3196 3206 reload()
3197 3207 \family default
3198 3208 and
3199 3209 \family typewriter
3200 3210 dreload()
3201 3211 \family default
3202 3212 ].
3203 3213 \layout List
3204 3214 \labelwidthstring 00.00.0000
3205 3215
3206 3216
3207 3217 \family typewriter
3208 3218 \series bold
3209 3219 -editor\SpecialChar ~
3210 3220 <name>
3211 3221 \family default
3212 3222 \series default
3213 3223 : Which editor to use with the
3214 3224 \family typewriter
3215 3225 %edit
3216 3226 \family default
3217 3227 command.
3218 3228 By default, IPython will honor your
3219 3229 \family typewriter
3220 3230 EDITOR
3221 3231 \family default
3222 3232 environment variable (if not set, vi is the Unix default and notepad the
3223 3233 Windows one).
3224 3234 Since this editor is invoked on the fly by IPython and is meant for editing
3225 3235 small code snippets, you may want to use a small, lightweight editor here
3226 3236 (in case your default
3227 3237 \family typewriter
3228 3238 EDITOR
3229 3239 \family default
3230 3240 is something like Emacs).
3231 3241 \layout List
3232 3242 \labelwidthstring 00.00.0000
3233 3243
3234 3244
3235 3245 \family typewriter
3236 3246 \series bold
3237 3247 -ipythondir\SpecialChar ~
3238 3248 <name>
3239 3249 \series default
3240 3250 :
3241 3251 \family default
3242 3252 name of your IPython configuration directory
3243 3253 \family typewriter
3244 3254 IPYTHONDIR
3245 3255 \family default
3246 3256 .
3247 3257 This can also be specified through the environment variable
3248 3258 \family typewriter
3249 3259 IPYTHONDIR
3250 3260 \family default
3251 3261 .
3252 3262 \layout List
3253 3263 \labelwidthstring 00.00.0000
3254 3264
3255 3265
3256 3266 \family typewriter
3257 3267 \series bold
3258 3268 -log|l
3259 3269 \family default
3260 3270 \series default
3261 3271 : generate a log file of all input.
3262 3272 The file is named
3263 3273 \family typewriter
3264 3274 ipython_log.py
3265 3275 \family default
3266 3276 in your current directory (which prevents logs from multiple IPython sessions
3267 3277 from trampling each other).
3268 3278 You can use this to later restore a session by loading your logfile as
3269 3279 a file to be executed with option
3270 3280 \family typewriter
3271 3281 -logplay
3272 3282 \family default
3273 3283 (see below).
3274 3284 \layout List
3275 3285 \labelwidthstring 00.00.0000
3276 3286
3277 3287
3278 3288 \family typewriter
3279 3289 \series bold
3280 3290 -logfile|lf\SpecialChar ~
3281 3291 <name>
3282 3292 \series default
3283 3293 :
3284 3294 \family default
3285 3295 specify the name of your logfile.
3286 3296 \layout List
3287 3297 \labelwidthstring 00.00.0000
3288 3298
3289 3299
3290 3300 \family typewriter
3291 3301 \series bold
3292 3302 -logplay|lp\SpecialChar ~
3293 3303 <name>
3294 3304 \series default
3295 3305 :
3296 3306 \family default
3297 3307 you can replay a previous log.
3298 3308 For restoring a session as close as possible to the state you left it in,
3299 3309 use this option (don't just run the logfile).
3300 3310 With
3301 3311 \family typewriter
3302 3312 -logplay
3303 3313 \family default
3304 3314 , IPython will try to reconstruct the previous working environment in full,
3305 3315 not just execute the commands in the logfile.
3306 3316 \layout List
3307 3317 \labelwidthstring 00.00.0000
3308 3318
3309 3319 \SpecialChar ~
3310 3320 When a session is restored, logging is automatically turned on again with
3311 3321 the name of the logfile it was invoked with (it is read from the log header).
3312 3322 So once you've turned logging on for a session, you can quit IPython and
3313 3323 reload it as many times as you want and it will continue to log its history
3314 3324 and restore from the beginning every time.
3315 3325 \layout List
3316 3326 \labelwidthstring 00.00.0000
3317 3327
3318 3328 \SpecialChar ~
3319 3329 Caveats: there are limitations in this option.
3320 3330 The history variables
3321 3331 \family typewriter
3322 3332 _i*
3323 3333 \family default
3324 3334 ,
3325 3335 \family typewriter
3326 3336 _*
3327 3337 \family default
3328 3338 and
3329 3339 \family typewriter
3330 3340 _dh
3331 3341 \family default
3332 3342 don't get restored properly.
3333 3343 In the future we will try to implement full session saving by writing and
3334 3344 retrieving a 'snapshot' of the memory state of IPython.
3335 3345 But our first attempts failed because of inherent limitations of Python's
3336 3346 Pickle module, so this may have to wait.
3337 3347 \layout List
3338 3348 \labelwidthstring 00.00.0000
3339 3349
3340 3350
3341 3351 \family typewriter
3342 3352 \series bold
3343 3353 -[no]messages
3344 3354 \series default
3345 3355 :
3346 3356 \family default
3347 3357 Print messages which IPython collects about its startup process (default
3348 3358 on).
3349 3359 \layout List
3350 3360 \labelwidthstring 00.00.0000
3351 3361
3352 3362
3353 3363 \family typewriter
3354 3364 \series bold
3355 3365 -[no]pdb
3356 3366 \family default
3357 3367 \series default
3358 3368 : Automatically call the pdb debugger after every uncaught exception.
3359 3369 If you are used to debugging using pdb, this puts you automatically inside
3360 3370 of it after any call (either in IPython or in code called by it) which
3361 3371 triggers an exception which goes uncaught.
3362 3372 \layout List
3363 3373 \labelwidthstring 00.00.0000
3364 3374
3365 3375
3366 3376 \family typewriter
3367 3377 \series bold
3368 3378 -[no]pprint
3369 3379 \series default
3370 3380 :
3371 3381 \family default
3372 3382 ipython can optionally use the pprint (pretty printer) module for displaying
3373 3383 results.
3374 3384 pprint tends to give a nicer display of nested data structures.
3375 3385 If you like it, you can turn it on permanently in your config file (default
3376 3386 off).
3377 3387 \layout List
3378 3388 \labelwidthstring 00.00.0000
3379 3389
3380 3390
3381 3391 \family typewriter
3382 3392 \series bold
3383 3393 -profile|p <name>
3384 3394 \series default
3385 3395 :
3386 3396 \family default
3387 3397 assume that your config file is
3388 3398 \family typewriter
3389 3399 ipythonrc-<name>
3390 3400 \family default
3391 3401 (looks in current dir first, then in
3392 3402 \family typewriter
3393 3403 IPYTHONDIR
3394 3404 \family default
3395 3405 ).
3396 3406 This is a quick way to keep and load multiple config files for different
3397 3407 tasks, especially if you use the include option of config files.
3398 3408 You can keep a basic
3399 3409 \family typewriter
3400 3410 IPYTHONDIR/ipythonrc
3401 3411 \family default
3402 3412 file and then have other 'profiles' which include this one and load extra
3403 3413 things for particular tasks.
3404 3414 For example:
3405 3415 \layout List
3406 3416 \labelwidthstring 00.00.0000
3407 3417
3408 3418
3409 3419 \family typewriter
3410 3420 \SpecialChar ~
3411 3421
3412 3422 \family default
3413 3423 1.
3414 3424
3415 3425 \family typewriter
3416 3426 $HOME/.ipython/ipythonrc
3417 3427 \family default
3418 3428 : load basic things you always want.
3419 3429 \layout List
3420 3430 \labelwidthstring 00.00.0000
3421 3431
3422 3432
3423 3433 \family typewriter
3424 3434 \SpecialChar ~
3425 3435
3426 3436 \family default
3427 3437 2.
3428 3438
3429 3439 \family typewriter
3430 3440 $HOME/.ipython/ipythonrc-math
3431 3441 \family default
3432 3442 : load (1) and basic math-related modules.
3433 3443
3434 3444 \layout List
3435 3445 \labelwidthstring 00.00.0000
3436 3446
3437 3447
3438 3448 \family typewriter
3439 3449 \SpecialChar ~
3440 3450
3441 3451 \family default
3442 3452 3.
3443 3453
3444 3454 \family typewriter
3445 3455 $HOME/.ipython/ipythonrc-numeric
3446 3456 \family default
3447 3457 : load (1) and Numeric and plotting modules.
3448 3458 \layout List
3449 3459 \labelwidthstring 00.00.0000
3450 3460
3451 3461 \SpecialChar ~
3452 3462 Since it is possible to create an endless loop by having circular file
3453 3463 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3454 3464 \layout List
3455 3465 \labelwidthstring 00.00.0000
3456 3466
3457 3467
3458 3468 \family typewriter
3459 3469 \series bold
3460 3470 -prompt_in1|pi1\SpecialChar ~
3461 3471 <string>:
3462 3472 \family default
3463 3473 \series default
3464 3474 Specify the string used for input prompts.
3465 3475 Note that if you are using numbered prompts, the number is represented
3466 3476 with a '
3467 3477 \backslash
3468 3478 #' in the string.
3469 3479 Don't forget to quote strings with spaces embedded in them.
3470 3480 Default: '
3471 3481 \family typewriter
3472 3482 In\SpecialChar ~
3473 3483 [
3474 3484 \backslash
3475 3485 #]:
3476 3486 \family default
3477 3487 '.
3478 3488 Sec.\SpecialChar ~
3479 3489
3480 3490 \begin_inset LatexCommand \ref{sec:prompts}
3481 3491
3482 3492 \end_inset
3483 3493
3484 3494 discusses in detail all the available escapes to customize your prompts.
3485 3495 \layout List
3486 3496 \labelwidthstring 00.00.0000
3487 3497
3488 3498
3489 3499 \family typewriter
3490 3500 \series bold
3491 3501 -prompt_in2|pi2\SpecialChar ~
3492 3502 <string>:
3493 3503 \family default
3494 3504 \series default
3495 3505 Similar to the previous option, but used for the continuation prompts.
3496 3506 The special sequence '
3497 3507 \family typewriter
3498 3508
3499 3509 \backslash
3500 3510 D
3501 3511 \family default
3502 3512 ' is similar to '
3503 3513 \family typewriter
3504 3514
3505 3515 \backslash
3506 3516 #
3507 3517 \family default
3508 3518 ', but with all digits replaced dots (so you can have your continuation
3509 3519 prompt aligned with your input prompt).
3510 3520 Default: '
3511 3521 \family typewriter
3512 3522 \SpecialChar ~
3513 3523 \SpecialChar ~
3514 3524 \SpecialChar ~
3515 3525 .
3516 3526 \backslash
3517 3527 D.:
3518 3528 \family default
3519 3529 ' (note three spaces at the start for alignment with '
3520 3530 \family typewriter
3521 3531 In\SpecialChar ~
3522 3532 [
3523 3533 \backslash
3524 3534 #]
3525 3535 \family default
3526 3536 ').
3527 3537 \layout List
3528 3538 \labelwidthstring 00.00.0000
3529 3539
3530 3540
3531 3541 \family typewriter
3532 3542 \series bold
3533 3543 -prompt_out|po\SpecialChar ~
3534 3544 <string>:
3535 3545 \family default
3536 3546 \series default
3537 3547 String used for output prompts, also uses numbers like
3538 3548 \family typewriter
3539 3549 prompt_in1
3540 3550 \family default
3541 3551 .
3542 3552 Default: '
3543 3553 \family typewriter
3544 3554 Out[
3545 3555 \backslash
3546 3556 #]:
3547 3557 \family default
3548 3558 '
3549 3559 \layout List
3550 3560 \labelwidthstring 00.00.0000
3551 3561
3552 3562
3553 3563 \family typewriter
3554 3564 \series bold
3555 3565 -quick
3556 3566 \family default
3557 3567 \series default
3558 3568 : start in bare bones mode (no config file loaded).
3559 3569 \layout List
3560 3570 \labelwidthstring 00.00.0000
3561 3571
3562 3572
3563 3573 \family typewriter
3564 3574 \series bold
3565 3575 -rcfile\SpecialChar ~
3566 3576 <name>
3567 3577 \series default
3568 3578 :
3569 3579 \family default
3570 3580 name of your IPython resource configuration file.
3571 3581 Normally IPython loads ipythonrc (from current directory) or
3572 3582 \family typewriter
3573 3583 IPYTHONDIR/ipythonrc
3574 3584 \family default
3575 3585 .
3576 3586 \layout List
3577 3587 \labelwidthstring 00.00.0000
3578 3588
3579 3589 \SpecialChar ~
3580 3590 If the loading of your config file fails, IPython starts with a bare bones
3581 3591 configuration (no modules loaded at all).
3582 3592 \layout List
3583 3593 \labelwidthstring 00.00.0000
3584 3594
3585 3595
3586 3596 \family typewriter
3587 3597 \series bold
3588 3598 -[no]readline
3589 3599 \family default
3590 3600 \series default
3591 3601 : use the readline library, which is needed to support name completion and
3592 3602 command history, among other things.
3593 3603 It is enabled by default, but may cause problems for users of X/Emacs in
3594 3604 Python comint or shell buffers.
3595 3605 \layout List
3596 3606 \labelwidthstring 00.00.0000
3597 3607
3598 3608 \SpecialChar ~
3599 3609 Note that X/Emacs 'eterm' buffers (opened with
3600 3610 \family typewriter
3601 3611 M-x\SpecialChar ~
3602 3612 term
3603 3613 \family default
3604 3614 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3605 3615 \family typewriter
3606 3616 M-x\SpecialChar ~
3607 3617 shell
3608 3618 \family default
3609 3619 and
3610 3620 \family typewriter
3611 3621 C-c\SpecialChar ~
3612 3622 !
3613 3623 \family default
3614 3624 ) buffers do not.
3615 3625 \layout List
3616 3626 \labelwidthstring 00.00.0000
3617 3627
3618 3628
3619 3629 \family typewriter
3620 3630 \series bold
3621 3631 -screen_length|sl\SpecialChar ~
3622 3632 <n>
3623 3633 \series default
3624 3634 :
3625 3635 \family default
3626 3636 number of lines of your screen.
3627 3637 This is used to control printing of very long strings.
3628 3638 Strings longer than this number of lines will be sent through a pager instead
3629 3639 of directly printed.
3630 3640 \layout List
3631 3641 \labelwidthstring 00.00.0000
3632 3642
3633 3643 \SpecialChar ~
3634 3644 The default value for this is 0, which means IPython will auto-detect your
3635 3645 screen size every time it needs to print certain potentially long strings
3636 3646 (this doesn't change the behavior of the 'print' keyword, it's only triggered
3637 3647 internally).
3638 3648 If for some reason this isn't working well (it needs curses support), specify
3639 3649 it yourself.
3640 3650 Otherwise don't change the default.
3641 3651 \layout List
3642 3652 \labelwidthstring 00.00.0000
3643 3653
3644 3654
3645 3655 \family typewriter
3646 3656 \series bold
3647 3657 -separate_in|si\SpecialChar ~
3648 3658 <string>
3649 3659 \series default
3650 3660 :
3651 3661 \family default
3652 3662 separator before input prompts.
3653 3663 Default: '
3654 3664 \family typewriter
3655 3665
3656 3666 \backslash
3657 3667 n
3658 3668 \family default
3659 3669 '
3660 3670 \layout List
3661 3671 \labelwidthstring 00.00.0000
3662 3672
3663 3673
3664 3674 \family typewriter
3665 3675 \series bold
3666 3676 -separate_out|so\SpecialChar ~
3667 3677 <string>
3668 3678 \family default
3669 3679 \series default
3670 3680 : separator before output prompts.
3671 3681 Default: nothing.
3672 3682 \layout List
3673 3683 \labelwidthstring 00.00.0000
3674 3684
3675 3685
3676 3686 \family typewriter
3677 3687 \series bold
3678 3688 -separate_out2|so2\SpecialChar ~
3679 3689 <string>
3680 3690 \series default
3681 3691 :
3682 3692 \family default
3683 3693 separator after output prompts.
3684 3694 Default: nothing.
3685 3695 \layout List
3686 3696 \labelwidthstring 00.00.0000
3687 3697
3688 3698 \SpecialChar ~
3689 3699 For these three options, use the value 0 to specify no separator.
3690 3700 \layout List
3691 3701 \labelwidthstring 00.00.0000
3692 3702
3693 3703
3694 3704 \family typewriter
3695 3705 \series bold
3696 3706 -nosep
3697 3707 \series default
3698 3708 :
3699 3709 \family default
3700 3710 shorthand for
3701 3711 \family typewriter
3702 3712 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
3703 3713 \family default
3704 3714 .
3705 3715 Simply removes all input/output separators.
3706 3716 \layout List
3707 3717 \labelwidthstring 00.00.0000
3708 3718
3709 3719
3710 3720 \family typewriter
3711 3721 \series bold
3712 3722 -upgrade
3713 3723 \family default
3714 3724 \series default
3715 3725 : allows you to upgrade your
3716 3726 \family typewriter
3717 3727 IPYTHONDIR
3718 3728 \family default
3719 3729 configuration when you install a new version of IPython.
3720 3730 Since new versions may include new command line options or example files,
3721 3731 this copies updated ipythonrc-type files.
3722 3732 However, it backs up (with a
3723 3733 \family typewriter
3724 3734 .old
3725 3735 \family default
3726 3736 extension) all files which it overwrites so that you can merge back any
3727 3737 customizations you might have in your personal files.
3728 3738 \layout List
3729 3739 \labelwidthstring 00.00.0000
3730 3740
3731 3741
3732 3742 \family typewriter
3733 3743 \series bold
3734 3744 -Version
3735 3745 \series default
3736 3746 :
3737 3747 \family default
3738 3748 print version information and exit.
3739 3749 \layout List
3740 3750 \labelwidthstring 00.00.0000
3741 3751
3742 3752
3743 3753 \family typewriter
3744 3754 \series bold
3745 3755 -wxversion\SpecialChar ~
3746 3756 <string>:
3747 3757 \family default
3748 3758 \series default
3749 3759 Select a specific version of wxPython (used in conjunction with
3750 3760 \family typewriter
3751 3761 -wthread
3752 3762 \family default
3753 3763 ).
3754 3764 Requires the wxversion module, part of recent wxPython distributions
3755 3765 \layout List
3756 3766 \labelwidthstring 00.00.0000
3757 3767
3758 3768
3759 3769 \family typewriter
3760 3770 \series bold
3761 3771 -xmode\SpecialChar ~
3762 3772 <modename>
3763 3773 \series default
3764 3774 :
3765 3775 \family default
3766 3776 Mode for exception reporting.
3767 3777 \layout List
3768 3778 \labelwidthstring 00.00.0000
3769 3779
3770 3780 \SpecialChar ~
3771 3781 Valid modes: Plain, Context and Verbose.
3772 3782 \layout List
3773 3783 \labelwidthstring 00.00.0000
3774 3784
3775 3785 \SpecialChar ~
3776 3786 Plain: similar to python's normal traceback printing.
3777 3787 \layout List
3778 3788 \labelwidthstring 00.00.0000
3779 3789
3780 3790 \SpecialChar ~
3781 3791 Context: prints 5 lines of context source code around each line in the
3782 3792 traceback.
3783 3793 \layout List
3784 3794 \labelwidthstring 00.00.0000
3785 3795
3786 3796 \SpecialChar ~
3787 3797 Verbose: similar to Context, but additionally prints the variables currently
3788 3798 visible where the exception happened (shortening their strings if too long).
3789 3799 This can potentially be very slow, if you happen to have a huge data structure
3790 3800 whose string representation is complex to compute.
3791 3801 Your computer may appear to freeze for a while with cpu usage at 100%.
3792 3802 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
3793 3803 it more than once).
3794 3804 \layout Section
3795 3805
3796 3806 Interactive use
3797 3807 \layout Standard
3798 3808
3799 3809
3800 3810 \series bold
3801 3811 Warning
3802 3812 \series default
3803 3813 : IPython relies on the existence of a global variable called
3804 3814 \family typewriter
3805 3815 __IP
3806 3816 \family default
3807 3817 which controls the shell itself.
3808 3818 If you redefine
3809 3819 \family typewriter
3810 3820 __IP
3811 3821 \family default
3812 3822 to anything, bizarre behavior will quickly occur.
3813 3823 \layout Standard
3814 3824
3815 3825 Other than the above warning, IPython is meant to work as a drop-in replacement
3816 3826 for the standard interactive interpreter.
3817 3827 As such, any code which is valid python should execute normally under IPython
3818 3828 (cases where this is not true should be reported as bugs).
3819 3829 It does, however, offer many features which are not available at a standard
3820 3830 python prompt.
3821 3831 What follows is a list of these.
3822 3832 \layout Subsection
3823 3833
3824 3834 Caution for Windows users
3825 3835 \layout Standard
3826 3836
3827 3837 Windows, unfortunately, uses the `
3828 3838 \family typewriter
3829 3839
3830 3840 \backslash
3831 3841
3832 3842 \family default
3833 3843 ' character as a path separator.
3834 3844 This is a terrible choice, because `
3835 3845 \family typewriter
3836 3846
3837 3847 \backslash
3838 3848
3839 3849 \family default
3840 3850 ' also represents the escape character in most modern programming languages,
3841 3851 including Python.
3842 3852 For this reason, issuing many of the commands discussed below (especially
3843 3853 magics which affect the filesystem) with `
3844 3854 \family typewriter
3845 3855
3846 3856 \backslash
3847 3857
3848 3858 \family default
3849 3859 ' in them will cause strange errors.
3850 3860 \layout Standard
3851 3861
3852 3862 A partial solution is to use instead the `
3853 3863 \family typewriter
3854 3864 /
3855 3865 \family default
3856 3866 ' character as a path separator, which Windows recognizes in
3857 3867 \emph on
3858 3868 most
3859 3869 \emph default
3860 3870 situations.
3861 3871 However, in Windows commands `
3862 3872 \family typewriter
3863 3873 /
3864 3874 \family default
3865 3875 ' flags options, so you can not use it for the root directory.
3866 3876 This means that paths beginning at the root must be typed in a contrived
3867 3877 manner like:
3868 3878 \newline
3869 3879
3870 3880 \family typewriter
3871 3881 %copy
3872 3882 \backslash
3873 3883 opt/foo/bar.txt
3874 3884 \backslash
3875 3885 tmp
3876 3886 \layout Standard
3877 3887
3878 3888 There is no sensible thing IPython can do to truly work around this flaw
3879 3889 in Windows
3880 3890 \begin_inset Foot
3881 3891 collapsed true
3882 3892
3883 3893 \layout Standard
3884 3894
3885 3895 If anyone comes up with a
3886 3896 \emph on
3887 3897 clean
3888 3898 \emph default
3889 3899 solution which works consistently and does not negatively impact other
3890 3900 platforms at all, I'll gladly accept a patch.
3891 3901 \end_inset
3892 3902
3893 3903 .
3894 3904 \layout Subsection
3895 3905
3896 3906
3897 3907 \begin_inset LatexCommand \label{sec:magic}
3898 3908
3899 3909 \end_inset
3900 3910
3901 3911 Magic command system
3902 3912 \layout Standard
3903 3913
3904 3914 IPython will treat any line whose first character is a
3905 3915 \family typewriter
3906 3916 %
3907 3917 \family default
3908 3918 as a special call to a 'magic' function.
3909 3919 These allow you to control the behavior of IPython itself, plus a lot of
3910 3920 system-type features.
3911 3921 They are all prefixed with a
3912 3922 \family typewriter
3913 3923 %
3914 3924 \family default
3915 3925 character, but parameters are given without parentheses or quotes.
3916 3926 \layout Standard
3917 3927
3918 3928 Example: typing
3919 3929 \family typewriter
3920 3930 '%cd mydir'
3921 3931 \family default
3922 3932 (without the quotes) changes you working directory to
3923 3933 \family typewriter
3924 3934 'mydir'
3925 3935 \family default
3926 3936 , if it exists.
3927 3937 \layout Standard
3928 3938
3929 3939 If you have 'automagic' enabled (in your
3930 3940 \family typewriter
3931 3941 ipythonrc
3932 3942 \family default
3933 3943 file, via the command line option
3934 3944 \family typewriter
3935 3945 -automagic
3936 3946 \family default
3937 3947 or with the
3938 3948 \family typewriter
3939 3949 %automagic
3940 3950 \family default
3941 3951 function), you don't need to type in the
3942 3952 \family typewriter
3943 3953 %
3944 3954 \family default
3945 3955 explicitly.
3946 3956 IPython will scan its internal list of magic functions and call one if
3947 3957 it exists.
3948 3958 With automagic on you can then just type '
3949 3959 \family typewriter
3950 3960 cd mydir
3951 3961 \family default
3952 3962 ' to go to directory '
3953 3963 \family typewriter
3954 3964 mydir
3955 3965 \family default
3956 3966 '.
3957 3967 The automagic system has the lowest possible precedence in name searches,
3958 3968 so defining an identifier with the same name as an existing magic function
3959 3969 will shadow it for automagic use.
3960 3970 You can still access the shadowed magic function by explicitly using the
3961 3971
3962 3972 \family typewriter
3963 3973 %
3964 3974 \family default
3965 3975 character at the beginning of the line.
3966 3976 \layout Standard
3967 3977
3968 3978 An example (with automagic on) should clarify all this:
3969 3979 \layout LyX-Code
3970 3980
3971 3981 In [1]: cd ipython # %cd is called by automagic
3972 3982 \layout LyX-Code
3973 3983
3974 3984 /home/fperez/ipython
3975 3985 \layout LyX-Code
3976 3986
3977 3987 In [2]: cd=1 # now cd is just a variable
3978 3988 \layout LyX-Code
3979 3989
3980 3990 In [3]: cd ..
3981 3991 # and doesn't work as a function anymore
3982 3992 \layout LyX-Code
3983 3993
3984 3994 ------------------------------------------------------------
3985 3995 \layout LyX-Code
3986 3996
3987 3997 File "<console>", line 1
3988 3998 \layout LyX-Code
3989 3999
3990 4000 cd ..
3991 4001 \layout LyX-Code
3992 4002
3993 4003 ^
3994 4004 \layout LyX-Code
3995 4005
3996 4006 SyntaxError: invalid syntax
3997 4007 \layout LyX-Code
3998 4008
3999 4009 \layout LyX-Code
4000 4010
4001 4011 In [4]: %cd ..
4002 4012 # but %cd always works
4003 4013 \layout LyX-Code
4004 4014
4005 4015 /home/fperez
4006 4016 \layout LyX-Code
4007 4017
4008 4018 In [5]: del cd # if you remove the cd variable
4009 4019 \layout LyX-Code
4010 4020
4011 4021 In [6]: cd ipython # automagic can work again
4012 4022 \layout LyX-Code
4013 4023
4014 4024 /home/fperez/ipython
4015 4025 \layout Standard
4016 4026
4017 4027 You can define your own magic functions to extend the system.
4018 4028 The following is a snippet of code which shows how to do it.
4019 4029 It is provided as file
4020 4030 \family typewriter
4021 4031 example-magic.py
4022 4032 \family default
4023 4033 in the examples directory:
4024 4034 \layout Standard
4025 4035
4026 4036
4027 4037 \begin_inset ERT
4028 4038 status Open
4029 4039
4030 4040 \layout Standard
4031 4041
4032 4042 \backslash
4033 4043 codelist{examples/example-magic.py}
4034 4044 \end_inset
4035 4045
4036 4046
4037 4047 \layout Standard
4038 4048
4039 4049 You can also define your own aliased names for magic functions.
4040 4050 In your
4041 4051 \family typewriter
4042 4052 ipythonrc
4043 4053 \family default
4044 4054 file, placing a line like:
4045 4055 \layout Standard
4046 4056
4047 4057
4048 4058 \family typewriter
4049 4059 execute __IP.magic_cl = __IP.magic_clear
4050 4060 \layout Standard
4051 4061
4052 4062 will define
4053 4063 \family typewriter
4054 4064 %cl
4055 4065 \family default
4056 4066 as a new name for
4057 4067 \family typewriter
4058 4068 %clear
4059 4069 \family default
4060 4070 .
4061 4071 \layout Standard
4062 4072
4063 4073 Type
4064 4074 \family typewriter
4065 4075 %magic
4066 4076 \family default
4067 4077 for more information, including a list of all available magic functions
4068 4078 at any time and their docstrings.
4069 4079 You can also type
4070 4080 \family typewriter
4071 4081 %magic_function_name?
4072 4082 \family default
4073 4083 (see sec.
4074 4084
4075 4085 \begin_inset LatexCommand \ref{sec:dyn-object-info}
4076 4086
4077 4087 \end_inset
4078 4088
4079 4089 for information on the
4080 4090 \family typewriter
4081 4091 '?'
4082 4092 \family default
4083 4093 system) to get information about any particular magic function you are
4084 4094 interested in.
4085 4095 \layout Subsubsection
4086 4096
4087 4097 Magic commands
4088 4098 \layout Standard
4089 4099
4090 4100 The rest of this section is automatically generated for each release from
4091 4101 the docstrings in the IPython code.
4092 4102 Therefore the formatting is somewhat minimal, but this method has the advantage
4093 4103 of having information always in sync with the code.
4094 4104 \layout Standard
4095 4105
4096 4106 A list of all the magic commands available in IPython's
4097 4107 \emph on
4098 4108 default
4099 4109 \emph default
4100 4110 installation follows.
4101 4111 This is similar to what you'll see by simply typing
4102 4112 \family typewriter
4103 4113 %magic
4104 4114 \family default
4105 4115 at the prompt, but that will also give you information about magic commands
4106 4116 you may have added as part of your personal customizations.
4107 4117 \layout Standard
4108 4118
4109 4119
4110 4120 \begin_inset Include \input{magic.tex}
4111 4121 preview false
4112 4122
4113 4123 \end_inset
4114 4124
4115 4125
4116 4126 \layout Subsection
4117 4127
4118 4128 Access to the standard Python help
4119 4129 \layout Standard
4120 4130
4121 4131 As of Python 2.1, a help system is available with access to object docstrings
4122 4132 and the Python manuals.
4123 4133 Simply type
4124 4134 \family typewriter
4125 4135 'help'
4126 4136 \family default
4127 4137 (no quotes) to access it.
4128 4138 You can also type
4129 4139 \family typewriter
4130 4140 help(object)
4131 4141 \family default
4132 4142 to obtain information about a given object, and
4133 4143 \family typewriter
4134 4144 help('keyword')
4135 4145 \family default
4136 4146 for information on a keyword.
4137 4147 As noted in sec.
4138 4148
4139 4149 \begin_inset LatexCommand \ref{sec:help-access}
4140 4150
4141 4151 \end_inset
4142 4152
4143 4153 , you need to properly configure your environment variable
4144 4154 \family typewriter
4145 4155 PYTHONDOCS
4146 4156 \family default
4147 4157 for this feature to work correctly.
4148 4158 \layout Subsection
4149 4159
4150 4160
4151 4161 \begin_inset LatexCommand \label{sec:dyn-object-info}
4152 4162
4153 4163 \end_inset
4154 4164
4155 4165 Dynamic object information
4156 4166 \layout Standard
4157 4167
4158 4168 Typing
4159 4169 \family typewriter
4160 4170 ?word
4161 4171 \family default
4162 4172 or
4163 4173 \family typewriter
4164 4174 word?
4165 4175 \family default
4166 4176 prints detailed information about an object.
4167 4177 If certain strings in the object are too long (docstrings, code, etc.) they
4168 4178 get snipped in the center for brevity.
4169 4179 This system gives access variable types and values, full source code for
4170 4180 any object (if available), function prototypes and other useful information.
4171 4181 \layout Standard
4172 4182
4173 4183 Typing
4174 4184 \family typewriter
4175 4185 ??word
4176 4186 \family default
4177 4187 or
4178 4188 \family typewriter
4179 4189 word??
4180 4190 \family default
4181 4191 gives access to the full information without snipping long strings.
4182 4192 Long strings are sent to the screen through the
4183 4193 \family typewriter
4184 4194 less
4185 4195 \family default
4186 4196 pager if longer than the screen and printed otherwise.
4187 4197 On systems lacking the
4188 4198 \family typewriter
4189 4199 less
4190 4200 \family default
4191 4201 command, IPython uses a very basic internal pager.
4192 4202 \layout Standard
4193 4203
4194 4204 The following magic functions are particularly useful for gathering information
4195 4205 about your working environment.
4196 4206 You can get more details by typing
4197 4207 \family typewriter
4198 4208 %magic
4199 4209 \family default
4200 4210 or querying them individually (use
4201 4211 \family typewriter
4202 4212 %function_name?
4203 4213 \family default
4204 4214 with or without the
4205 4215 \family typewriter
4206 4216 %
4207 4217 \family default
4208 4218 ), this is just a summary:
4209 4219 \layout List
4210 4220 \labelwidthstring 00.00.0000
4211 4221
4212 4222
4213 4223 \family typewriter
4214 4224 \series bold
4215 4225 %pdoc\SpecialChar ~
4216 4226 <object>
4217 4227 \family default
4218 4228 \series default
4219 4229 : Print (or run through a pager if too long) the docstring for an object.
4220 4230 If the given object is a class, it will print both the class and the constructo
4221 4231 r docstrings.
4222 4232 \layout List
4223 4233 \labelwidthstring 00.00.0000
4224 4234
4225 4235
4226 4236 \family typewriter
4227 4237 \series bold
4228 4238 %pdef\SpecialChar ~
4229 4239 <object>
4230 4240 \family default
4231 4241 \series default
4232 4242 : Print the definition header for any callable object.
4233 4243 If the object is a class, print the constructor information.
4234 4244 \layout List
4235 4245 \labelwidthstring 00.00.0000
4236 4246
4237 4247
4238 4248 \family typewriter
4239 4249 \series bold
4240 4250 %psource\SpecialChar ~
4241 4251 <object>
4242 4252 \family default
4243 4253 \series default
4244 4254 : Print (or run through a pager if too long) the source code for an object.
4245 4255 \layout List
4246 4256 \labelwidthstring 00.00.0000
4247 4257
4248 4258
4249 4259 \family typewriter
4250 4260 \series bold
4251 4261 %pfile\SpecialChar ~
4252 4262 <object>
4253 4263 \family default
4254 4264 \series default
4255 4265 : Show the entire source file where an object was defined via a pager, opening
4256 4266 it at the line where the object definition begins.
4257 4267 \layout List
4258 4268 \labelwidthstring 00.00.0000
4259 4269
4260 4270
4261 4271 \family typewriter
4262 4272 \series bold
4263 4273 %who/%whos
4264 4274 \family default
4265 4275 \series default
4266 4276 : These functions give information about identifiers you have defined interactiv
4267 4277 ely (not things you loaded or defined in your configuration files).
4268 4278
4269 4279 \family typewriter
4270 4280 %who
4271 4281 \family default
4272 4282 just prints a list of identifiers and
4273 4283 \family typewriter
4274 4284 %whos
4275 4285 \family default
4276 4286 prints a table with some basic details about each identifier.
4277 4287 \layout Standard
4278 4288
4279 4289 Note that the dynamic object information functions (
4280 4290 \family typewriter
4281 4291 ?/??, %pdoc, %pfile, %pdef, %psource
4282 4292 \family default
4283 4293 ) give you access to documentation even on things which are not really defined
4284 4294 as separate identifiers.
4285 4295 Try for example typing
4286 4296 \family typewriter
4287 4297 {}.get?
4288 4298 \family default
4289 4299 or after doing
4290 4300 \family typewriter
4291 4301 import os
4292 4302 \family default
4293 4303 , type
4294 4304 \family typewriter
4295 4305 os.path.abspath??
4296 4306 \family default
4297 4307 .
4298 4308 \layout Subsection
4299 4309
4300 4310
4301 4311 \begin_inset LatexCommand \label{sec:readline}
4302 4312
4303 4313 \end_inset
4304 4314
4305 4315 Readline-based features
4306 4316 \layout Standard
4307 4317
4308 4318 These features require the GNU readline library, so they won't work if your
4309 4319 Python installation lacks readline support.
4310 4320 We will first describe the default behavior IPython uses, and then how
4311 4321 to change it to suit your preferences.
4312 4322 \layout Subsubsection
4313 4323
4314 4324 Command line completion
4315 4325 \layout Standard
4316 4326
4317 4327 At any time, hitting TAB will complete any available python commands or
4318 4328 variable names, and show you a list of the possible completions if there's
4319 4329 no unambiguous one.
4320 4330 It will also complete filenames in the current directory if no python names
4321 4331 match what you've typed so far.
4322 4332 \layout Subsubsection
4323 4333
4324 4334 Search command history
4325 4335 \layout Standard
4326 4336
4327 4337 IPython provides two ways for searching through previous input and thus
4328 4338 reduce the need for repetitive typing:
4329 4339 \layout Enumerate
4330 4340
4331 4341 Start typing, and then use
4332 4342 \family typewriter
4333 4343 Ctrl-p
4334 4344 \family default
4335 4345 (previous,up) and
4336 4346 \family typewriter
4337 4347 Ctrl-n
4338 4348 \family default
4339 4349 (next,down) to search through only the history items that match what you've
4340 4350 typed so far.
4341 4351 If you use
4342 4352 \family typewriter
4343 4353 Ctrl-p/Ctrl-n
4344 4354 \family default
4345 4355 at a blank prompt, they just behave like normal arrow keys.
4346 4356 \layout Enumerate
4347 4357
4348 4358 Hit
4349 4359 \family typewriter
4350 4360 Ctrl-r
4351 4361 \family default
4352 4362 : opens a search prompt.
4353 4363 Begin typing and the system searches your history for lines that contain
4354 4364 what you've typed so far, completing as much as it can.
4355 4365 \layout Subsubsection
4356 4366
4357 4367 Persistent command history across sessions
4358 4368 \layout Standard
4359 4369
4360 4370 IPython will save your input history when it leaves and reload it next time
4361 4371 you restart it.
4362 4372 By default, the history file is named
4363 4373 \family typewriter
4364 4374 $IPYTHONDIR/history
4365 4375 \family default
4366 4376 , but if you've loaded a named profile, '
4367 4377 \family typewriter
4368 4378 -PROFILE_NAME
4369 4379 \family default
4370 4380 ' is appended to the name.
4371 4381 This allows you to keep separate histories related to various tasks: commands
4372 4382 related to numerical work will not be clobbered by a system shell history,
4373 4383 for example.
4374 4384 \layout Subsubsection
4375 4385
4376 4386 Autoindent
4377 4387 \layout Standard
4378 4388
4379 4389 IPython can recognize lines ending in ':' and indent the next line, while
4380 4390 also un-indenting automatically after 'raise' or 'return'.
4381 4391
4382 4392 \layout Standard
4383 4393
4384 4394 This feature uses the readline library, so it will honor your
4385 4395 \family typewriter
4386 4396 ~/.inputrc
4387 4397 \family default
4388 4398 configuration (or whatever file your
4389 4399 \family typewriter
4390 4400 INPUTRC
4391 4401 \family default
4392 4402 variable points to).
4393 4403 Adding the following lines to your
4394 4404 \family typewriter
4395 4405 .inputrc
4396 4406 \family default
4397 4407 file can make indenting/unindenting more convenient (
4398 4408 \family typewriter
4399 4409 M-i
4400 4410 \family default
4401 4411 indents,
4402 4412 \family typewriter
4403 4413 M-u
4404 4414 \family default
4405 4415 unindents):
4406 4416 \layout Standard
4407 4417
4408 4418
4409 4419 \family typewriter
4410 4420 $if Python
4411 4421 \newline
4412 4422 "
4413 4423 \backslash
4414 4424 M-i": "\SpecialChar ~
4415 4425 \SpecialChar ~
4416 4426 \SpecialChar ~
4417 4427 \SpecialChar ~
4418 4428 "
4419 4429 \newline
4420 4430 "
4421 4431 \backslash
4422 4432 M-u": "
4423 4433 \backslash
4424 4434 d
4425 4435 \backslash
4426 4436 d
4427 4437 \backslash
4428 4438 d
4429 4439 \backslash
4430 4440 d"
4431 4441 \newline
4432 4442 $endif
4433 4443 \layout Standard
4434 4444
4435 4445 Note that there are 4 spaces between the quote marks after
4436 4446 \family typewriter
4437 4447 "M-i"
4438 4448 \family default
4439 4449 above.
4440 4450 \layout Standard
4441 4451
4442 4452
4443 4453 \series bold
4444 4454 Warning:
4445 4455 \series default
4446 4456 this feature is ON by default, but it can cause problems with the pasting
4447 4457 of multi-line indented code (the pasted code gets re-indented on each line).
4448 4458 A magic function
4449 4459 \family typewriter
4450 4460 %autoindent
4451 4461 \family default
4452 4462 allows you to toggle it on/off at runtime.
4453 4463 You can also disable it permanently on in your
4454 4464 \family typewriter
4455 4465 ipythonrc
4456 4466 \family default
4457 4467 file (set
4458 4468 \family typewriter
4459 4469 autoindent 0
4460 4470 \family default
4461 4471 ).
4462 4472 \layout Subsubsection
4463 4473
4464 4474 Customizing readline behavior
4465 4475 \layout Standard
4466 4476
4467 4477 All these features are based on the GNU readline library, which has an extremely
4468 4478 customizable interface.
4469 4479 Normally, readline is configured via a file which defines the behavior
4470 4480 of the library; the details of the syntax for this can be found in the
4471 4481 readline documentation available with your system or on the Internet.
4472 4482 IPython doesn't read this file (if it exists) directly, but it does support
4473 4483 passing to readline valid options via a simple interface.
4474 4484 In brief, you can customize readline by setting the following options in
4475 4485 your
4476 4486 \family typewriter
4477 4487 ipythonrc
4478 4488 \family default
4479 4489 configuration file (note that these options can
4480 4490 \emph on
4481 4491 not
4482 4492 \emph default
4483 4493 be specified at the command line):
4484 4494 \layout List
4485 4495 \labelwidthstring 00.00.0000
4486 4496
4487 4497
4488 4498 \family typewriter
4489 4499 \series bold
4490 4500 readline_parse_and_bind:
4491 4501 \family default
4492 4502 \series default
4493 4503 this option can appear as many times as you want, each time defining a
4494 4504 string to be executed via a
4495 4505 \family typewriter
4496 4506 readline.parse_and_bind()
4497 4507 \family default
4498 4508 command.
4499 4509 The syntax for valid commands of this kind can be found by reading the
4500 4510 documentation for the GNU readline library, as these commands are of the
4501 4511 kind which readline accepts in its configuration file.
4502 4512 \layout List
4503 4513 \labelwidthstring 00.00.0000
4504 4514
4505 4515
4506 4516 \family typewriter
4507 4517 \series bold
4508 4518 readline_remove_delims:
4509 4519 \family default
4510 4520 \series default
4511 4521 a string of characters to be removed from the default word-delimiters list
4512 4522 used by readline, so that completions may be performed on strings which
4513 4523 contain them.
4514 4524 Do not change the default value unless you know what you're doing.
4515 4525 \layout List
4516 4526 \labelwidthstring 00.00.0000
4517 4527
4518 4528
4519 4529 \family typewriter
4520 4530 \series bold
4521 4531 readline_omit__names
4522 4532 \family default
4523 4533 \series default
4524 4534 : when tab-completion is enabled, hitting
4525 4535 \family typewriter
4526 4536 <tab>
4527 4537 \family default
4528 4538 after a '
4529 4539 \family typewriter
4530 4540 .
4531 4541 \family default
4532 4542 ' in a name will complete all attributes of an object, including all the
4533 4543 special methods whose names include double underscores (like
4534 4544 \family typewriter
4535 4545 __getitem__
4536 4546 \family default
4537 4547 or
4538 4548 \family typewriter
4539 4549 __class__
4540 4550 \family default
4541 4551 ).
4542 4552 If you'd rather not see these names by default, you can set this option
4543 4553 to 1.
4544 4554 Note that even when this option is set, you can still see those names by
4545 4555 explicitly typing a
4546 4556 \family typewriter
4547 4557 _
4548 4558 \family default
4549 4559 after the period and hitting
4550 4560 \family typewriter
4551 4561 <tab>
4552 4562 \family default
4553 4563 : '
4554 4564 \family typewriter
4555 4565 name._<tab>
4556 4566 \family default
4557 4567 ' will always complete attribute names starting with '
4558 4568 \family typewriter
4559 4569 _
4560 4570 \family default
4561 4571 '.
4562 4572 \layout List
4563 4573 \labelwidthstring 00.00.0000
4564 4574
4565 4575 \SpecialChar ~
4566 4576 This option is off by default so that new users see all attributes of any
4567 4577 objects they are dealing with.
4568 4578 \layout Standard
4569 4579
4570 4580 You will find the default values along with a corresponding detailed explanation
4571 4581 in your
4572 4582 \family typewriter
4573 4583 ipythonrc
4574 4584 \family default
4575 4585 file.
4576 4586 \layout Subsection
4577 4587
4578 4588 Session logging and restoring
4579 4589 \layout Standard
4580 4590
4581 4591 You can log all input from a session either by starting IPython with the
4582 4592 command line switches
4583 4593 \family typewriter
4584 4594 -log
4585 4595 \family default
4586 4596 or
4587 4597 \family typewriter
4588 4598 -logfile
4589 4599 \family default
4590 4600 (see sec.
4591 4601
4592 4602 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
4593 4603
4594 4604 \end_inset
4595 4605
4596 4606 )or by activating the logging at any moment with the magic function
4597 4607 \family typewriter
4598 4608 %logstart
4599 4609 \family default
4600 4610 .
4601 4611
4602 4612 \layout Standard
4603 4613
4604 4614 Log files can later be reloaded with the
4605 4615 \family typewriter
4606 4616 -logplay
4607 4617 \family default
4608 4618 option and IPython will attempt to 'replay' the log by executing all the
4609 4619 lines in it, thus restoring the state of a previous session.
4610 4620 This feature is not quite perfect, but can still be useful in many cases.
4611 4621 \layout Standard
4612 4622
4613 4623 The log files can also be used as a way to have a permanent record of any
4614 4624 code you wrote while experimenting.
4615 4625 Log files are regular text files which you can later open in your favorite
4616 4626 text editor to extract code or to 'clean them up' before using them to
4617 4627 replay a session.
4618 4628 \layout Standard
4619 4629
4620 4630 The
4621 4631 \family typewriter
4622 4632 %logstart
4623 4633 \family default
4624 4634 function for activating logging in mid-session is used as follows:
4625 4635 \layout Standard
4626 4636
4627 4637
4628 4638 \family typewriter
4629 4639 %logstart [log_name [log_mode]]
4630 4640 \layout Standard
4631 4641
4632 4642 If no name is given, it defaults to a file named
4633 4643 \family typewriter
4634 4644 'log'
4635 4645 \family default
4636 4646 in your IPYTHONDIR directory, in
4637 4647 \family typewriter
4638 4648 'rotate'
4639 4649 \family default
4640 4650 mode (see below).
4641 4651 \layout Standard
4642 4652
4643 4653 '
4644 4654 \family typewriter
4645 4655 %logstart name
4646 4656 \family default
4647 4657 ' saves to file
4648 4658 \family typewriter
4649 4659 'name'
4650 4660 \family default
4651 4661 in
4652 4662 \family typewriter
4653 4663 'backup'
4654 4664 \family default
4655 4665 mode.
4656 4666 It saves your history up to that point and then continues logging.
4657 4667 \layout Standard
4658 4668
4659 4669
4660 4670 \family typewriter
4661 4671 %logstart
4662 4672 \family default
4663 4673 takes a second optional parameter: logging mode.
4664 4674 This can be one of (note that the modes are given unquoted):
4665 4675 \layout List
4666 4676 \labelwidthstring 00.00.0000
4667 4677
4668 4678
4669 4679 \family typewriter
4670 4680 over
4671 4681 \family default
4672 4682 : overwrite existing
4673 4683 \family typewriter
4674 4684 log_name
4675 4685 \family default
4676 4686 .
4677 4687 \layout List
4678 4688 \labelwidthstring 00.00.0000
4679 4689
4680 4690
4681 4691 \family typewriter
4682 4692 backup
4683 4693 \family default
4684 4694 : rename (if exists) to
4685 4695 \family typewriter
4686 4696 log_name~
4687 4697 \family default
4688 4698 and start
4689 4699 \family typewriter
4690 4700 log_name
4691 4701 \family default
4692 4702 .
4693 4703 \layout List
4694 4704 \labelwidthstring 00.00.0000
4695 4705
4696 4706
4697 4707 \family typewriter
4698 4708 append
4699 4709 \family default
4700 4710 : well, that says it.
4701 4711 \layout List
4702 4712 \labelwidthstring 00.00.0000
4703 4713
4704 4714
4705 4715 \family typewriter
4706 4716 rotate
4707 4717 \family default
4708 4718 : create rotating logs
4709 4719 \family typewriter
4710 4720 log_name
4711 4721 \family default
4712 4722 .
4713 4723 \family typewriter
4714 4724 1~
4715 4725 \family default
4716 4726 ,
4717 4727 \family typewriter
4718 4728 log_name.2~
4719 4729 \family default
4720 4730 , etc.
4721 4731 \layout Standard
4722 4732
4723 4733 The
4724 4734 \family typewriter
4725 4735 %logoff
4726 4736 \family default
4727 4737 and
4728 4738 \family typewriter
4729 4739 %logon
4730 4740 \family default
4731 4741 functions allow you to temporarily stop and resume logging to a file which
4732 4742 had previously been started with
4733 4743 \family typewriter
4734 4744 %logstart
4735 4745 \family default
4736 4746 .
4737 4747 They will fail (with an explanation) if you try to use them before logging
4738 4748 has been started.
4739 4749 \layout Subsection
4740 4750
4741 4751
4742 4752 \begin_inset LatexCommand \label{sub:System-shell-access}
4743 4753
4744 4754 \end_inset
4745 4755
4746 4756 System shell access
4747 4757 \layout Standard
4748 4758
4749 4759 Any input line beginning with a
4750 4760 \family typewriter
4751 4761 !
4752 4762 \family default
4753 4763 character is passed verbatim (minus the
4754 4764 \family typewriter
4755 4765 !
4756 4766 \family default
4757 4767 , of course) to the underlying operating system.
4758 4768 For example, typing
4759 4769 \family typewriter
4760 4770 !ls
4761 4771 \family default
4762 4772 will run
4763 4773 \family typewriter
4764 4774 'ls'
4765 4775 \family default
4766 4776 in the current directory.
4767 4777 \layout Subsubsection
4768 4778
4769 4779 Manual capture of command output
4770 4780 \layout Standard
4771 4781
4772 4782 If the input line begins with
4773 4783 \emph on
4774 4784 two
4775 4785 \emph default
4776 4786 exclamation marks,
4777 4787 \family typewriter
4778 4788 !!
4779 4789 \family default
4780 4790 , the command is executed but its output is captured and returned as a python
4781 4791 list, split on newlines.
4782 4792 Any output sent by the subprocess to standard error is printed separately,
4783 4793 so that the resulting list only captures standard output.
4784 4794 The
4785 4795 \family typewriter
4786 4796 !!
4787 4797 \family default
4788 4798 syntax is a shorthand for the
4789 4799 \family typewriter
4790 4800 %sx
4791 4801 \family default
4792 4802 magic command.
4793 4803 \layout Standard
4794 4804
4795 4805 Finally, the
4796 4806 \family typewriter
4797 4807 %sc
4798 4808 \family default
4799 4809 magic (short for `shell capture') is similar to
4800 4810 \family typewriter
4801 4811 %sx
4802 4812 \family default
4803 4813 , but allowing more fine-grained control of the capture details, and storing
4804 4814 the result directly into a named variable.
4805 4815 \layout Standard
4806 4816
4807 4817 See Sec.\SpecialChar ~
4808 4818
4809 4819 \begin_inset LatexCommand \ref{sec:magic}
4810 4820
4811 4821 \end_inset
4812 4822
4813 4823 for details on the magics
4814 4824 \family typewriter
4815 4825 %sc
4816 4826 \family default
4817 4827 and
4818 4828 \family typewriter
4819 4829 %sx
4820 4830 \family default
4821 4831 , or use IPython's own help (
4822 4832 \family typewriter
4823 4833 sc?
4824 4834 \family default
4825 4835 and
4826 4836 \family typewriter
4827 4837 sx?
4828 4838 \family default
4829 4839 ) for further details.
4830 4840 \layout Standard
4831 4841
4832 4842 IPython also allows you to expand the value of python variables when making
4833 4843 system calls.
4834 4844 Any python variable or expression which you prepend with
4835 4845 \family typewriter
4836 4846 $
4837 4847 \family default
4838 4848 will get expanded before the system call is made.
4839 4849
4840 4850 \layout Standard
4841 4851
4842 4852
4843 4853 \family typewriter
4844 4854 In [1]: pyvar='Hello world'
4845 4855 \newline
4846 4856 In [2]: !echo "A python variable: $pyvar"
4847 4857 \newline
4848 4858 A python variable: Hello world
4849 4859 \layout Standard
4850 4860
4851 4861 If you want the shell to actually see a literal
4852 4862 \family typewriter
4853 4863 $
4854 4864 \family default
4855 4865 , you need to type it twice:
4856 4866 \layout Standard
4857 4867
4858 4868
4859 4869 \family typewriter
4860 4870 In [3]: !echo "A system variable: $$HOME"
4861 4871 \newline
4862 4872 A system variable: /home/fperez
4863 4873 \layout Standard
4864 4874
4865 4875 You can pass arbitrary expressions, though you'll need to delimit them with
4866 4876
4867 4877 \family typewriter
4868 4878 {}
4869 4879 \family default
4870 4880 if there is ambiguity as to the extent of the expression:
4871 4881 \layout Standard
4872 4882
4873 4883
4874 4884 \family typewriter
4875 4885 In [5]: x=10
4876 4886 \newline
4877 4887 In [6]: y=20
4878 4888 \newline
4879 4889 In [13]: !echo $x+y
4880 4890 \newline
4881 4891 10+y
4882 4892 \newline
4883 4893 In [7]: !echo ${x+y}
4884 4894 \newline
4885 4895 30
4886 4896 \layout Standard
4887 4897
4888 4898 Even object attributes can be expanded:
4889 4899 \layout Standard
4890 4900
4891 4901
4892 4902 \family typewriter
4893 4903 In [12]: !echo $sys.argv
4894 4904 \newline
4895 4905 [/home/fperez/usr/bin/ipython]
4896 4906 \layout Subsection
4897 4907
4898 4908 System command aliases
4899 4909 \layout Standard
4900 4910
4901 4911 The
4902 4912 \family typewriter
4903 4913 %alias
4904 4914 \family default
4905 4915 magic function and the
4906 4916 \family typewriter
4907 4917 alias
4908 4918 \family default
4909 4919 option in the
4910 4920 \family typewriter
4911 4921 ipythonrc
4912 4922 \family default
4913 4923 configuration file allow you to define magic functions which are in fact
4914 4924 system shell commands.
4915 4925 These aliases can have parameters.
4916 4926
4917 4927 \layout Standard
4918 4928
4919 4929 '
4920 4930 \family typewriter
4921 4931 %alias alias_name cmd
4922 4932 \family default
4923 4933 ' defines '
4924 4934 \family typewriter
4925 4935 alias_name
4926 4936 \family default
4927 4937 ' as an alias for '
4928 4938 \family typewriter
4929 4939 cmd
4930 4940 \family default
4931 4941 '
4932 4942 \layout Standard
4933 4943
4934 4944 Then, typing '
4935 4945 \family typewriter
4936 4946 %alias_name params
4937 4947 \family default
4938 4948 ' will execute the system command '
4939 4949 \family typewriter
4940 4950 cmd params
4941 4951 \family default
4942 4952 ' (from your underlying operating system).
4943 4953
4944 4954 \layout Standard
4945 4955
4946 4956 You can also define aliases with parameters using
4947 4957 \family typewriter
4948 4958 %s
4949 4959 \family default
4950 4960 specifiers (one per parameter).
4951 4961 The following example defines the
4952 4962 \family typewriter
4953 4963 %parts
4954 4964 \family default
4955 4965 function as an alias to the command '
4956 4966 \family typewriter
4957 4967 echo first %s second %s
4958 4968 \family default
4959 4969 ' where each
4960 4970 \family typewriter
4961 4971 %s
4962 4972 \family default
4963 4973 will be replaced by a positional parameter to the call to
4964 4974 \family typewriter
4965 4975 %parts:
4966 4976 \layout Standard
4967 4977
4968 4978
4969 4979 \family typewriter
4970 4980 In [1]: alias parts echo first %s second %s
4971 4981 \newline
4972 4982 In [2]: %parts A B
4973 4983 \newline
4974 4984 first A second B
4975 4985 \newline
4976 4986 In [3]: %parts A
4977 4987 \newline
4978 4988 Incorrect number of arguments: 2 expected.
4979 4989
4980 4990 \newline
4981 4991 parts is an alias to: 'echo first %s second %s'
4982 4992 \layout Standard
4983 4993
4984 4994 If called with no parameters,
4985 4995 \family typewriter
4986 4996 %alias
4987 4997 \family default
4988 4998 prints the table of currently defined aliases.
4989 4999 \layout Standard
4990 5000
4991 5001 The
4992 5002 \family typewriter
4993 5003 %rehash/rehashx
4994 5004 \family default
4995 5005 magics allow you to load your entire
4996 5006 \family typewriter
4997 5007 $PATH
4998 5008 \family default
4999 5009 as ipython aliases.
5000 5010 See their respective docstrings (or sec.\SpecialChar ~
5001 5011
5002 5012 \begin_inset LatexCommand \ref{sec:magic}
5003 5013
5004 5014 \end_inset
5005 5015
5006 5016 for further details).
5007 5017 \layout Subsection
5008 5018
5009 5019
5010 5020 \begin_inset LatexCommand \label{sec:dreload}
5011 5021
5012 5022 \end_inset
5013 5023
5014 5024 Recursive reload
5015 5025 \layout Standard
5016 5026
5017 5027 The
5018 5028 \family typewriter
5019 5029 %dreload
5020 5030 \family default
5021 5031 command does a recursive reload of a module: changes made to the module
5022 5032 since you imported will actually be available without having to exit.
5023 5033 \layout Subsection
5024 5034
5025 5035 Verbose and colored exception traceback printouts
5026 5036 \layout Standard
5027 5037
5028 5038 IPython provides the option to see very detailed exception tracebacks, which
5029 5039 can be especially useful when debugging large programs.
5030 5040 You can run any Python file with the
5031 5041 \family typewriter
5032 5042 %run
5033 5043 \family default
5034 5044 function to benefit from these detailed tracebacks.
5035 5045 Furthermore, both normal and verbose tracebacks can be colored (if your
5036 5046 terminal supports it) which makes them much easier to parse visually.
5037 5047 \layout Standard
5038 5048
5039 5049 See the magic
5040 5050 \family typewriter
5041 5051 xmode
5042 5052 \family default
5043 5053 and
5044 5054 \family typewriter
5045 5055 colors
5046 5056 \family default
5047 5057 functions for details (just type
5048 5058 \family typewriter
5049 5059 %magic
5050 5060 \family default
5051 5061 ).
5052 5062 \layout Standard
5053 5063
5054 5064 These features are basically a terminal version of Ka-Ping Yee's
5055 5065 \family typewriter
5056 5066 cgitb
5057 5067 \family default
5058 5068 module, now part of the standard Python library.
5059 5069 \layout Subsection
5060 5070
5061 5071
5062 5072 \begin_inset LatexCommand \label{sec:cache_input}
5063 5073
5064 5074 \end_inset
5065 5075
5066 5076 Input caching system
5067 5077 \layout Standard
5068 5078
5069 5079 IPython offers numbered prompts (In/Out) with input and output caching.
5070 5080 All input is saved and can be retrieved as variables (besides the usual
5071 5081 arrow key recall).
5072 5082 \layout Standard
5073 5083
5074 5084 The following GLOBAL variables always exist (so don't overwrite them!):
5075 5085
5076 5086 \family typewriter
5077 5087 _i
5078 5088 \family default
5079 5089 : stores previous input.
5080 5090
5081 5091 \family typewriter
5082 5092 _ii
5083 5093 \family default
5084 5094 : next previous.
5085 5095
5086 5096 \family typewriter
5087 5097 _iii
5088 5098 \family default
5089 5099 : next-next previous.
5090 5100
5091 5101 \family typewriter
5092 5102 _ih
5093 5103 \family default
5094 5104 : a list of all input
5095 5105 \family typewriter
5096 5106 _ih[n]
5097 5107 \family default
5098 5108 is the input from line
5099 5109 \family typewriter
5100 5110 n
5101 5111 \family default
5102 5112 and this list is aliased to the global variable
5103 5113 \family typewriter
5104 5114 In
5105 5115 \family default
5106 5116 .
5107 5117 If you overwrite
5108 5118 \family typewriter
5109 5119 In
5110 5120 \family default
5111 5121 with a variable of your own, you can remake the assignment to the internal
5112 5122 list with a simple
5113 5123 \family typewriter
5114 5124 'In=_ih'
5115 5125 \family default
5116 5126 .
5117 5127 \layout Standard
5118 5128
5119 5129 Additionally, global variables named
5120 5130 \family typewriter
5121 5131 _i<n>
5122 5132 \family default
5123 5133 are dynamically created (
5124 5134 \family typewriter
5125 5135 <n>
5126 5136 \family default
5127 5137 being the prompt counter), such that
5128 5138 \newline
5129 5139
5130 5140 \family typewriter
5131 5141 _i<n> == _ih[<n>] == In[<n>].
5132 5142 \layout Standard
5133 5143
5134 5144 For example, what you typed at prompt 14 is available as
5135 5145 \family typewriter
5136 5146 _i14,
5137 5147 \family default
5138 5148
5139 5149 \family typewriter
5140 5150 _ih[14]
5141 5151 \family default
5142 5152 and
5143 5153 \family typewriter
5144 5154 In[14]
5145 5155 \family default
5146 5156 .
5147 5157 \layout Standard
5148 5158
5149 5159 This allows you to easily cut and paste multi line interactive prompts by
5150 5160 printing them out: they print like a clean string, without prompt characters.
5151 5161 You can also manipulate them like regular variables (they are strings),
5152 5162 modify or exec them (typing
5153 5163 \family typewriter
5154 5164 'exec _i9'
5155 5165 \family default
5156 5166 will re-execute the contents of input prompt 9, '
5157 5167 \family typewriter
5158 5168 exec In[9:14]+In[18]
5159 5169 \family default
5160 5170 ' will re-execute lines 9 through 13 and line 18).
5161 5171 \layout Standard
5162 5172
5163 5173 You can also re-execute multiple lines of input easily by using the magic
5164 5174
5165 5175 \family typewriter
5166 5176 %macro
5167 5177 \family default
5168 5178 function (which automates the process and allows re-execution without having
5169 5179 to type '
5170 5180 \family typewriter
5171 5181 exec
5172 5182 \family default
5173 5183 ' every time).
5174 5184 The macro system also allows you to re-execute previous lines which include
5175 5185 magic function calls (which require special processing).
5176 5186 Type
5177 5187 \family typewriter
5178 5188 %macro?
5179 5189 \family default
5180 5190 or see sec.
5181 5191
5182 5192 \begin_inset LatexCommand \ref{sec:magic}
5183 5193
5184 5194 \end_inset
5185 5195
5186 5196 for more details on the macro system.
5187 5197 \layout Standard
5188 5198
5189 5199 A history function
5190 5200 \family typewriter
5191 5201 %hist
5192 5202 \family default
5193 5203 allows you to see any part of your input history by printing a range of
5194 5204 the
5195 5205 \family typewriter
5196 5206 _i
5197 5207 \family default
5198 5208 variables.
5199 5209 \layout Subsection
5200 5210
5201 5211
5202 5212 \begin_inset LatexCommand \label{sec:cache_output}
5203 5213
5204 5214 \end_inset
5205 5215
5206 5216 Output caching system
5207 5217 \layout Standard
5208 5218
5209 5219 For output that is returned from actions, a system similar to the input
5210 5220 cache exists but using
5211 5221 \family typewriter
5212 5222 _
5213 5223 \family default
5214 5224 instead of
5215 5225 \family typewriter
5216 5226 _i
5217 5227 \family default
5218 5228 .
5219 5229 Only actions that produce a result (NOT assignments, for example) are cached.
5220 5230 If you are familiar with Mathematica, IPython's
5221 5231 \family typewriter
5222 5232 _
5223 5233 \family default
5224 5234 variables behave exactly like Mathematica's
5225 5235 \family typewriter
5226 5236 %
5227 5237 \family default
5228 5238 variables.
5229 5239 \layout Standard
5230 5240
5231 5241 The following GLOBAL variables always exist (so don't overwrite them!):
5232 5242
5233 5243 \layout List
5234 5244 \labelwidthstring 00.00.0000
5235 5245
5236 5246
5237 5247 \family typewriter
5238 5248 \series bold
5239 5249 _
5240 5250 \family default
5241 5251 \series default
5242 5252 (a
5243 5253 \emph on
5244 5254 single
5245 5255 \emph default
5246 5256 underscore) : stores previous output, like Python's default interpreter.
5247 5257 \layout List
5248 5258 \labelwidthstring 00.00.0000
5249 5259
5250 5260
5251 5261 \family typewriter
5252 5262 \series bold
5253 5263 __
5254 5264 \family default
5255 5265 \series default
5256 5266 (two underscores): next previous.
5257 5267 \layout List
5258 5268 \labelwidthstring 00.00.0000
5259 5269
5260 5270
5261 5271 \family typewriter
5262 5272 \series bold
5263 5273 ___
5264 5274 \family default
5265 5275 \series default
5266 5276 (three underscores): next-next previous.
5267 5277 \layout Standard
5268 5278
5269 5279 Additionally, global variables named
5270 5280 \family typewriter
5271 5281 _<n>
5272 5282 \family default
5273 5283 are dynamically created (
5274 5284 \family typewriter
5275 5285 <n>
5276 5286 \family default
5277 5287 being the prompt counter), such that the result of output
5278 5288 \family typewriter
5279 5289 <n>
5280 5290 \family default
5281 5291 is always available as
5282 5292 \family typewriter
5283 5293 _<n>
5284 5294 \family default
5285 5295 (don't use the angle brackets, just the number, e.g.
5286 5296
5287 5297 \family typewriter
5288 5298 _21
5289 5299 \family default
5290 5300 ).
5291 5301 \layout Standard
5292 5302
5293 5303 These global variables are all stored in a global dictionary (not a list,
5294 5304 since it only has entries for lines which returned a result) available
5295 5305 under the names
5296 5306 \family typewriter
5297 5307 _oh
5298 5308 \family default
5299 5309 and
5300 5310 \family typewriter
5301 5311 Out
5302 5312 \family default
5303 5313 (similar to
5304 5314 \family typewriter
5305 5315 _ih
5306 5316 \family default
5307 5317 and
5308 5318 \family typewriter
5309 5319 In
5310 5320 \family default
5311 5321 ).
5312 5322 So the output from line 12 can be obtained as
5313 5323 \family typewriter
5314 5324 _12
5315 5325 \family default
5316 5326 ,
5317 5327 \family typewriter
5318 5328 Out[12]
5319 5329 \family default
5320 5330 or
5321 5331 \family typewriter
5322 5332 _oh[12]
5323 5333 \family default
5324 5334 .
5325 5335 If you accidentally overwrite the
5326 5336 \family typewriter
5327 5337 Out
5328 5338 \family default
5329 5339 variable you can recover it by typing
5330 5340 \family typewriter
5331 5341 'Out=_oh
5332 5342 \family default
5333 5343 ' at the prompt.
5334 5344 \layout Standard
5335 5345
5336 5346 This system obviously can potentially put heavy memory demands on your system,
5337 5347 since it prevents Python's garbage collector from removing any previously
5338 5348 computed results.
5339 5349 You can control how many results are kept in memory with the option (at
5340 5350 the command line or in your
5341 5351 \family typewriter
5342 5352 ipythonrc
5343 5353 \family default
5344 5354 file)
5345 5355 \family typewriter
5346 5356 cache_size
5347 5357 \family default
5348 5358 .
5349 5359 If you set it to 0, the whole system is completely disabled and the prompts
5350 5360 revert to the classic
5351 5361 \family typewriter
5352 5362 '>>>'
5353 5363 \family default
5354 5364 of normal Python.
5355 5365 \layout Subsection
5356 5366
5357 5367 Directory history
5358 5368 \layout Standard
5359 5369
5360 5370 Your history of visited directories is kept in the global list
5361 5371 \family typewriter
5362 5372 _dh
5363 5373 \family default
5364 5374 , and the magic
5365 5375 \family typewriter
5366 5376 %cd
5367 5377 \family default
5368 5378 command can be used to go to any entry in that list.
5369 5379 The
5370 5380 \family typewriter
5371 5381 %dhist
5372 5382 \family default
5373 5383 command allows you to view this history.
5374 5384 \layout Subsection
5375 5385
5376 5386 Automatic parentheses and quotes
5377 5387 \layout Standard
5378 5388
5379 5389 These features were adapted from Nathan Gray's LazyPython.
5380 5390 They are meant to allow less typing for common situations.
5381 5391 \layout Subsubsection
5382 5392
5383 5393 Automatic parentheses
5384 5394 \layout Standard
5385 5395
5386 5396 Callable objects (i.e.
5387 5397 functions, methods, etc) can be invoked like this (notice the commas between
5388 5398 the arguments):
5389 5399 \layout Standard
5390 5400
5391 5401
5392 5402 \family typewriter
5393 5403 >>> callable_ob arg1, arg2, arg3
5394 5404 \layout Standard
5395 5405
5396 5406 and the input will be translated to this:
5397 5407 \layout Standard
5398 5408
5399 5409
5400 5410 \family typewriter
5401 5411 --> callable_ob(arg1, arg2, arg3)
5402 5412 \layout Standard
5403 5413
5404 5414 You can force automatic parentheses by using '/' as the first character
5405 5415 of a line.
5406 5416 For example:
5407 5417 \layout Standard
5408 5418
5409 5419
5410 5420 \family typewriter
5411 5421 >>> /globals # becomes 'globals()'
5412 5422 \layout Standard
5413 5423
5414 5424 Note that the '/' MUST be the first character on the line! This won't work:
5415 5425
5416 5426 \layout Standard
5417 5427
5418 5428
5419 5429 \family typewriter
5420 5430 >>> print /globals # syntax error
5421 5431 \layout Standard
5422 5432
5423 5433 In most cases the automatic algorithm should work, so you should rarely
5424 5434 need to explicitly invoke /.
5425 5435 One notable exception is if you are trying to call a function with a list
5426 5436 of tuples as arguments (the parenthesis will confuse IPython):
5427 5437 \layout Standard
5428 5438
5429 5439
5430 5440 \family typewriter
5431 5441 In [1]: zip (1,2,3),(4,5,6) # won't work
5432 5442 \layout Standard
5433 5443
5434 5444 but this will work:
5435 5445 \layout Standard
5436 5446
5437 5447
5438 5448 \family typewriter
5439 5449 In [2]: /zip (1,2,3),(4,5,6)
5440 5450 \newline
5441 5451 ------> zip ((1,2,3),(4,5,6))
5442 5452 \newline
5443 5453 Out[2]= [(1, 4), (2, 5), (3, 6)]
5444 5454 \layout Standard
5445 5455
5446 5456 IPython tells you that it has altered your command line by displaying the
5447 5457 new command line preceded by
5448 5458 \family typewriter
5449 5459 -->
5450 5460 \family default
5451 5461 .
5452 5462 e.g.:
5453 5463 \layout Standard
5454 5464
5455 5465
5456 5466 \family typewriter
5457 5467 In [18]: callable list
5458 5468 \newline
5459 5469 -------> callable (list)
5460 5470 \layout Subsubsection
5461 5471
5462 5472 Automatic quoting
5463 5473 \layout Standard
5464 5474
5465 5475 You can force automatic quoting of a function's arguments by using
5466 5476 \family typewriter
5467 5477 `,'
5468 5478 \family default
5469 5479 or
5470 5480 \family typewriter
5471 5481 `;'
5472 5482 \family default
5473 5483 as the first character of a line.
5474 5484 For example:
5475 5485 \layout Standard
5476 5486
5477 5487
5478 5488 \family typewriter
5479 5489 >>> ,my_function /home/me # becomes my_function("/home/me")
5480 5490 \layout Standard
5481 5491
5482 5492 If you use
5483 5493 \family typewriter
5484 5494 `;'
5485 5495 \family default
5486 5496 instead, the whole argument is quoted as a single string (while
5487 5497 \family typewriter
5488 5498 `,'
5489 5499 \family default
5490 5500 splits on whitespace):
5491 5501 \layout Standard
5492 5502
5493 5503
5494 5504 \family typewriter
5495 5505 >>> ,my_function a b c # becomes my_function("a","b","c")
5496 5506 \layout Standard
5497 5507
5498 5508
5499 5509 \family typewriter
5500 5510 >>> ;my_function a b c # becomes my_function("a b c")
5501 5511 \layout Standard
5502 5512
5503 5513 Note that the `
5504 5514 \family typewriter
5505 5515 ,
5506 5516 \family default
5507 5517 ' or `
5508 5518 \family typewriter
5509 5519 ;
5510 5520 \family default
5511 5521 ' MUST be the first character on the line! This won't work:
5512 5522 \layout Standard
5513 5523
5514 5524
5515 5525 \family typewriter
5516 5526 >>> x = ,my_function /home/me # syntax error
5517 5527 \layout Section
5518 5528
5519 5529
5520 5530 \begin_inset LatexCommand \label{sec:customization}
5521 5531
5522 5532 \end_inset
5523 5533
5524 5534 Customization
5525 5535 \layout Standard
5526 5536
5527 5537 As we've already mentioned, IPython reads a configuration file which can
5528 5538 be specified at the command line (
5529 5539 \family typewriter
5530 5540 -rcfile
5531 5541 \family default
5532 5542 ) or which by default is assumed to be called
5533 5543 \family typewriter
5534 5544 ipythonrc
5535 5545 \family default
5536 5546 .
5537 5547 Such a file is looked for in the current directory where IPython is started
5538 5548 and then in your
5539 5549 \family typewriter
5540 5550 IPYTHONDIR
5541 5551 \family default
5542 5552 , which allows you to have local configuration files for specific projects.
5543 5553 In this section we will call these types of configuration files simply
5544 5554 rcfiles (short for resource configuration file).
5545 5555 \layout Standard
5546 5556
5547 5557 The syntax of an rcfile is one of key-value pairs separated by whitespace,
5548 5558 one per line.
5549 5559 Lines beginning with a
5550 5560 \family typewriter
5551 5561 #
5552 5562 \family default
5553 5563 are ignored as comments, but comments can
5554 5564 \series bold
5555 5565 not
5556 5566 \series default
5557 5567 be put on lines with data (the parser is fairly primitive).
5558 5568 Note that these are not python files, and this is deliberate, because it
5559 5569 allows us to do some things which would be quite tricky to implement if
5560 5570 they were normal python files.
5561 5571 \layout Standard
5562 5572
5563 5573 First, an rcfile can contain permanent default values for almost all command
5564 5574 line options (except things like
5565 5575 \family typewriter
5566 5576 -help
5567 5577 \family default
5568 5578 or
5569 5579 \family typewriter
5570 5580 -Version
5571 5581 \family default
5572 5582 ).
5573 5583 Sec\SpecialChar ~
5574 5584
5575 5585 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5576 5586
5577 5587 \end_inset
5578 5588
5579 5589 contains a description of all command-line options.
5580 5590 However, values you explicitly specify at the command line override the
5581 5591 values defined in the rcfile.
5582 5592 \layout Standard
5583 5593
5584 5594 Besides command line option values, the rcfile can specify values for certain
5585 5595 extra special options which are not available at the command line.
5586 5596 These options are briefly described below.
5587 5597
5588 5598 \layout Standard
5589 5599
5590 5600 Each of these options may appear as many times as you need it in the file.
5591 5601 \layout List
5592 5602 \labelwidthstring 00.00.0000
5593 5603
5594 5604
5595 5605 \family typewriter
5596 5606 \series bold
5597 5607 include\SpecialChar ~
5598 5608 <file1>\SpecialChar ~
5599 5609 <file2>\SpecialChar ~
5600 5610 ...
5601 5611 \family default
5602 5612 \series default
5603 5613 : you can name
5604 5614 \emph on
5605 5615 other
5606 5616 \emph default
5607 5617 rcfiles you want to recursively load up to 15 levels (don't use the
5608 5618 \family typewriter
5609 5619 <>
5610 5620 \family default
5611 5621 brackets in your names!).
5612 5622 This feature allows you to define a 'base' rcfile with general options
5613 5623 and special-purpose files which can be loaded only when needed with particular
5614 5624 configuration options.
5615 5625 To make this more convenient, IPython accepts the
5616 5626 \family typewriter
5617 5627 -profile <name>
5618 5628 \family default
5619 5629 option (abbreviates to
5620 5630 \family typewriter
5621 5631 -p <name
5622 5632 \family default
5623 5633 >)
5624 5634 \family typewriter
5625 5635 which
5626 5636 \family default
5627 5637 tells it to look for an rcfile named
5628 5638 \family typewriter
5629 5639 ipythonrc-<name>
5630 5640 \family default
5631 5641 .
5632 5642
5633 5643 \layout List
5634 5644 \labelwidthstring 00.00.0000
5635 5645
5636 5646
5637 5647 \family typewriter
5638 5648 \series bold
5639 5649 import_mod\SpecialChar ~
5640 5650 <mod1>\SpecialChar ~
5641 5651 <mod2>\SpecialChar ~
5642 5652 ...
5643 5653 \family default
5644 5654 \series default
5645 5655 : import modules with '
5646 5656 \family typewriter
5647 5657 import
5648 5658 \family default
5649 5659
5650 5660 \family typewriter
5651 5661 <mod1>,<mod2>,...
5652 5662 \family default
5653 5663 '
5654 5664 \layout List
5655 5665 \labelwidthstring 00.00.0000
5656 5666
5657 5667
5658 5668 \family typewriter
5659 5669 \series bold
5660 5670 import_some\SpecialChar ~
5661 5671 <mod>\SpecialChar ~
5662 5672 <f1>\SpecialChar ~
5663 5673 <f2>\SpecialChar ~
5664 5674 ...
5665 5675 \family default
5666 5676 \series default
5667 5677 : import functions with '
5668 5678 \family typewriter
5669 5679 from <mod> import
5670 5680 \family default
5671 5681
5672 5682 \family typewriter
5673 5683 <f1>,<f2>,...
5674 5684 \family default
5675 5685 '
5676 5686 \layout List
5677 5687 \labelwidthstring 00.00.0000
5678 5688
5679 5689
5680 5690 \family typewriter
5681 5691 \series bold
5682 5692 import_all\SpecialChar ~
5683 5693 <mod1>\SpecialChar ~
5684 5694 <mod2>\SpecialChar ~
5685 5695 ...
5686 5696 \family default
5687 5697 \series default
5688 5698 : for each module listed import functions with '
5689 5699 \family typewriter
5690 5700 from <mod> import *
5691 5701 \family default
5692 5702 '
5693 5703 \layout List
5694 5704 \labelwidthstring 00.00.0000
5695 5705
5696 5706
5697 5707 \family typewriter
5698 5708 \series bold
5699 5709 execute\SpecialChar ~
5700 5710 <python\SpecialChar ~
5701 5711 code>
5702 5712 \family default
5703 5713 \series default
5704 5714 : give any single-line python code to be executed.
5705 5715 \layout List
5706 5716 \labelwidthstring 00.00.0000
5707 5717
5708 5718
5709 5719 \family typewriter
5710 5720 \series bold
5711 5721 execfile\SpecialChar ~
5712 5722 <filename>
5713 5723 \family default
5714 5724 \series default
5715 5725 : execute the python file given with an '
5716 5726 \family typewriter
5717 5727 execfile(filename)
5718 5728 \family default
5719 5729 ' command.
5720 5730 Username expansion is performed on the given names.
5721 5731 So if you need any amount of extra fancy customization that won't fit in
5722 5732 any of the above 'canned' options, you can just put it in a separate python
5723 5733 file and execute it.
5724 5734 \layout List
5725 5735 \labelwidthstring 00.00.0000
5726 5736
5727 5737
5728 5738 \family typewriter
5729 5739 \series bold
5730 5740 alias\SpecialChar ~
5731 5741 <alias_def>
5732 5742 \family default
5733 5743 \series default
5734 5744 : this is equivalent to calling '
5735 5745 \family typewriter
5736 5746 %alias\SpecialChar ~
5737 5747 <alias_def>
5738 5748 \family default
5739 5749 ' at the IPython command line.
5740 5750 This way, from within IPython you can do common system tasks without having
5741 5751 to exit it or use the
5742 5752 \family typewriter
5743 5753 !
5744 5754 \family default
5745 5755 escape.
5746 5756 IPython isn't meant to be a shell replacement, but it is often very useful
5747 5757 to be able to do things with files while testing code.
5748 5758 This gives you the flexibility to have within IPython any aliases you may
5749 5759 be used to under your normal system shell.
5750 5760 \layout Subsection
5751 5761
5752 5762
5753 5763 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
5754 5764
5755 5765 \end_inset
5756 5766
5757 5767 Sample
5758 5768 \family typewriter
5759 5769 ipythonrc
5760 5770 \family default
5761 5771 file
5762 5772 \layout Standard
5763 5773
5764 5774 The default rcfile, called
5765 5775 \family typewriter
5766 5776 ipythonrc
5767 5777 \family default
5768 5778 and supplied in your
5769 5779 \family typewriter
5770 5780 IPYTHONDIR
5771 5781 \family default
5772 5782 directory contains lots of comments on all of these options.
5773 5783 We reproduce it here for reference:
5774 5784 \layout Standard
5775 5785
5776 5786
5777 5787 \begin_inset ERT
5778 5788 status Open
5779 5789
5780 5790 \layout Standard
5781 5791
5782 5792 \backslash
5783 5793 codelist{../IPython/UserConfig/ipythonrc}
5784 5794 \end_inset
5785 5795
5786 5796
5787 5797 \layout Subsection
5788 5798
5789 5799
5790 5800 \begin_inset LatexCommand \label{sec:prompts}
5791 5801
5792 5802 \end_inset
5793 5803
5794 5804 Fine-tuning your prompt
5795 5805 \layout Standard
5796 5806
5797 5807 IPython's prompts can be customized using a syntax similar to that of the
5798 5808
5799 5809 \family typewriter
5800 5810 bash
5801 5811 \family default
5802 5812 shell.
5803 5813 Many of
5804 5814 \family typewriter
5805 5815 bash
5806 5816 \family default
5807 5817 's escapes are supported, as well as a few additional ones.
5808 5818 We list them below:
5809 5819 \layout Description
5810 5820
5811 5821
5812 5822 \backslash
5813 5823 # the prompt/history count number
5814 5824 \layout Description
5815 5825
5816 5826
5817 5827 \backslash
5818 5828 D the prompt/history count, with the actual digits replaced by dots.
5819 5829 Used mainly in continuation prompts (prompt_in2)
5820 5830 \layout Description
5821 5831
5822 5832
5823 5833 \backslash
5824 5834 w the current working directory
5825 5835 \layout Description
5826 5836
5827 5837
5828 5838 \backslash
5829 5839 W the basename of current working directory
5830 5840 \layout Description
5831 5841
5832 5842
5833 5843 \backslash
5834 5844 X
5835 5845 \emph on
5836 5846 n
5837 5847 \emph default
5838 5848 where
5839 5849 \begin_inset Formula $n=0\ldots5.$
5840 5850 \end_inset
5841 5851
5842 5852 The current working directory, with
5843 5853 \family typewriter
5844 5854 $HOME
5845 5855 \family default
5846 5856 replaced by
5847 5857 \family typewriter
5848 5858 ~
5849 5859 \family default
5850 5860 , and filtered out to contain only
5851 5861 \begin_inset Formula $n$
5852 5862 \end_inset
5853 5863
5854 5864 path elements
5855 5865 \layout Description
5856 5866
5857 5867
5858 5868 \backslash
5859 5869 Y
5860 5870 \emph on
5861 5871 n
5862 5872 \emph default
5863 5873 Similar to
5864 5874 \backslash
5865 5875 X
5866 5876 \emph on
5867 5877 n
5868 5878 \emph default
5869 5879 , but with the
5870 5880 \begin_inset Formula $n+1$
5871 5881 \end_inset
5872 5882
5873 5883 element included if it is
5874 5884 \family typewriter
5875 5885 ~
5876 5886 \family default
5877 5887 (this is similar to the behavior of the %c
5878 5888 \emph on
5879 5889 n
5880 5890 \emph default
5881 5891 escapes in
5882 5892 \family typewriter
5883 5893 tcsh
5884 5894 \family default
5885 5895 )
5886 5896 \layout Description
5887 5897
5888 5898
5889 5899 \backslash
5890 5900 u the username of the current user
5891 5901 \layout Description
5892 5902
5893 5903
5894 5904 \backslash
5895 5905 $ if the effective UID is 0, a #, otherwise a $
5896 5906 \layout Description
5897 5907
5898 5908
5899 5909 \backslash
5900 5910 h the hostname up to the first `.'
5901 5911 \layout Description
5902 5912
5903 5913
5904 5914 \backslash
5905 5915 H the hostname
5906 5916 \layout Description
5907 5917
5908 5918
5909 5919 \backslash
5910 5920 n a newline
5911 5921 \layout Description
5912 5922
5913 5923
5914 5924 \backslash
5915 5925 r a carriage return
5916 5926 \layout Description
5917 5927
5918 5928
5919 5929 \backslash
5920 5930 v IPython version string
5921 5931 \layout Standard
5922 5932
5923 5933 In addition to these, ANSI color escapes can be insterted into the prompts,
5924 5934 as
5925 5935 \family typewriter
5926 5936
5927 5937 \backslash
5928 5938 C_
5929 5939 \emph on
5930 5940 ColorName
5931 5941 \family default
5932 5942 \emph default
5933 5943 .
5934 5944 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
5935 5945 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
5936 5946 Normal, Purple, Red, White, Yellow.
5937 5947 \layout Standard
5938 5948
5939 5949 Finally, IPython supports the evaluation of arbitrary expressions in your
5940 5950 prompt string.
5941 5951 The prompt strings are evaluated through the syntax of PEP 215, but basically
5942 5952 you can use
5943 5953 \family typewriter
5944 5954 $x.y
5945 5955 \family default
5946 5956 to expand the value of
5947 5957 \family typewriter
5948 5958 x.y
5949 5959 \family default
5950 5960 , and for more complicated expressions you can use braces:
5951 5961 \family typewriter
5952 5962 ${foo()+x}
5953 5963 \family default
5954 5964 will call function
5955 5965 \family typewriter
5956 5966 foo
5957 5967 \family default
5958 5968 and add to it the value of
5959 5969 \family typewriter
5960 5970 x
5961 5971 \family default
5962 5972 , before putting the result into your prompt.
5963 5973 For example, using
5964 5974 \newline
5965 5975
5966 5976 \family typewriter
5967 5977 prompt_in1 '${commands.getoutput("uptime")}
5968 5978 \backslash
5969 5979 nIn [
5970 5980 \backslash
5971 5981 #]: '
5972 5982 \newline
5973 5983
5974 5984 \family default
5975 5985 will print the result of the uptime command on each prompt (assuming the
5976 5986
5977 5987 \family typewriter
5978 5988 commands
5979 5989 \family default
5980 5990 module has been imported in your
5981 5991 \family typewriter
5982 5992 ipythonrc
5983 5993 \family default
5984 5994 file).
5985 5995 \layout Subsubsection
5986 5996
5987 5997 Prompt examples
5988 5998 \layout Standard
5989 5999
5990 6000 The following options in an ipythonrc file will give you IPython's default
5991 6001 prompts:
5992 6002 \layout Standard
5993 6003
5994 6004
5995 6005 \family typewriter
5996 6006 prompt_in1 'In [
5997 6007 \backslash
5998 6008 #]:'
5999 6009 \newline
6000 6010 prompt_in2 '\SpecialChar ~
6001 6011 \SpecialChar ~
6002 6012 \SpecialChar ~
6003 6013 .
6004 6014 \backslash
6005 6015 D.:'
6006 6016 \newline
6007 6017 prompt_out 'Out[
6008 6018 \backslash
6009 6019 #]:'
6010 6020 \layout Standard
6011 6021
6012 6022 which look like this:
6013 6023 \layout Standard
6014 6024
6015 6025
6016 6026 \family typewriter
6017 6027 In [1]: 1+2
6018 6028 \newline
6019 6029 Out[1]: 3
6020 6030 \layout Standard
6021 6031
6022 6032
6023 6033 \family typewriter
6024 6034 In [2]: for i in (1,2,3):
6025 6035 \newline
6026 6036
6027 6037 \begin_inset ERT
6028 6038 status Collapsed
6029 6039
6030 6040 \layout Standard
6031 6041
6032 6042 \backslash
6033 6043 hspace*{0mm}
6034 6044 \end_inset
6035 6045
6036 6046 \SpecialChar ~
6037 6047 \SpecialChar ~
6038 6048 \SpecialChar ~
6039 6049 ...: \SpecialChar ~
6040 6050 \SpecialChar ~
6041 6051 \SpecialChar ~
6042 6052 \SpecialChar ~
6043 6053 print i,
6044 6054 \newline
6045 6055
6046 6056 \begin_inset ERT
6047 6057 status Collapsed
6048 6058
6049 6059 \layout Standard
6050 6060
6051 6061 \backslash
6052 6062 hspace*{0mm}
6053 6063 \end_inset
6054 6064
6055 6065 \SpecialChar ~
6056 6066 \SpecialChar ~
6057 6067 \SpecialChar ~
6058 6068 ...:
6059 6069 \newline
6060 6070 1 2 3
6061 6071 \layout Standard
6062 6072
6063 6073 These will give you a very colorful prompt with path information:
6064 6074 \layout Standard
6065 6075
6066 6076
6067 6077 \family typewriter
6068 6078 #prompt_in1 '
6069 6079 \backslash
6070 6080 C_Red
6071 6081 \backslash
6072 6082 u
6073 6083 \backslash
6074 6084 C_Blue[
6075 6085 \backslash
6076 6086 C_Cyan
6077 6087 \backslash
6078 6088 Y1
6079 6089 \backslash
6080 6090 C_Blue]
6081 6091 \backslash
6082 6092 C_LightGreen
6083 6093 \backslash
6084 6094 #>'
6085 6095 \newline
6086 6096 prompt_in2 ' ..
6087 6097 \backslash
6088 6098 D>'
6089 6099 \newline
6090 6100 prompt_out '<
6091 6101 \backslash
6092 6102 #>'
6093 6103 \layout Standard
6094 6104
6095 6105 which look like this:
6096 6106 \layout Standard
6097 6107
6098 6108
6099 6109 \family typewriter
6100 6110 \color red
6101 6111 fperez
6102 6112 \color blue
6103 6113 [
6104 6114 \color cyan
6105 6115 ~/ipython
6106 6116 \color blue
6107 6117 ]
6108 6118 \color green
6109 6119 1>
6110 6120 \color default
6111 6121 1+2
6112 6122 \newline
6113 6123
6114 6124 \begin_inset ERT
6115 6125 status Collapsed
6116 6126
6117 6127 \layout Standard
6118 6128
6119 6129 \backslash
6120 6130 hspace*{0mm}
6121 6131 \end_inset
6122 6132
6123 6133 \SpecialChar ~
6124 6134 \SpecialChar ~
6125 6135 \SpecialChar ~
6126 6136 \SpecialChar ~
6127 6137 \SpecialChar ~
6128 6138 \SpecialChar ~
6129 6139 \SpecialChar ~
6130 6140 \SpecialChar ~
6131 6141 \SpecialChar ~
6132 6142 \SpecialChar ~
6133 6143 \SpecialChar ~
6134 6144 \SpecialChar ~
6135 6145 \SpecialChar ~
6136 6146 \SpecialChar ~
6137 6147 \SpecialChar ~
6138 6148 \SpecialChar ~
6139 6149
6140 6150 \color red
6141 6151 <1>
6142 6152 \color default
6143 6153 3
6144 6154 \newline
6145 6155
6146 6156 \color red
6147 6157 fperez
6148 6158 \color blue
6149 6159 [
6150 6160 \color cyan
6151 6161 ~/ipython
6152 6162 \color blue
6153 6163 ]
6154 6164 \color green
6155 6165 2>
6156 6166 \color default
6157 6167 for i in (1,2,3):
6158 6168 \newline
6159 6169
6160 6170 \begin_inset ERT
6161 6171 status Collapsed
6162 6172
6163 6173 \layout Standard
6164 6174
6165 6175 \backslash
6166 6176 hspace*{0mm}
6167 6177 \end_inset
6168 6178
6169 6179 \SpecialChar ~
6170 6180 \SpecialChar ~
6171 6181 \SpecialChar ~
6172 6182 \SpecialChar ~
6173 6183 \SpecialChar ~
6174 6184 \SpecialChar ~
6175 6185 \SpecialChar ~
6176 6186 \SpecialChar ~
6177 6187 \SpecialChar ~
6178 6188 \SpecialChar ~
6179 6189 \SpecialChar ~
6180 6190 \SpecialChar ~
6181 6191 \SpecialChar ~
6182 6192 \SpecialChar ~
6183 6193 \SpecialChar ~
6184 6194
6185 6195 \color green
6186 6196 ...>
6187 6197 \color default
6188 6198 \SpecialChar ~
6189 6199 \SpecialChar ~
6190 6200 \SpecialChar ~
6191 6201 \SpecialChar ~
6192 6202 print i,
6193 6203 \newline
6194 6204
6195 6205 \begin_inset ERT
6196 6206 status Collapsed
6197 6207
6198 6208 \layout Standard
6199 6209
6200 6210 \backslash
6201 6211 hspace*{0mm}
6202 6212 \end_inset
6203 6213
6204 6214 \SpecialChar ~
6205 6215 \SpecialChar ~
6206 6216 \SpecialChar ~
6207 6217 \SpecialChar ~
6208 6218 \SpecialChar ~
6209 6219 \SpecialChar ~
6210 6220 \SpecialChar ~
6211 6221 \SpecialChar ~
6212 6222 \SpecialChar ~
6213 6223 \SpecialChar ~
6214 6224 \SpecialChar ~
6215 6225 \SpecialChar ~
6216 6226 \SpecialChar ~
6217 6227 \SpecialChar ~
6218 6228 \SpecialChar ~
6219 6229
6220 6230 \color green
6221 6231 ...>
6222 6232 \color default
6223 6233
6224 6234 \newline
6225 6235 1 2 3
6226 6236 \layout Standard
6227 6237
6228 6238 The following shows the usage of dynamic expression evaluation:
6229 6239 \layout Subsection
6230 6240
6231 6241
6232 6242 \begin_inset LatexCommand \label{sec:profiles}
6233 6243
6234 6244 \end_inset
6235 6245
6236 6246 IPython profiles
6237 6247 \layout Standard
6238 6248
6239 6249 As we already mentioned, IPython supports the
6240 6250 \family typewriter
6241 6251 -profile
6242 6252 \family default
6243 6253 command-line option (see sec.
6244 6254
6245 6255 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
6246 6256
6247 6257 \end_inset
6248 6258
6249 6259 ).
6250 6260 A profile is nothing more than a particular configuration file like your
6251 6261 basic
6252 6262 \family typewriter
6253 6263 ipythonrc
6254 6264 \family default
6255 6265 one, but with particular customizations for a specific purpose.
6256 6266 When you start IPython with '
6257 6267 \family typewriter
6258 6268 ipython -profile <name>
6259 6269 \family default
6260 6270 ', it assumes that in your
6261 6271 \family typewriter
6262 6272 IPYTHONDIR
6263 6273 \family default
6264 6274 there is a file called
6265 6275 \family typewriter
6266 6276 ipythonrc-<name>
6267 6277 \family default
6268 6278 , and loads it instead of the normal
6269 6279 \family typewriter
6270 6280 ipythonrc
6271 6281 \family default
6272 6282 .
6273 6283 \layout Standard
6274 6284
6275 6285 This system allows you to maintain multiple configurations which load modules,
6276 6286 set options, define functions, etc.
6277 6287 suitable for different tasks and activate them in a very simple manner.
6278 6288 In order to avoid having to repeat all of your basic options (common things
6279 6289 that don't change such as your color preferences, for example), any profile
6280 6290 can include another configuration file.
6281 6291 The most common way to use profiles is then to have each one include your
6282 6292 basic
6283 6293 \family typewriter
6284 6294 ipythonrc
6285 6295 \family default
6286 6296 file as a starting point, and then add further customizations.
6287 6297 \layout Standard
6288 6298
6289 6299 In sections
6290 6300 \begin_inset LatexCommand \ref{sec:syntax-extensions}
6291 6301
6292 6302 \end_inset
6293 6303
6294 6304 and
6295 6305 \begin_inset LatexCommand \ref{sec:Gnuplot}
6296 6306
6297 6307 \end_inset
6298 6308
6299 6309 we discuss some particular profiles which come as part of the standard
6300 6310 IPython distribution.
6301 6311 You may also look in your
6302 6312 \family typewriter
6303 6313 IPYTHONDIR
6304 6314 \family default
6305 6315 directory, any file whose name begins with
6306 6316 \family typewriter
6307 6317 ipythonrc-
6308 6318 \family default
6309 6319 is a profile.
6310 6320 You can use those as examples for further customizations to suit your own
6311 6321 needs.
6312 6322 \layout Section
6313 6323
6314 6324
6315 6325 \begin_inset OptArg
6316 6326 collapsed false
6317 6327
6318 6328 \layout Standard
6319 6329
6320 6330 IPython as default...
6321 6331 \end_inset
6322 6332
6323 6333 IPython as your default Python environment
6324 6334 \layout Standard
6325 6335
6326 6336 Python honors the environment variable
6327 6337 \family typewriter
6328 6338 PYTHONSTARTUP
6329 6339 \family default
6330 6340 and will execute at startup the file referenced by this variable.
6331 6341 If you put at the end of this file the following two lines of code:
6332 6342 \layout Standard
6333 6343
6334 6344
6335 6345 \family typewriter
6336 6346 import IPython
6337 6347 \newline
6338 6348 IPython.Shell.IPShell().mainloop(sys_exit=1)
6339 6349 \layout Standard
6340 6350
6341 6351 then IPython will be your working environment anytime you start Python.
6342 6352 The
6343 6353 \family typewriter
6344 6354 sys_exit=1
6345 6355 \family default
6346 6356 is needed to have IPython issue a call to
6347 6357 \family typewriter
6348 6358 sys.exit()
6349 6359 \family default
6350 6360 when it finishes, otherwise you'll be back at the normal Python '
6351 6361 \family typewriter
6352 6362 >>>
6353 6363 \family default
6354 6364 ' prompt
6355 6365 \begin_inset Foot
6356 6366 collapsed true
6357 6367
6358 6368 \layout Standard
6359 6369
6360 6370 Based on an idea by Holger Krekel.
6361 6371 \end_inset
6362 6372
6363 6373 .
6364 6374 \layout Standard
6365 6375
6366 6376 This is probably useful to developers who manage multiple Python versions
6367 6377 and don't want to have correspondingly multiple IPython versions.
6368 6378 Note that in this mode, there is no way to pass IPython any command-line
6369 6379 options, as those are trapped first by Python itself.
6370 6380 \layout Section
6371 6381
6372 6382
6373 6383 \begin_inset LatexCommand \label{sec:embed}
6374 6384
6375 6385 \end_inset
6376 6386
6377 6387 Embedding IPython
6378 6388 \layout Standard
6379 6389
6380 6390 It is possible to start an IPython instance
6381 6391 \emph on
6382 6392 inside
6383 6393 \emph default
6384 6394 your own Python programs.
6385 6395 This allows you to evaluate dynamically the state of your code, operate
6386 6396 with your variables, analyze them, etc.
6387 6397 Note however that any changes you make to values while in the shell do
6388 6398
6389 6399 \emph on
6390 6400 not
6391 6401 \emph default
6392 6402 propagate back to the running code, so it is safe to modify your values
6393 6403 because you won't break your code in bizarre ways by doing so.
6394 6404 \layout Standard
6395 6405
6396 6406 This feature allows you to easily have a fully functional python environment
6397 6407 for doing object introspection anywhere in your code with a simple function
6398 6408 call.
6399 6409 In some cases a simple print statement is enough, but if you need to do
6400 6410 more detailed analysis of a code fragment this feature can be very valuable.
6401 6411 \layout Standard
6402 6412
6403 6413 It can also be useful in scientific computing situations where it is common
6404 6414 to need to do some automatic, computationally intensive part and then stop
6405 6415 to look at data, plots, etc
6406 6416 \begin_inset Foot
6407 6417 collapsed true
6408 6418
6409 6419 \layout Standard
6410 6420
6411 6421 This functionality was inspired by IDL's combination of the
6412 6422 \family typewriter
6413 6423 stop
6414 6424 \family default
6415 6425 keyword and the
6416 6426 \family typewriter
6417 6427 .continue
6418 6428 \family default
6419 6429 executive command, which I have found very useful in the past, and by a
6420 6430 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
6421 6431 06/01 concerning similar uses of pyrepl.
6422 6432 \end_inset
6423 6433
6424 6434 .
6425 6435 Opening an IPython instance will give you full access to your data and
6426 6436 functions, and you can resume program execution once you are done with
6427 6437 the interactive part (perhaps to stop again later, as many times as needed).
6428 6438 \layout Standard
6429 6439
6430 6440 The following code snippet is the bare minimum you need to include in your
6431 6441 Python programs for this to work (detailed examples follow later):
6432 6442 \layout LyX-Code
6433 6443
6434 6444 from IPython.Shell import IPShellEmbed
6435 6445 \layout LyX-Code
6436 6446
6437 6447 ipshell = IPShellEmbed()
6438 6448 \layout LyX-Code
6439 6449
6440 6450 ipshell() # this call anywhere in your program will start IPython
6441 6451 \layout Standard
6442 6452
6443 6453 You can run embedded instances even in code which is itself being run at
6444 6454 the IPython interactive prompt with '
6445 6455 \family typewriter
6446 6456 %run\SpecialChar ~
6447 6457 <filename>
6448 6458 \family default
6449 6459 '.
6450 6460 Since it's easy to get lost as to where you are (in your top-level IPython
6451 6461 or in your embedded one), it's a good idea in such cases to set the in/out
6452 6462 prompts to something different for the embedded instances.
6453 6463 The code examples below illustrate this.
6454 6464 \layout Standard
6455 6465
6456 6466 You can also have multiple IPython instances in your program and open them
6457 6467 separately, for example with different options for data presentation.
6458 6468 If you close and open the same instance multiple times, its prompt counters
6459 6469 simply continue from each execution to the next.
6460 6470 \layout Standard
6461 6471
6462 6472 Please look at the docstrings in the
6463 6473 \family typewriter
6464 6474 Shell.py
6465 6475 \family default
6466 6476 module for more details on the use of this system.
6467 6477 \layout Standard
6468 6478
6469 6479 The following sample file illustrating how to use the embedding functionality
6470 6480 is provided in the examples directory as
6471 6481 \family typewriter
6472 6482 example-embed.py
6473 6483 \family default
6474 6484 .
6475 6485 It should be fairly self-explanatory:
6476 6486 \layout Standard
6477 6487
6478 6488
6479 6489 \begin_inset ERT
6480 6490 status Open
6481 6491
6482 6492 \layout Standard
6483 6493
6484 6494 \backslash
6485 6495 codelist{examples/example-embed.py}
6486 6496 \end_inset
6487 6497
6488 6498
6489 6499 \layout Standard
6490 6500
6491 6501 Once you understand how the system functions, you can use the following
6492 6502 code fragments in your programs which are ready for cut and paste:
6493 6503 \layout Standard
6494 6504
6495 6505
6496 6506 \begin_inset ERT
6497 6507 status Open
6498 6508
6499 6509 \layout Standard
6500 6510
6501 6511 \backslash
6502 6512 codelist{examples/example-embed-short.py}
6503 6513 \end_inset
6504 6514
6505 6515
6506 6516 \layout Section
6507 6517
6508 6518
6509 6519 \begin_inset LatexCommand \label{sec:using-pdb}
6510 6520
6511 6521 \end_inset
6512 6522
6513 6523 Using the Python debugger (
6514 6524 \family typewriter
6515 6525 pdb
6516 6526 \family default
6517 6527 )
6518 6528 \layout Subsection
6519 6529
6520 6530 Running entire programs via
6521 6531 \family typewriter
6522 6532 pdb
6523 6533 \layout Standard
6524 6534
6525 6535
6526 6536 \family typewriter
6527 6537 pdb
6528 6538 \family default
6529 6539 , the Python debugger, is a powerful interactive debugger which allows you
6530 6540 to step through code, set breakpoints, watch variables, etc.
6531 6541 IPython makes it very easy to start any script under the control of
6532 6542 \family typewriter
6533 6543 pdb
6534 6544 \family default
6535 6545 , regardless of whether you have wrapped it into a
6536 6546 \family typewriter
6537 6547 `main()'
6538 6548 \family default
6539 6549 function or not.
6540 6550 For this, simply type
6541 6551 \family typewriter
6542 6552 `%run -d myscript'
6543 6553 \family default
6544 6554 at an IPython prompt.
6545 6555 See the
6546 6556 \family typewriter
6547 6557 %run
6548 6558 \family default
6549 6559 command's documentation (via
6550 6560 \family typewriter
6551 6561 `%run?'
6552 6562 \family default
6553 6563 or in Sec.\SpecialChar ~
6554 6564
6555 6565 \begin_inset LatexCommand \ref{sec:magic}
6556 6566
6557 6567 \end_inset
6558 6568
6559 6569 ) for more details, including how to control where
6560 6570 \family typewriter
6561 6571 pdb
6562 6572 \family default
6563 6573 will stop execution first.
6564 6574 \layout Standard
6565 6575
6566 6576 For more information on the use of the
6567 6577 \family typewriter
6568 6578 pdb
6569 6579 \family default
6570 6580 debugger, read the included
6571 6581 \family typewriter
6572 6582 pdb.doc
6573 6583 \family default
6574 6584 file (part of the standard Python distribution).
6575 6585 On a stock Linux system it is located at
6576 6586 \family typewriter
6577 6587 /usr/lib/python2.3/pdb.doc
6578 6588 \family default
6579 6589 , but the easiest way to read it is by using the
6580 6590 \family typewriter
6581 6591 help()
6582 6592 \family default
6583 6593 function of the
6584 6594 \family typewriter
6585 6595 pdb
6586 6596 \family default
6587 6597 module as follows (in an IPython prompt):
6588 6598 \layout Standard
6589 6599
6590 6600
6591 6601 \family typewriter
6592 6602 In [1]: import pdb
6593 6603 \newline
6594 6604 In [2]: pdb.help()
6595 6605 \layout Standard
6596 6606
6597 6607 This will load the
6598 6608 \family typewriter
6599 6609 pdb.doc
6600 6610 \family default
6601 6611 document in a file viewer for you automatically.
6602 6612 \layout Subsection
6603 6613
6604 6614 Automatic invocation of
6605 6615 \family typewriter
6606 6616 pdb
6607 6617 \family default
6608 6618 on exceptions
6609 6619 \layout Standard
6610 6620
6611 6621 IPython, if started with the
6612 6622 \family typewriter
6613 6623 -pdb
6614 6624 \family default
6615 6625 option (or if the option is set in your rc file) can call the Python
6616 6626 \family typewriter
6617 6627 pdb
6618 6628 \family default
6619 6629 debugger every time your code triggers an uncaught exception
6620 6630 \begin_inset Foot
6621 6631 collapsed true
6622 6632
6623 6633 \layout Standard
6624 6634
6625 6635 Many thanks to Christopher Hart for the request which prompted adding this
6626 6636 feature to IPython.
6627 6637 \end_inset
6628 6638
6629 6639 .
6630 6640 This feature can also be toggled at any time with the
6631 6641 \family typewriter
6632 6642 %pdb
6633 6643 \family default
6634 6644 magic command.
6635 6645 This can be extremely useful in order to find the origin of subtle bugs,
6636 6646 because
6637 6647 \family typewriter
6638 6648 pdb
6639 6649 \family default
6640 6650 opens up at the point in your code which triggered the exception, and while
6641 6651 your program is at this point `dead', all the data is still available and
6642 6652 you can walk up and down the stack frame and understand the origin of the
6643 6653 problem.
6644 6654 \layout Standard
6645 6655
6646 6656 Furthermore, you can use these debugging facilities both with the embedded
6647 6657 IPython mode and without IPython at all.
6648 6658 For an embedded shell (see sec.
6649 6659
6650 6660 \begin_inset LatexCommand \ref{sec:embed}
6651 6661
6652 6662 \end_inset
6653 6663
6654 6664 ), simply call the constructor with
6655 6665 \family typewriter
6656 6666 `-pdb'
6657 6667 \family default
6658 6668 in the argument string and automatically
6659 6669 \family typewriter
6660 6670 pdb
6661 6671 \family default
6662 6672 will be called if an uncaught exception is triggered by your code.
6663 6673
6664 6674 \layout Standard
6665 6675
6666 6676 For stand-alone use of the feature in your programs which do not use IPython
6667 6677 at all, put the following lines toward the top of your `main' routine:
6668 6678 \layout Standard
6669 6679 \align left
6670 6680
6671 6681 \family typewriter
6672 6682 import sys,IPython.ultraTB
6673 6683 \newline
6674 6684 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux',
6675 6685 call_pdb=1)
6676 6686 \layout Standard
6677 6687
6678 6688 The
6679 6689 \family typewriter
6680 6690 mode
6681 6691 \family default
6682 6692 keyword can be either
6683 6693 \family typewriter
6684 6694 `Verbose'
6685 6695 \family default
6686 6696 or
6687 6697 \family typewriter
6688 6698 `Plain'
6689 6699 \family default
6690 6700 , giving either very detailed or normal tracebacks respectively.
6691 6701 The
6692 6702 \family typewriter
6693 6703 color_scheme
6694 6704 \family default
6695 6705 keyword can be one of
6696 6706 \family typewriter
6697 6707 `NoColor'
6698 6708 \family default
6699 6709 ,
6700 6710 \family typewriter
6701 6711 `Linux'
6702 6712 \family default
6703 6713 (default) or
6704 6714 \family typewriter
6705 6715 `LightBG'
6706 6716 \family default
6707 6717 .
6708 6718 These are the same options which can be set in IPython with
6709 6719 \family typewriter
6710 6720 -colors
6711 6721 \family default
6712 6722 and
6713 6723 \family typewriter
6714 6724 -xmode
6715 6725 \family default
6716 6726 .
6717 6727 \layout Standard
6718 6728
6719 6729 This will give any of your programs detailed, colored tracebacks with automatic
6720 6730 invocation of
6721 6731 \family typewriter
6722 6732 pdb
6723 6733 \family default
6724 6734 .
6725 6735 \layout Section
6726 6736
6727 6737
6728 6738 \begin_inset LatexCommand \label{sec:syntax-extensions}
6729 6739
6730 6740 \end_inset
6731 6741
6732 6742 Extensions for syntax processing
6733 6743 \layout Standard
6734 6744
6735 6745 This isn't for the faint of heart, because the potential for breaking things
6736 6746 is quite high.
6737 6747 But it can be a very powerful and useful feature.
6738 6748 In a nutshell, you can redefine the way IPython processes the user input
6739 6749 line to accept new, special extensions to the syntax without needing to
6740 6750 change any of IPython's own code.
6741 6751 \layout Standard
6742 6752
6743 6753 In the
6744 6754 \family typewriter
6745 6755 IPython/Extensions
6746 6756 \family default
6747 6757 directory you will find some examples supplied, which we will briefly describe
6748 6758 now.
6749 6759 These can be used `as is' (and both provide very useful functionality),
6750 6760 or you can use them as a starting point for writing your own extensions.
6751 6761 \layout Subsection
6752 6762
6753 6763 Pasting of code starting with
6754 6764 \family typewriter
6755 6765 `>>>
6756 6766 \family default
6757 6767 ' or
6758 6768 \family typewriter
6759 6769 `...
6760 6770
6761 6771 \family default
6762 6772 '
6763 6773 \layout Standard
6764 6774
6765 6775 In the python tutorial it is common to find code examples which have been
6766 6776 taken from real python sessions.
6767 6777 The problem with those is that all the lines begin with either
6768 6778 \family typewriter
6769 6779 `>>>
6770 6780 \family default
6771 6781 ' or
6772 6782 \family typewriter
6773 6783 `...
6774 6784
6775 6785 \family default
6776 6786 ', which makes it impossible to paste them all at once.
6777 6787 One must instead do a line by line manual copying, carefully removing the
6778 6788 leading extraneous characters.
6779 6789 \layout Standard
6780 6790
6781 6791 This extension identifies those starting characters and removes them from
6782 6792 the input automatically, so that one can paste multi-line examples directly
6783 6793 into IPython, saving a lot of time.
6784 6794 Please look at the file
6785 6795 \family typewriter
6786 6796 InterpreterPasteInput.py
6787 6797 \family default
6788 6798 in the
6789 6799 \family typewriter
6790 6800 IPython/Extensions
6791 6801 \family default
6792 6802 directory for details on how this is done.
6793 6803 \layout Standard
6794 6804
6795 6805 IPython comes with a special profile enabling this feature, called
6796 6806 \family typewriter
6797 6807 tutorial
6798 6808 \family default
6799 6809 \emph on
6800 6810 .
6801 6811
6802 6812 \emph default
6803 6813 Simply start IPython via
6804 6814 \family typewriter
6805 6815 `ipython\SpecialChar ~
6806 6816 -p\SpecialChar ~
6807 6817 tutorial'
6808 6818 \family default
6809 6819 and the feature will be available.
6810 6820 In a normal IPython session you can activate the feature by importing the
6811 6821 corresponding module with:
6812 6822 \newline
6813 6823
6814 6824 \family typewriter
6815 6825 In [1]: import IPython.Extensions.InterpreterPasteInput
6816 6826 \layout Standard
6817 6827
6818 6828 The following is a 'screenshot' of how things work when this extension is
6819 6829 on, copying an example from the standard tutorial:
6820 6830 \layout Standard
6821 6831
6822 6832
6823 6833 \family typewriter
6824 6834 IPython profile: tutorial
6825 6835 \newline
6826 6836 \SpecialChar ~
6827 6837
6828 6838 \newline
6829 6839 *** Pasting of code with ">>>" or "..." has been enabled.
6830 6840 \newline
6831 6841 \SpecialChar ~
6832 6842
6833 6843 \newline
6834 6844 In [1]: >>> def fib2(n): # return Fibonacci series up to n
6835 6845 \newline
6836 6846
6837 6847 \begin_inset ERT
6838 6848 status Collapsed
6839 6849
6840 6850 \layout Standard
6841 6851
6842 6852 \backslash
6843 6853 hspace*{0mm}
6844 6854 \end_inset
6845 6855
6846 6856 \SpecialChar ~
6847 6857 \SpecialChar ~
6848 6858 ...: ...\SpecialChar ~
6849 6859 \SpecialChar ~
6850 6860 \SpecialChar ~
6851 6861 \SpecialChar ~
6852 6862 """Return a list containing the Fibonacci series up to n."""
6853 6863 \newline
6854 6864
6855 6865 \begin_inset ERT
6856 6866 status Collapsed
6857 6867
6858 6868 \layout Standard
6859 6869
6860 6870 \backslash
6861 6871 hspace*{0mm}
6862 6872 \end_inset
6863 6873
6864 6874 \SpecialChar ~
6865 6875 \SpecialChar ~
6866 6876 ...: ...\SpecialChar ~
6867 6877 \SpecialChar ~
6868 6878 \SpecialChar ~
6869 6879 \SpecialChar ~
6870 6880 result = []
6871 6881 \newline
6872 6882
6873 6883 \begin_inset ERT
6874 6884 status Collapsed
6875 6885
6876 6886 \layout Standard
6877 6887
6878 6888 \backslash
6879 6889 hspace*{0mm}
6880 6890 \end_inset
6881 6891
6882 6892 \SpecialChar ~
6883 6893 \SpecialChar ~
6884 6894 ...: ...\SpecialChar ~
6885 6895 \SpecialChar ~
6886 6896 \SpecialChar ~
6887 6897 \SpecialChar ~
6888 6898 a, b = 0, 1
6889 6899 \newline
6890 6900
6891 6901 \begin_inset ERT
6892 6902 status Collapsed
6893 6903
6894 6904 \layout Standard
6895 6905
6896 6906 \backslash
6897 6907 hspace*{0mm}
6898 6908 \end_inset
6899 6909
6900 6910 \SpecialChar ~
6901 6911 \SpecialChar ~
6902 6912 ...: ...\SpecialChar ~
6903 6913 \SpecialChar ~
6904 6914 \SpecialChar ~
6905 6915 \SpecialChar ~
6906 6916 while b < n:
6907 6917 \newline
6908 6918
6909 6919 \begin_inset ERT
6910 6920 status Collapsed
6911 6921
6912 6922 \layout Standard
6913 6923
6914 6924 \backslash
6915 6925 hspace*{0mm}
6916 6926 \end_inset
6917 6927
6918 6928 \SpecialChar ~
6919 6929 \SpecialChar ~
6920 6930 ...: ...\SpecialChar ~
6921 6931 \SpecialChar ~
6922 6932 \SpecialChar ~
6923 6933 \SpecialChar ~
6924 6934 \SpecialChar ~
6925 6935 \SpecialChar ~
6926 6936 \SpecialChar ~
6927 6937 \SpecialChar ~
6928 6938 result.append(b)\SpecialChar ~
6929 6939 \SpecialChar ~
6930 6940 \SpecialChar ~
6931 6941 # see below
6932 6942 \newline
6933 6943
6934 6944 \begin_inset ERT
6935 6945 status Collapsed
6936 6946
6937 6947 \layout Standard
6938 6948
6939 6949 \backslash
6940 6950 hspace*{0mm}
6941 6951 \end_inset
6942 6952
6943 6953 \SpecialChar ~
6944 6954 \SpecialChar ~
6945 6955 ...: ...\SpecialChar ~
6946 6956 \SpecialChar ~
6947 6957 \SpecialChar ~
6948 6958 \SpecialChar ~
6949 6959 \SpecialChar ~
6950 6960 \SpecialChar ~
6951 6961 \SpecialChar ~
6952 6962 \SpecialChar ~
6953 6963 a, b = b, a+b
6954 6964 \newline
6955 6965
6956 6966 \begin_inset ERT
6957 6967 status Collapsed
6958 6968
6959 6969 \layout Standard
6960 6970
6961 6971 \backslash
6962 6972 hspace*{0mm}
6963 6973 \end_inset
6964 6974
6965 6975 \SpecialChar ~
6966 6976 \SpecialChar ~
6967 6977 ...: ...\SpecialChar ~
6968 6978 \SpecialChar ~
6969 6979 \SpecialChar ~
6970 6980 \SpecialChar ~
6971 6981 return result
6972 6982 \newline
6973 6983
6974 6984 \begin_inset ERT
6975 6985 status Collapsed
6976 6986
6977 6987 \layout Standard
6978 6988
6979 6989 \backslash
6980 6990 hspace*{0mm}
6981 6991 \end_inset
6982 6992
6983 6993 \SpecialChar ~
6984 6994 \SpecialChar ~
6985 6995 ...:
6986 6996 \newline
6987 6997 \SpecialChar ~
6988 6998
6989 6999 \newline
6990 7000 In [2]: fib2(10)
6991 7001 \newline
6992 7002 Out[2]: [1, 1, 2, 3, 5, 8]
6993 7003 \layout Standard
6994 7004
6995 7005 Note that as currently written, this extension does
6996 7006 \emph on
6997 7007 not
6998 7008 \emph default
6999 7009 recognize IPython's prompts for pasting.
7000 7010 Those are more complicated, since the user can change them very easily,
7001 7011 they involve numbers and can vary in length.
7002 7012 One could however extract all the relevant information from the IPython
7003 7013 instance and build an appropriate regular expression.
7004 7014 This is left as an exercise for the reader.
7005 7015 \layout Subsection
7006 7016
7007 7017 Input of physical quantities with units
7008 7018 \layout Standard
7009 7019
7010 7020 The module
7011 7021 \family typewriter
7012 7022 PhysicalQInput
7013 7023 \family default
7014 7024 allows a simplified form of input for physical quantities with units.
7015 7025 This file is meant to be used in conjunction with the
7016 7026 \family typewriter
7017 7027 PhysicalQInteractive
7018 7028 \family default
7019 7029 module (in the same directory) and
7020 7030 \family typewriter
7021 7031 Physics.PhysicalQuantities
7022 7032 \family default
7023 7033 from Konrad Hinsen's ScientificPython (
7024 7034 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html}
7025 7035
7026 7036 \end_inset
7027 7037
7028 7038 ).
7029 7039 \layout Standard
7030 7040
7031 7041 The
7032 7042 \family typewriter
7033 7043 Physics.PhysicalQuantities
7034 7044 \family default
7035 7045 module defines
7036 7046 \family typewriter
7037 7047 PhysicalQuantity
7038 7048 \family default
7039 7049 objects, but these must be declared as instances of a class.
7040 7050 For example, to define
7041 7051 \family typewriter
7042 7052 v
7043 7053 \family default
7044 7054 as a velocity of 3\SpecialChar ~
7045 7055 m/s, normally you would write:
7046 7056 \family typewriter
7047 7057
7048 7058 \newline
7049 7059 In [1]: v = PhysicalQuantity(3,'m/s')
7050 7060 \layout Standard
7051 7061
7052 7062 Using the
7053 7063 \family typewriter
7054 7064 PhysicalQ_Input
7055 7065 \family default
7056 7066 extension this can be input instead as:
7057 7067 \family typewriter
7058 7068
7059 7069 \newline
7060 7070 In [1]: v = 3 m/s
7061 7071 \family default
7062 7072
7063 7073 \newline
7064 7074 which is much more convenient for interactive use (even though it is blatantly
7065 7075 invalid Python syntax).
7066 7076 \layout Standard
7067 7077
7068 7078 The
7069 7079 \family typewriter
7070 7080 physics
7071 7081 \family default
7072 7082 profile supplied with IPython (enabled via
7073 7083 \family typewriter
7074 7084 'ipython -p physics'
7075 7085 \family default
7076 7086 ) uses these extensions, which you can also activate with:
7077 7087 \layout Standard
7078 7088
7079 7089
7080 7090 \family typewriter
7081 7091 from math import * # math MUST be imported BEFORE PhysicalQInteractive
7082 7092 \newline
7083 7093 from IPython.Extensions.PhysicalQInteractive import *
7084 7094 \newline
7085 7095 import IPython.Extensions.PhysicalQInput
7086 7096 \layout Section
7087 7097
7088 7098
7089 7099 \begin_inset LatexCommand \label{sec:IPython-as-shell}
7090 7100
7091 7101 \end_inset
7092 7102
7093 7103 IPython as a system shell
7094 7104 \layout Standard
7095 7105
7096 7106 IPython ships with a special profile called
7097 7107 \family typewriter
7098 7108 pysh
7099 7109 \family default
7100 7110 , which you can activate at the command line as
7101 7111 \family typewriter
7102 7112 `ipython -p pysh'
7103 7113 \family default
7104 7114 .
7105 7115 This loads
7106 7116 \family typewriter
7107 7117 InterpreterExec
7108 7118 \family default
7109 7119 , along with some additional facilities and a prompt customized for filesystem
7110 7120 navigation.
7111 7121 \layout Standard
7112 7122
7113 7123 Note that this does
7114 7124 \emph on
7115 7125 not
7116 7126 \emph default
7117 7127 make IPython a full-fledged system shell.
7118 7128 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
7119 7129 you'll suspend pysh itself, not the process you just started.
7120 7130
7121 7131 \layout Standard
7122 7132
7123 7133 What the shell profile allows you to do is to use the convenient and powerful
7124 7134 syntax of Python to do quick scripting at the command line.
7125 7135 Below we describe some of its features.
7126 7136 \layout Subsection
7127 7137
7128 7138 Aliases
7129 7139 \layout Standard
7130 7140
7131 7141 All of your
7132 7142 \family typewriter
7133 7143 $PATH
7134 7144 \family default
7135 7145 has been loaded as IPython aliases, so you should be able to type any normal
7136 7146 system command and have it executed.
7137 7147 See
7138 7148 \family typewriter
7139 7149 %alias?
7140 7150 \family default
7141 7151 and
7142 7152 \family typewriter
7143 7153 %unalias?
7144 7154 \family default
7145 7155 for details on the alias facilities.
7146 7156 See also
7147 7157 \family typewriter
7148 7158 %rehash?
7149 7159 \family default
7150 7160 and
7151 7161 \family typewriter
7152 7162 %rehashx?
7153 7163 \family default
7154 7164 for details on the mechanism used to load
7155 7165 \family typewriter
7156 7166 $PATH
7157 7167 \family default
7158 7168 .
7159 7169 \layout Subsection
7160 7170
7161 7171 Special syntax
7162 7172 \layout Standard
7163 7173
7164 7174 Any lines which begin with
7165 7175 \family typewriter
7166 7176 `~'
7167 7177 \family default
7168 7178 ,
7169 7179 \family typewriter
7170 7180 `/'
7171 7181 \family default
7172 7182 and
7173 7183 \family typewriter
7174 7184 `.'
7175 7185 \family default
7176 7186 will be executed as shell commands instead of as Python code.
7177 7187 The special escapes below are also recognized.
7178 7188
7179 7189 \family typewriter
7180 7190 !cmd
7181 7191 \family default
7182 7192 is valid in single or multi-line input, all others are only valid in single-lin
7183 7193 e input:
7184 7194 \layout Description
7185 7195
7186 7196
7187 7197 \family typewriter
7188 7198 !cmd
7189 7199 \family default
7190 7200 pass `cmd' directly to the shell
7191 7201 \layout Description
7192 7202
7193 7203
7194 7204 \family typewriter
7195 7205 !!cmd
7196 7206 \family default
7197 7207 execute `cmd' and return output as a list (split on `
7198 7208 \backslash
7199 7209 n')
7200 7210 \layout Description
7201 7211
7202 7212
7203 7213 \family typewriter
7204 7214 $var=cmd
7205 7215 \family default
7206 7216 capture output of cmd into var, as a string
7207 7217 \layout Description
7208 7218
7209 7219
7210 7220 \family typewriter
7211 7221 $$var=cmd
7212 7222 \family default
7213 7223 capture output of cmd into var, as a list (split on `
7214 7224 \backslash
7215 7225 n')
7216 7226 \layout Standard
7217 7227
7218 7228 The
7219 7229 \family typewriter
7220 7230 $
7221 7231 \family default
7222 7232 /
7223 7233 \family typewriter
7224 7234 $$
7225 7235 \family default
7226 7236 syntaxes make Python variables from system output, which you can later
7227 7237 use for further scripting.
7228 7238 The converse is also possible: when executing an alias or calling to the
7229 7239 system via
7230 7240 \family typewriter
7231 7241 !
7232 7242 \family default
7233 7243 /
7234 7244 \family typewriter
7235 7245 !!
7236 7246 \family default
7237 7247 , you can expand any python variable or expression by prepending it with
7238 7248
7239 7249 \family typewriter
7240 7250 $
7241 7251 \family default
7242 7252 .
7243 7253 Full details of the allowed syntax can be found in Python's PEP 215.
7244 7254 \layout Standard
7245 7255
7246 7256 A few brief examples will illustrate these (note that the indentation below
7247 7257 may be incorrectly displayed):
7248 7258 \layout Standard
7249 7259
7250 7260
7251 7261 \family typewriter
7252 7262 fperez[~/test]|3> !ls *s.py
7253 7263 \newline
7254 7264 scopes.py strings.py
7255 7265 \layout Standard
7256 7266
7257 7267 ls is an internal alias, so there's no need to use
7258 7268 \family typewriter
7259 7269 !
7260 7270 \family default
7261 7271 :
7262 7272 \layout Standard
7263 7273
7264 7274
7265 7275 \family typewriter
7266 7276 fperez[~/test]|4> ls *s.py
7267 7277 \newline
7268 7278 scopes.py* strings.py
7269 7279 \layout Standard
7270 7280
7271 7281 !!ls will return the output into a Python variable:
7272 7282 \layout Standard
7273 7283
7274 7284
7275 7285 \family typewriter
7276 7286 fperez[~/test]|5> !!ls *s.py
7277 7287 \newline
7278 7288
7279 7289 \begin_inset ERT
7280 7290 status Collapsed
7281 7291
7282 7292 \layout Standard
7283 7293
7284 7294 \backslash
7285 7295 hspace*{0mm}
7286 7296 \end_inset
7287 7297
7288 7298 \SpecialChar ~
7289 7299 \SpecialChar ~
7290 7300 \SpecialChar ~
7291 7301 \SpecialChar ~
7292 7302 \SpecialChar ~
7293 7303 \SpecialChar ~
7294 7304 \SpecialChar ~
7295 7305 \SpecialChar ~
7296 7306 \SpecialChar ~
7297 7307 \SpecialChar ~
7298 7308 \SpecialChar ~
7299 7309 \SpecialChar ~
7300 7310 \SpecialChar ~
7301 7311 \SpecialChar ~
7302 7312 <5> ['scopes.py', 'strings.py']
7303 7313 \newline
7304 7314 fperez[~/test]|6> print _5
7305 7315 \newline
7306 7316 ['scopes.py', 'strings.py']
7307 7317 \layout Standard
7308 7318
7309 7319
7310 7320 \family typewriter
7311 7321 $
7312 7322 \family default
7313 7323 and
7314 7324 \family typewriter
7315 7325 $$
7316 7326 \family default
7317 7327 allow direct capture to named variables:
7318 7328 \layout Standard
7319 7329
7320 7330
7321 7331 \family typewriter
7322 7332 fperez[~/test]|7> $astr = ls *s.py
7323 7333 \newline
7324 7334 fperez[~/test]|8> astr
7325 7335 \newline
7326 7336
7327 7337 \begin_inset ERT
7328 7338 status Collapsed
7329 7339
7330 7340 \layout Standard
7331 7341
7332 7342 \backslash
7333 7343 hspace*{0mm}
7334 7344 \end_inset
7335 7345
7336 7346 \SpecialChar ~
7337 7347 \SpecialChar ~
7338 7348 \SpecialChar ~
7339 7349 \SpecialChar ~
7340 7350 \SpecialChar ~
7341 7351 \SpecialChar ~
7342 7352 \SpecialChar ~
7343 7353 \SpecialChar ~
7344 7354 \SpecialChar ~
7345 7355 \SpecialChar ~
7346 7356 \SpecialChar ~
7347 7357 \SpecialChar ~
7348 7358 \SpecialChar ~
7349 7359 \SpecialChar ~
7350 7360 <8> 'scopes.py
7351 7361 \backslash
7352 7362 nstrings.py'
7353 7363 \layout Standard
7354 7364
7355 7365
7356 7366 \family typewriter
7357 7367 fperez[~/test]|9> $$alist = ls *s.py
7358 7368 \newline
7359 7369 fperez[~/test]|10> alist
7360 7370 \newline
7361 7371
7362 7372 \begin_inset ERT
7363 7373 status Collapsed
7364 7374
7365 7375 \layout Standard
7366 7376
7367 7377 \backslash
7368 7378 hspace*{0mm}
7369 7379 \end_inset
7370 7380
7371 7381 \SpecialChar ~
7372 7382 \SpecialChar ~
7373 7383 \SpecialChar ~
7374 7384 \SpecialChar ~
7375 7385 \SpecialChar ~
7376 7386 \SpecialChar ~
7377 7387 \SpecialChar ~
7378 7388 \SpecialChar ~
7379 7389 \SpecialChar ~
7380 7390 \SpecialChar ~
7381 7391 \SpecialChar ~
7382 7392 \SpecialChar ~
7383 7393 \SpecialChar ~
7384 7394 \SpecialChar ~
7385 7395 <10> ['scopes.py', 'strings.py']
7386 7396 \layout Standard
7387 7397
7388 7398 alist is now a normal python list you can loop over.
7389 7399 Using
7390 7400 \family typewriter
7391 7401 $
7392 7402 \family default
7393 7403 will expand back the python values when alias calls are made:
7394 7404 \layout Standard
7395 7405
7396 7406
7397 7407 \family typewriter
7398 7408 fperez[~/test]|11> for f in alist:
7399 7409 \newline
7400 7410
7401 7411 \begin_inset ERT
7402 7412 status Collapsed
7403 7413
7404 7414 \layout Standard
7405 7415
7406 7416 \backslash
7407 7417 hspace*{0mm}
7408 7418 \end_inset
7409 7419
7410 7420 \SpecialChar ~
7411 7421 \SpecialChar ~
7412 7422 \SpecialChar ~
7413 7423 \SpecialChar ~
7414 7424 \SpecialChar ~
7415 7425 \SpecialChar ~
7416 7426 \SpecialChar ~
7417 7427 \SpecialChar ~
7418 7428 \SpecialChar ~
7419 7429 \SpecialChar ~
7420 7430 \SpecialChar ~
7421 7431 \SpecialChar ~
7422 7432 \SpecialChar ~
7423 7433 \SpecialChar ~
7424 7434 |..> \SpecialChar ~
7425 7435 \SpecialChar ~
7426 7436 \SpecialChar ~
7427 7437 \SpecialChar ~
7428 7438 print 'file',f,
7429 7439 \newline
7430 7440
7431 7441 \begin_inset ERT
7432 7442 status Collapsed
7433 7443
7434 7444 \layout Standard
7435 7445
7436 7446 \backslash
7437 7447 hspace*{0mm}
7438 7448 \end_inset
7439 7449
7440 7450 \SpecialChar ~
7441 7451 \SpecialChar ~
7442 7452 \SpecialChar ~
7443 7453 \SpecialChar ~
7444 7454 \SpecialChar ~
7445 7455 \SpecialChar ~
7446 7456 \SpecialChar ~
7447 7457 \SpecialChar ~
7448 7458 \SpecialChar ~
7449 7459 \SpecialChar ~
7450 7460 \SpecialChar ~
7451 7461 \SpecialChar ~
7452 7462 \SpecialChar ~
7453 7463 \SpecialChar ~
7454 7464 |..> \SpecialChar ~
7455 7465 \SpecialChar ~
7456 7466 \SpecialChar ~
7457 7467 \SpecialChar ~
7458 7468 wc -l $f
7459 7469 \newline
7460 7470
7461 7471 \begin_inset ERT
7462 7472 status Collapsed
7463 7473
7464 7474 \layout Standard
7465 7475
7466 7476 \backslash
7467 7477 hspace*{0mm}
7468 7478 \end_inset
7469 7479
7470 7480 \SpecialChar ~
7471 7481 \SpecialChar ~
7472 7482 \SpecialChar ~
7473 7483 \SpecialChar ~
7474 7484 \SpecialChar ~
7475 7485 \SpecialChar ~
7476 7486 \SpecialChar ~
7477 7487 \SpecialChar ~
7478 7488 \SpecialChar ~
7479 7489 \SpecialChar ~
7480 7490 \SpecialChar ~
7481 7491 \SpecialChar ~
7482 7492 \SpecialChar ~
7483 7493 \SpecialChar ~
7484 7494 |..>
7485 7495 \newline
7486 7496 file scopes.py 13 scopes.py
7487 7497 \newline
7488 7498 file strings.py 4 strings.py
7489 7499 \layout Standard
7490 7500
7491 7501 Note that you may need to protect your variables with braces if you want
7492 7502 to append strings to their names.
7493 7503 To copy all files in alist to
7494 7504 \family typewriter
7495 7505 .bak
7496 7506 \family default
7497 7507 extensions, you must use:
7498 7508 \layout Standard
7499 7509
7500 7510
7501 7511 \family typewriter
7502 7512 fperez[~/test]|12> for f in alist:
7503 7513 \newline
7504 7514
7505 7515 \begin_inset ERT
7506 7516 status Collapsed
7507 7517
7508 7518 \layout Standard
7509 7519
7510 7520 \backslash
7511 7521 hspace*{0mm}
7512 7522 \end_inset
7513 7523
7514 7524 \SpecialChar ~
7515 7525 \SpecialChar ~
7516 7526 \SpecialChar ~
7517 7527 \SpecialChar ~
7518 7528 \SpecialChar ~
7519 7529 \SpecialChar ~
7520 7530 \SpecialChar ~
7521 7531 \SpecialChar ~
7522 7532 \SpecialChar ~
7523 7533 \SpecialChar ~
7524 7534 \SpecialChar ~
7525 7535 \SpecialChar ~
7526 7536 \SpecialChar ~
7527 7537 \SpecialChar ~
7528 7538 |..> \SpecialChar ~
7529 7539 \SpecialChar ~
7530 7540 \SpecialChar ~
7531 7541 \SpecialChar ~
7532 7542 cp $f ${f}.bak
7533 7543 \layout Standard
7534 7544
7535 7545 If you try using
7536 7546 \family typewriter
7537 7547 $f.bak
7538 7548 \family default
7539 7549 , you'll get an AttributeError exception saying that your string object
7540 7550 doesn't have a
7541 7551 \family typewriter
7542 7552 .bak
7543 7553 \family default
7544 7554 attribute.
7545 7555 This is because the
7546 7556 \family typewriter
7547 7557 $
7548 7558 \family default
7549 7559 expansion mechanism allows you to expand full Python expressions:
7550 7560 \layout Standard
7551 7561
7552 7562
7553 7563 \family typewriter
7554 7564 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
7555 7565 \newline
7556 7566 sys.platform is: linux2
7557 7567 \layout Standard
7558 7568
7559 7569 IPython's input history handling is still active, which allows you to rerun
7560 7570 a single block of multi-line input by simply using exec:
7561 7571 \newline
7562 7572
7563 7573 \family typewriter
7564 7574 fperez[~/test]|14> $$alist = ls *.eps
7565 7575 \newline
7566 7576 fperez[~/test]|15> exec _i11
7567 7577 \newline
7568 7578 file image2.eps 921 image2.eps
7569 7579 \newline
7570 7580 file image.eps 921 image.eps
7571 7581 \layout Standard
7572 7582
7573 7583 While these are new special-case syntaxes, they are designed to allow very
7574 7584 efficient use of the shell with minimal typing.
7575 7585 At an interactive shell prompt, conciseness of expression wins over readability.
7576 7586 \layout Subsection
7577 7587
7578 7588 Useful functions and modules
7579 7589 \layout Standard
7580 7590
7581 7591 The os, sys and shutil modules from the Python standard library are automaticall
7582 7592 y loaded.
7583 7593 Some additional functions, useful for shell usage, are listed below.
7584 7594 You can request more help about them with `
7585 7595 \family typewriter
7586 7596 ?
7587 7597 \family default
7588 7598 '.
7589 7599 \layout Description
7590 7600
7591 7601
7592 7602 \family typewriter
7593 7603 shell
7594 7604 \family default
7595 7605 - execute a command in the underlying system shell
7596 7606 \layout Description
7597 7607
7598 7608
7599 7609 \family typewriter
7600 7610 system
7601 7611 \family default
7602 7612 - like
7603 7613 \family typewriter
7604 7614 shell()
7605 7615 \family default
7606 7616 , but return the exit status of the command
7607 7617 \layout Description
7608 7618
7609 7619
7610 7620 \family typewriter
7611 7621 sout
7612 7622 \family default
7613 7623 - capture the output of a command as a string
7614 7624 \layout Description
7615 7625
7616 7626
7617 7627 \family typewriter
7618 7628 lout
7619 7629 \family default
7620 7630 - capture the output of a command as a list (split on `
7621 7631 \backslash
7622 7632 n')
7623 7633 \layout Description
7624 7634
7625 7635
7626 7636 \family typewriter
7627 7637 getoutputerror
7628 7638 \family default
7629 7639 - capture (output,error) of a shell commandss
7630 7640 \layout Standard
7631 7641
7632 7642
7633 7643 \family typewriter
7634 7644 sout
7635 7645 \family default
7636 7646 /
7637 7647 \family typewriter
7638 7648 lout
7639 7649 \family default
7640 7650 are the functional equivalents of
7641 7651 \family typewriter
7642 7652 $
7643 7653 \family default
7644 7654 /
7645 7655 \family typewriter
7646 7656 $$
7647 7657 \family default
7648 7658 .
7649 7659 They are provided to allow you to capture system output in the middle of
7650 7660 true python code, function definitions, etc (where
7651 7661 \family typewriter
7652 7662 $
7653 7663 \family default
7654 7664 and
7655 7665 \family typewriter
7656 7666 $$
7657 7667 \family default
7658 7668 are invalid).
7659 7669 \layout Subsection
7660 7670
7661 7671 Directory management
7662 7672 \layout Standard
7663 7673
7664 7674 Since each command passed by pysh to the underlying system is executed in
7665 7675 a subshell which exits immediately, you can NOT use !cd to navigate the
7666 7676 filesystem.
7667 7677 \layout Standard
7668 7678
7669 7679 Pysh provides its own builtin
7670 7680 \family typewriter
7671 7681 `%cd
7672 7682 \family default
7673 7683 ' magic command to move in the filesystem (the
7674 7684 \family typewriter
7675 7685 %
7676 7686 \family default
7677 7687 is not required with automagic on).
7678 7688 It also maintains a list of visited directories (use
7679 7689 \family typewriter
7680 7690 %dhist
7681 7691 \family default
7682 7692 to see it) and allows direct switching to any of them.
7683 7693 Type
7684 7694 \family typewriter
7685 7695 `cd?
7686 7696 \family default
7687 7697 ' for more details.
7688 7698 \layout Standard
7689 7699
7690 7700
7691 7701 \family typewriter
7692 7702 %pushd
7693 7703 \family default
7694 7704 ,
7695 7705 \family typewriter
7696 7706 %popd
7697 7707 \family default
7698 7708 and
7699 7709 \family typewriter
7700 7710 %dirs
7701 7711 \family default
7702 7712 are provided for directory stack handling.
7703 7713 \layout Subsection
7704 7714
7705 7715 Prompt customization
7706 7716 \layout Standard
7707 7717
7708 7718 The supplied
7709 7719 \family typewriter
7710 7720 ipythonrc-pysh
7711 7721 \family default
7712 7722 profile comes with an example of a very colored and detailed prompt, mainly
7713 7723 to serve as an illustration.
7714 7724 The valid escape sequences, besides color names, are:
7715 7725 \layout Description
7716 7726
7717 7727
7718 7728 \backslash
7719 7729 # - Prompt number.
7720 7730 \layout Description
7721 7731
7722 7732
7723 7733 \backslash
7724 7734 D - Dots, as many as there are digits in
7725 7735 \backslash
7726 7736 # (so they align).
7727 7737 \layout Description
7728 7738
7729 7739
7730 7740 \backslash
7731 7741 w - Current working directory (cwd).
7732 7742 \layout Description
7733 7743
7734 7744
7735 7745 \backslash
7736 7746 W - Basename of current working directory.
7737 7747 \layout Description
7738 7748
7739 7749
7740 7750 \backslash
7741 7751 X
7742 7752 \emph on
7743 7753 N
7744 7754 \emph default
7745 7755 - Where
7746 7756 \emph on
7747 7757 N
7748 7758 \emph default
7749 7759 =0..5.
7750 7760 N terms of the cwd, with $HOME written as ~.
7751 7761 \layout Description
7752 7762
7753 7763
7754 7764 \backslash
7755 7765 Y
7756 7766 \emph on
7757 7767 N
7758 7768 \emph default
7759 7769 - Where
7760 7770 \emph on
7761 7771 N
7762 7772 \emph default
7763 7773 =0..5.
7764 7774 Like X
7765 7775 \emph on
7766 7776 N
7767 7777 \emph default
7768 7778 , but if ~ is term
7769 7779 \emph on
7770 7780 N
7771 7781 \emph default
7772 7782 +1 it's also shown.
7773 7783 \layout Description
7774 7784
7775 7785
7776 7786 \backslash
7777 7787 u - Username.
7778 7788 \layout Description
7779 7789
7780 7790
7781 7791 \backslash
7782 7792 H - Full hostname.
7783 7793 \layout Description
7784 7794
7785 7795
7786 7796 \backslash
7787 7797 h - Hostname up to first '.'
7788 7798 \layout Description
7789 7799
7790 7800
7791 7801 \backslash
7792 7802 $ - Root symbol ($ or #).
7793 7803
7794 7804 \layout Description
7795 7805
7796 7806
7797 7807 \backslash
7798 7808 t - Current time, in H:M:S format.
7799 7809 \layout Description
7800 7810
7801 7811
7802 7812 \backslash
7803 7813 v - IPython release version.
7804 7814
7805 7815 \layout Description
7806 7816
7807 7817
7808 7818 \backslash
7809 7819 n - Newline.
7810 7820
7811 7821 \layout Description
7812 7822
7813 7823
7814 7824 \backslash
7815 7825 r - Carriage return.
7816 7826
7817 7827 \layout Description
7818 7828
7819 7829
7820 7830 \backslash
7821 7831
7822 7832 \backslash
7823 7833 - An explicitly escaped '
7824 7834 \backslash
7825 7835 '.
7826 7836 \layout Standard
7827 7837
7828 7838 You can configure your prompt colors using any ANSI color escape.
7829 7839 Each color escape sets the color for any subsequent text, until another
7830 7840 escape comes in and changes things.
7831 7841 The valid color escapes are:
7832 7842 \layout Description
7833 7843
7834 7844
7835 7845 \backslash
7836 7846 C_Black
7837 7847 \layout Description
7838 7848
7839 7849
7840 7850 \backslash
7841 7851 C_Blue
7842 7852 \layout Description
7843 7853
7844 7854
7845 7855 \backslash
7846 7856 C_Brown
7847 7857 \layout Description
7848 7858
7849 7859
7850 7860 \backslash
7851 7861 C_Cyan
7852 7862 \layout Description
7853 7863
7854 7864
7855 7865 \backslash
7856 7866 C_DarkGray
7857 7867 \layout Description
7858 7868
7859 7869
7860 7870 \backslash
7861 7871 C_Green
7862 7872 \layout Description
7863 7873
7864 7874
7865 7875 \backslash
7866 7876 C_LightBlue
7867 7877 \layout Description
7868 7878
7869 7879
7870 7880 \backslash
7871 7881 C_LightCyan
7872 7882 \layout Description
7873 7883
7874 7884
7875 7885 \backslash
7876 7886 C_LightGray
7877 7887 \layout Description
7878 7888
7879 7889
7880 7890 \backslash
7881 7891 C_LightGreen
7882 7892 \layout Description
7883 7893
7884 7894
7885 7895 \backslash
7886 7896 C_LightPurple
7887 7897 \layout Description
7888 7898
7889 7899
7890 7900 \backslash
7891 7901 C_LightRed
7892 7902 \layout Description
7893 7903
7894 7904
7895 7905 \backslash
7896 7906 C_Purple
7897 7907 \layout Description
7898 7908
7899 7909
7900 7910 \backslash
7901 7911 C_Red
7902 7912 \layout Description
7903 7913
7904 7914
7905 7915 \backslash
7906 7916 C_White
7907 7917 \layout Description
7908 7918
7909 7919
7910 7920 \backslash
7911 7921 C_Yellow
7912 7922 \layout Description
7913 7923
7914 7924
7915 7925 \backslash
7916 7926 C_Normal Stop coloring, defaults to your terminal settings.
7917 7927 \layout Section
7918 7928
7919 7929
7920 7930 \begin_inset LatexCommand \label{sec:Threading-support}
7921 7931
7922 7932 \end_inset
7923 7933
7924 7934 Threading support
7925 7935 \layout Standard
7926 7936
7927 7937
7928 7938 \series bold
7929 7939 WARNING:
7930 7940 \series default
7931 7941 The threading support is still somewhat experimental, and it has only seen
7932 7942 reasonable testing under Linux.
7933 7943 Threaded code is particularly tricky to debug, and it tends to show extremely
7934 7944 platform-dependent behavior.
7935 7945 Since I only have access to Linux machines, I will have to rely on user's
7936 7946 experiences and assistance for this area of IPython to improve under other
7937 7947 platforms.
7938 7948 \layout Standard
7939 7949
7940 7950 IPython, via the
7941 7951 \family typewriter
7942 7952 -gthread
7943 7953 \family default
7944 7954 ,
7945 7955 \family typewriter
7946 7956 -qthread
7947 7957 \family default
7948 7958 and
7949 7959 \family typewriter
7950 7960 -wthread
7951 7961 \family default
7952 7962 options (described in Sec.\SpecialChar ~
7953 7963
7954 7964 \begin_inset LatexCommand \ref{sec:threading-opts}
7955 7965
7956 7966 \end_inset
7957 7967
7958 7968 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
7959 7969 respectively.
7960 7970 These GUI toolkits need to control the python main loop of execution, so
7961 7971 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
7962 7972 will immediately freeze the shell.
7963 7973
7964 7974 \layout Standard
7965 7975
7966 7976 IPython, with one of these options (you can only use one at a time), separates
7967 7977 the graphical loop and IPython's code execution run into different threads.
7968 7978 This allows you to test interactively (with
7969 7979 \family typewriter
7970 7980 %run
7971 7981 \family default
7972 7982 , for example) your GUI code without blocking.
7973 7983 \layout Standard
7974 7984
7975 7985 A nice mini-tutorial on using IPython along with the Qt Designer application
7976 7986 is available at the SciPy wiki:
7977 7987 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner}
7978 7988
7979 7989 \end_inset
7980 7990
7981 7991 .
7982 7992 \layout Subsection
7983 7993
7984 7994 Tk issues
7985 7995 \layout Standard
7986 7996
7987 7997 As indicated in Sec.\SpecialChar ~
7988 7998
7989 7999 \begin_inset LatexCommand \ref{sec:threading-opts}
7990 8000
7991 8001 \end_inset
7992 8002
7993 8003 , a special
7994 8004 \family typewriter
7995 8005 -tk
7996 8006 \family default
7997 8007 option is provided to try and allow Tk graphical applications to coexist
7998 8008 interactively with WX, Qt or GTK ones.
7999 8009 Whether this works at all, however, is very platform and configuration
8000 8010 dependent.
8001 8011 Please experiment with simple test cases before committing to using this
8002 8012 combination of Tk and GTK/Qt/WX threading in a production environment.
8003 8013 \layout Subsection
8004 8014
8005 8015 Signals and Threads
8006 8016 \layout Standard
8007 8017
8008 8018 When any of the thread systems (GTK, Qt or WX) are active, either directly
8009 8019 or via
8010 8020 \family typewriter
8011 8021 -pylab
8012 8022 \family default
8013 8023 with a threaded backend, it is impossible to interrupt long-running Python
8014 8024 code via
8015 8025 \family typewriter
8016 8026 Ctrl-C
8017 8027 \family default
8018 8028 .
8019 8029 IPython can not pass the KeyboardInterrupt exception (or the underlying
8020 8030
8021 8031 \family typewriter
8022 8032 SIGINT
8023 8033 \family default
8024 8034 ) across threads, so any long-running process started from IPython will
8025 8035 run to completion, or will have to be killed via an external (OS-based)
8026 8036 mechanism.
8027 8037 \layout Standard
8028 8038
8029 8039 To the best of my knowledge, this limitation is imposed by the Python interprete
8030 8040 r itself, and it comes from the difficulty of writing portable signal/threaded
8031 8041 code.
8032 8042 If any user is an expert on this topic and can suggest a better solution,
8033 8043 I would love to hear about it.
8034 8044 In the IPython sources, look at the
8035 8045 \family typewriter
8036 8046 Shell.py
8037 8047 \family default
8038 8048 module, and in particular at the
8039 8049 \family typewriter
8040 8050 runcode()
8041 8051 \family default
8042 8052 method.
8043 8053
8044 8054 \layout Subsection
8045 8055
8046 8056 I/O pitfalls
8047 8057 \layout Standard
8048 8058
8049 8059 Be mindful that the Python interpreter switches between threads every
8050 8060 \begin_inset Formula $N$
8051 8061 \end_inset
8052 8062
8053 8063 bytecodes, where the default value as of Python\SpecialChar ~
8054 8064 2.3 is
8055 8065 \begin_inset Formula $N=100.$
8056 8066 \end_inset
8057 8067
8058 8068 This value can be read by using the
8059 8069 \family typewriter
8060 8070 sys.getcheckinterval()
8061 8071 \family default
8062 8072 function, and it can be reset via
8063 8073 \family typewriter
8064 8074 sys.setcheckinterval(
8065 8075 \emph on
8066 8076 N
8067 8077 \emph default
8068 8078 )
8069 8079 \family default
8070 8080 .
8071 8081 This switching of threads can cause subtly confusing effects if one of
8072 8082 your threads is doing file I/O.
8073 8083 In text mode, most systems only flush file buffers when they encounter
8074 8084 a
8075 8085 \family typewriter
8076 8086 `
8077 8087 \backslash
8078 8088 n'
8079 8089 \family default
8080 8090 .
8081 8091 An instruction as simple as
8082 8092 \family typewriter
8083 8093
8084 8094 \newline
8085 8095 \SpecialChar ~
8086 8096 \SpecialChar ~
8087 8097 print >> filehandle,
8088 8098 \begin_inset Quotes eld
8089 8099 \end_inset
8090 8100
8091 8101 hello world
8092 8102 \begin_inset Quotes erd
8093 8103 \end_inset
8094 8104
8095 8105
8096 8106 \family default
8097 8107
8098 8108 \newline
8099 8109 actually consists of several bytecodes, so it is possible that the newline
8100 8110 does not reach your file before the next thread switch.
8101 8111 Similarly, if you are writing to a file in binary mode, the file won't
8102 8112 be flushed until the buffer fills, and your other thread may see apparently
8103 8113 truncated files.
8104 8114
8105 8115 \layout Standard
8106 8116
8107 8117 For this reason, if you are using IPython's thread support and have (for
8108 8118 example) a GUI application which will read data generated by files written
8109 8119 to from the IPython thread, the safest approach is to open all of your
8110 8120 files in unbuffered mode (the third argument to the
8111 8121 \family typewriter
8112 8122 file/open
8113 8123 \family default
8114 8124 function is the buffering value):
8115 8125 \newline
8116 8126
8117 8127 \family typewriter
8118 8128 \SpecialChar ~
8119 8129 \SpecialChar ~
8120 8130 filehandle = open(filename,mode,0)
8121 8131 \layout Standard
8122 8132
8123 8133 This is obviously a brute force way of avoiding race conditions with the
8124 8134 file buffering.
8125 8135 If you want to do it cleanly, and you have a resource which is being shared
8126 8136 by the interactive IPython loop and your GUI thread, you should really
8127 8137 handle it with thread locking and syncrhonization properties.
8128 8138 The Python documentation discusses these.
8129 8139 \layout Section
8130 8140
8131 8141
8132 8142 \begin_inset LatexCommand \label{sec:interactive-demos}
8133 8143
8134 8144 \end_inset
8135 8145
8136 8146 Interactive demos with IPython
8137 8147 \layout Standard
8138 8148
8139 8149 IPython ships with a basic system for running scripts interactively in sections,
8140 8150 useful when presenting code to audiences.
8141 8151 A few tags embedded in comments (so that the script remains valid Python
8142 8152 code) divide a file into separate blocks, and the demo can be run one block
8143 8153 at a time, with IPython printing (with syntax highlighting) the block before
8144 8154 executing it, and returning to the interactive prompt after each block.
8145 8155 The interactive namespace is updated after each block is run with the contents
8146 8156 of the demo's namespace.
8147 8157 \layout Standard
8148 8158
8149 8159 This allows you to show a piece of code, run it and then execute interactively
8150 8160 commands based on the variables just created.
8151 8161 Once you want to continue, you simply execute the next block of the demo.
8152 8162 The following listing shows the markup necessary for dividing a script
8153 8163 into sections for execution as a demo.
8154 8164 \layout Standard
8155 8165
8156 8166
8157 8167 \begin_inset ERT
8158 8168 status Open
8159 8169
8160 8170 \layout Standard
8161 8171
8162 8172 \backslash
8163 8173 codelist{examples/example-demo.py}
8164 8174 \end_inset
8165 8175
8166 8176
8167 8177 \layout Standard
8168 8178
8169 8179 In order to run a file as a demo, you must first make a
8170 8180 \family typewriter
8171 8181 Demo
8172 8182 \family default
8173 8183 object out of it.
8174 8184 If the file is named
8175 8185 \family typewriter
8176 8186 myscript.py
8177 8187 \family default
8178 8188 , the following code will make a demo:
8179 8189 \layout LyX-Code
8180 8190
8181 8191 from IPython.demo import Demo
8182 8192 \layout LyX-Code
8183 8193
8184 8194 mydemo = Demo('myscript.py')
8185 8195 \layout Standard
8186 8196
8187 8197 This creates the
8188 8198 \family typewriter
8189 8199 mydemo
8190 8200 \family default
8191 8201 object, whose blocks you run one at a time by simply calling the object
8192 8202 with no arguments.
8193 8203 If you have autocall active in IPython (the default), all you need to do
8194 8204 is type
8195 8205 \layout LyX-Code
8196 8206
8197 8207 mydemo
8198 8208 \layout Standard
8199 8209
8200 8210 and IPython will call it, executing each block.
8201 8211 Demo objects can be restarted, you can move forward or back skipping blocks,
8202 8212 re-execute the last block, etc.
8203 8213 Simply use the Tab key on a demo object to see its methods, and call
8204 8214 \family typewriter
8205 8215 `?'
8206 8216 \family default
8207 8217 on them to see their docstrings for more usage details.
8208 8218 In addition, the
8209 8219 \family typewriter
8210 8220 demo
8211 8221 \family default
8212 8222 module itself contains a comprehensive docstring, which you can access
8213 8223 via
8214 8224 \layout LyX-Code
8215 8225
8216 8226 from IPython import demo
8217 8227 \layout LyX-Code
8218 8228
8219 8229 demo?
8220 8230 \layout Standard
8221 8231
8222 8232
8223 8233 \series bold
8224 8234 Limitations:
8225 8235 \series default
8226 8236 It is important to note that these demos are limited to fairly simple uses.
8227 8237 In particular, you can
8228 8238 \emph on
8229 8239 not
8230 8240 \emph default
8231 8241 put division marks in indented code (loops, if statements, function definitions
8232 8242 , etc.) Supporting something like this would basically require tracking the
8233 8243 internal execution state of the Python interpreter, so only top-level divisions
8234 8244 are allowed.
8235 8245 If you want to be able to open an IPython instance at an arbitrary point
8236 8246 in a program, you can use IPython's embedding facilities, described in
8237 8247 detail in Sec\SpecialChar \@.
8238 8248 \SpecialChar ~
8239 8249
8240 8250 \begin_inset LatexCommand \ref{sec:embed}
8241 8251
8242 8252 \end_inset
8243 8253
8244 8254 .
8245 8255 \layout Section
8246 8256
8247 8257
8248 8258 \begin_inset LatexCommand \label{sec:matplotlib-support}
8249 8259
8250 8260 \end_inset
8251 8261
8252 8262 Plotting with
8253 8263 \family typewriter
8254 8264 matplotlib
8255 8265 \family default
8256 8266
8257 8267 \layout Standard
8258 8268
8259 8269 The matplotlib library (
8260 8270 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
8261 8271
8262 8272 \end_inset
8263 8273
8264 8274 ) provides high quality 2D plotting for Python.
8265 8275 Matplotlib can produce plots on screen using a variety of GUI toolkits,
8266 8276 including Tk, GTK and WXPython.
8267 8277 It also provides a number of commands useful for scientific computing,
8268 8278 all with a syntax compatible with that of the popular Matlab program.
8269 8279 \layout Standard
8270 8280
8271 8281 IPython accepts the special option
8272 8282 \family typewriter
8273 8283 -pylab
8274 8284 \family default
8275 8285 (Sec.\SpecialChar ~
8276 8286
8277 8287 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
8278 8288
8279 8289 \end_inset
8280 8290
8281 8291 ).
8282 8292 This configures it to support matplotlib, honoring the settings in the
8283 8293
8284 8294 \family typewriter
8285 8295 .matplotlibrc
8286 8296 \family default
8287 8297 file.
8288 8298 IPython will detect the user's choice of matplotlib GUI backend, and automatica
8289 8299 lly select the proper threading model to prevent blocking.
8290 8300 It also sets matplotlib in interactive mode and modifies
8291 8301 \family typewriter
8292 8302 %run
8293 8303 \family default
8294 8304 slightly, so that any matplotlib-based script can be executed using
8295 8305 \family typewriter
8296 8306 %run
8297 8307 \family default
8298 8308 and the final
8299 8309 \family typewriter
8300 8310 show()
8301 8311 \family default
8302 8312 command does not block the interactive shell.
8303 8313 \layout Standard
8304 8314
8305 8315 The
8306 8316 \family typewriter
8307 8317 -pylab
8308 8318 \family default
8309 8319 option must be given first in order for IPython to configure its threading
8310 8320 mode.
8311 8321 However, you can still issue other options afterwards.
8312 8322 This allows you to have a matplotlib-based environment customized with
8313 8323 additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~
8314 8324
8315 8325 \begin_inset LatexCommand \ref{sec:profiles}
8316 8326
8317 8327 \end_inset
8318 8328
8319 8329 ): ``
8320 8330 \family typewriter
8321 8331 ipython -pylab -p myprofile
8322 8332 \family default
8323 8333 '' will load the profile defined in
8324 8334 \family typewriter
8325 8335 ipythonrc-myprofile
8326 8336 \family default
8327 8337 after configuring matplotlib.
8328 8338 \layout Section
8329 8339
8330 8340
8331 8341 \begin_inset LatexCommand \label{sec:Gnuplot}
8332 8342
8333 8343 \end_inset
8334 8344
8335 8345 Plotting with
8336 8346 \family typewriter
8337 8347 Gnuplot
8338 8348 \layout Standard
8339 8349
8340 8350 Through the magic extension system described in sec.
8341 8351
8342 8352 \begin_inset LatexCommand \ref{sec:magic}
8343 8353
8344 8354 \end_inset
8345 8355
8346 8356 , IPython incorporates a mechanism for conveniently interfacing with the
8347 8357 Gnuplot system (
8348 8358 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
8349 8359
8350 8360 \end_inset
8351 8361
8352 8362 ).
8353 8363 Gnuplot is a very complete 2D and 3D plotting package available for many
8354 8364 operating systems and commonly included in modern Linux distributions.
8355 8365
8356 8366 \layout Standard
8357 8367
8358 8368 Besides having Gnuplot installed, this functionality requires the
8359 8369 \family typewriter
8360 8370 Gnuplot.py
8361 8371 \family default
8362 8372 module for interfacing python with Gnuplot.
8363 8373 It can be downloaded from:
8364 8374 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
8365 8375
8366 8376 \end_inset
8367 8377
8368 8378 .
8369 8379 \layout Subsection
8370 8380
8371 8381 Proper Gnuplot configuration
8372 8382 \layout Standard
8373 8383
8374 8384 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
8375 8385 However, as of
8376 8386 \family typewriter
8377 8387 Gnuplot.py
8378 8388 \family default
8379 8389 version 1.7, a new option was added to communicate between Python and Gnuplot
8380 8390 via FIFOs (pipes).
8381 8391 This mechanism, while fast, also breaks the mouse system.
8382 8392 You must therefore set the variable
8383 8393 \family typewriter
8384 8394 prefer_fifo_data
8385 8395 \family default
8386 8396 to
8387 8397 \family typewriter
8388 8398 0
8389 8399 \family default
8390 8400 in file
8391 8401 \family typewriter
8392 8402 gp_unix.py
8393 8403 \family default
8394 8404 if you wish to keep the interactive mouse and keyboard features working
8395 8405 properly (
8396 8406 \family typewriter
8397 8407 prefer_inline_data
8398 8408 \family default
8399 8409 also must be
8400 8410 \family typewriter
8401 8411 0
8402 8412 \family default
8403 8413 , but this is the default so unless you've changed it manually you should
8404 8414 be fine).
8405 8415 \layout Standard
8406 8416
8407 8417 'Out of the box', Gnuplot is configured with a rather poor set of size,
8408 8418 color and linewidth choices which make the graphs fairly hard to read on
8409 8419 modern high-resolution displays (although they work fine on old 640x480
8410 8420 ones).
8411 8421 Below is a section of my
8412 8422 \family typewriter
8413 8423 .Xdefaults
8414 8424 \family default
8415 8425 file which I use for having a more convenient Gnuplot setup.
8416 8426 Remember to load it by running
8417 8427 \family typewriter
8418 8428 `xrdb .Xdefaults`
8419 8429 \family default
8420 8430 :
8421 8431 \layout Standard
8422 8432
8423 8433
8424 8434 \family typewriter
8425 8435 !******************************************************************
8426 8436 \newline
8427 8437 ! gnuplot options
8428 8438 \newline
8429 8439 ! modify this for a convenient window size
8430 8440 \newline
8431 8441 gnuplot*geometry: 780x580
8432 8442 \layout Standard
8433 8443
8434 8444
8435 8445 \family typewriter
8436 8446 ! on-screen font (not for PostScript)
8437 8447 \newline
8438 8448 gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1
8439 8449 \layout Standard
8440 8450
8441 8451
8442 8452 \family typewriter
8443 8453 ! color options
8444 8454 \newline
8445 8455 gnuplot*background: black
8446 8456 \newline
8447 8457 gnuplot*textColor: white
8448 8458 \newline
8449 8459 gnuplot*borderColor: white
8450 8460 \newline
8451 8461 gnuplot*axisColor: white
8452 8462 \newline
8453 8463 gnuplot*line1Color: red
8454 8464 \newline
8455 8465 gnuplot*line2Color: green
8456 8466 \newline
8457 8467 gnuplot*line3Color: blue
8458 8468 \newline
8459 8469 gnuplot*line4Color: magenta
8460 8470 \newline
8461 8471 gnuplot*line5Color: cyan
8462 8472 \newline
8463 8473 gnuplot*line6Color: sienna
8464 8474 \newline
8465 8475 gnuplot*line7Color: orange
8466 8476 \newline
8467 8477 gnuplot*line8Color: coral
8468 8478 \layout Standard
8469 8479
8470 8480
8471 8481 \family typewriter
8472 8482 ! multiplicative factor for point styles
8473 8483 \newline
8474 8484 gnuplot*pointsize: 2
8475 8485 \layout Standard
8476 8486
8477 8487
8478 8488 \family typewriter
8479 8489 ! line width options (in pixels)
8480 8490 \newline
8481 8491 gnuplot*borderWidth: 2
8482 8492 \newline
8483 8493 gnuplot*axisWidth: 2
8484 8494 \newline
8485 8495 gnuplot*line1Width: 2
8486 8496 \newline
8487 8497 gnuplot*line2Width: 2
8488 8498 \newline
8489 8499 gnuplot*line3Width: 2
8490 8500 \newline
8491 8501 gnuplot*line4Width: 2
8492 8502 \newline
8493 8503 gnuplot*line5Width: 2
8494 8504 \newline
8495 8505 gnuplot*line6Width: 2
8496 8506 \newline
8497 8507 gnuplot*line7Width: 2
8498 8508 \newline
8499 8509 gnuplot*line8Width: 2
8500 8510 \layout Subsection
8501 8511
8502 8512 The
8503 8513 \family typewriter
8504 8514 IPython.GnuplotRuntime
8505 8515 \family default
8506 8516 module
8507 8517 \layout Standard
8508 8518
8509 8519 IPython includes a module called
8510 8520 \family typewriter
8511 8521 Gnuplot2.py
8512 8522 \family default
8513 8523 which extends and improves the default
8514 8524 \family typewriter
8515 8525 Gnuplot
8516 8526 \family default
8517 8527 .
8518 8528 \family typewriter
8519 8529 py
8520 8530 \family default
8521 8531 (which it still relies upon).
8522 8532 For example, the new
8523 8533 \family typewriter
8524 8534 plot
8525 8535 \family default
8526 8536 function adds several improvements to the original making it more convenient
8527 8537 for interactive use, and
8528 8538 \family typewriter
8529 8539 hardcopy
8530 8540 \family default
8531 8541 fixes a bug in the original which under some circumstances blocks the creation
8532 8542 of PostScript output.
8533 8543 \layout Standard
8534 8544
8535 8545 For scripting use,
8536 8546 \family typewriter
8537 8547 GnuplotRuntime.py
8538 8548 \family default
8539 8549 is provided, which wraps
8540 8550 \family typewriter
8541 8551 Gnuplot2.py
8542 8552 \family default
8543 8553 and creates a series of global aliases.
8544 8554 These make it easy to control Gnuplot plotting jobs through the Python
8545 8555 language.
8546 8556 \layout Standard
8547 8557
8548 8558 Below is some example code which illustrates how to configure Gnuplot inside
8549 8559 your own programs but have it available for further interactive use through
8550 8560 an embedded IPython instance.
8551 8561 Simply run this file at a system prompt.
8552 8562 This file is provided as
8553 8563 \family typewriter
8554 8564 example-gnuplot.py
8555 8565 \family default
8556 8566 in the examples directory:
8557 8567 \layout Standard
8558 8568
8559 8569
8560 8570 \begin_inset ERT
8561 8571 status Open
8562 8572
8563 8573 \layout Standard
8564 8574
8565 8575 \backslash
8566 8576 codelist{examples/example-gnuplot.py}
8567 8577 \end_inset
8568 8578
8569 8579
8570 8580 \layout Subsection
8571 8581
8572 8582 The
8573 8583 \family typewriter
8574 8584 numeric
8575 8585 \family default
8576 8586 profile: a scientific computing environment
8577 8587 \layout Standard
8578 8588
8579 8589 The
8580 8590 \family typewriter
8581 8591 numeric
8582 8592 \family default
8583 8593 IPython profile, which you can activate with
8584 8594 \family typewriter
8585 8595 `ipython -p numeric
8586 8596 \family default
8587 8597 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
8588 8598 other useful things for numerical computing), contained in the
8589 8599 \family typewriter
8590 8600 IPython.GnuplotInteractive
8591 8601 \family default
8592 8602 module.
8593 8603 This will create the globals
8594 8604 \family typewriter
8595 8605 Gnuplot
8596 8606 \family default
8597 8607 (an alias to the improved Gnuplot2 module),
8598 8608 \family typewriter
8599 8609 gp
8600 8610 \family default
8601 8611 (a Gnuplot active instance), the new magic commands
8602 8612 \family typewriter
8603 8613 %gpc
8604 8614 \family default
8605 8615 and
8606 8616 \family typewriter
8607 8617 %gp_set_instance
8608 8618 \family default
8609 8619 and several other convenient globals.
8610 8620 Type
8611 8621 \family typewriter
8612 8622 gphelp()
8613 8623 \family default
8614 8624 for further details.
8615 8625 \layout Standard
8616 8626
8617 8627 This should turn IPython into a convenient environment for numerical computing,
8618 8628 with all the functions in the NumPy library and the Gnuplot facilities
8619 8629 for plotting.
8620 8630 Further improvements can be obtained by loading the SciPy libraries for
8621 8631 scientific computing, available at
8622 8632 \begin_inset LatexCommand \htmlurl{http://scipy.org}
8623 8633
8624 8634 \end_inset
8625 8635
8626 8636 .
8627 8637 \layout Standard
8628 8638
8629 8639 If you are in the middle of a working session with numerical objects and
8630 8640 need to plot them but you didn't start the
8631 8641 \family typewriter
8632 8642 numeric
8633 8643 \family default
8634 8644 profile, you can load these extensions at any time by typing
8635 8645 \newline
8636 8646
8637 8647 \family typewriter
8638 8648 from IPython.GnuplotInteractive import *
8639 8649 \newline
8640 8650
8641 8651 \family default
8642 8652 at the IPython prompt.
8643 8653 This will allow you to keep your objects intact and start using Gnuplot
8644 8654 to view them.
8645 8655 \layout Section
8646 8656
8647 8657 Reporting bugs
8648 8658 \layout Subsection*
8649 8659
8650 8660 Automatic crash reports
8651 8661 \layout Standard
8652 8662
8653 8663 Ideally, IPython itself shouldn't crash.
8654 8664 It will catch exceptions produced by you, but bugs in its internals will
8655 8665 still crash it.
8656 8666 \layout Standard
8657 8667
8658 8668 In such a situation, IPython will leave a file named
8659 8669 \family typewriter
8660 8670 IPython_crash_report.txt
8661 8671 \family default
8662 8672 in your IPYTHONDIR directory (that way if crashes happen several times
8663 8673 it won't litter many directories, the post-mortem file is always located
8664 8674 in the same place and new occurrences just overwrite the previous one).
8665 8675 If you can mail this file to the developers (see sec.
8666 8676
8667 8677 \begin_inset LatexCommand \ref{sec:credits}
8668 8678
8669 8679 \end_inset
8670 8680
8671 8681 for names and addresses), it will help us
8672 8682 \emph on
8673 8683 a lot
8674 8684 \emph default
8675 8685 in understanding the cause of the problem and fixing it sooner.
8676 8686 \layout Subsection*
8677 8687
8678 8688 The bug tracker
8679 8689 \layout Standard
8680 8690
8681 8691 IPython also has an online bug-tracker, located at
8682 8692 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython}
8683 8693
8684 8694 \end_inset
8685 8695
8686 8696 .
8687 8697 In addition to mailing the developers, it would be a good idea to file
8688 8698 a bug report here.
8689 8699 This will ensure that the issue is properly followed to conclusion.
8690 8700 \layout Standard
8691 8701
8692 8702 You can also use this bug tracker to file feature requests.
8693 8703 \layout Section
8694 8704
8695 8705 Brief history
8696 8706 \layout Subsection
8697 8707
8698 8708 Origins
8699 8709 \layout Standard
8700 8710
8701 8711 The current IPython system grew out of the following three projects:
8702 8712 \layout List
8703 8713 \labelwidthstring 00.00.0000
8704 8714
8705 8715 ipython by Fernando P
8706 8716 \begin_inset ERT
8707 8717 status Collapsed
8708 8718
8709 8719 \layout Standard
8710 8720
8711 8721 \backslash
8712 8722 '{e}
8713 8723 \end_inset
8714 8724
8715 8725 rez.
8716 8726 I was working on adding Mathematica-type prompts and a flexible configuration
8717 8727 system (something better than
8718 8728 \family typewriter
8719 8729 $PYTHONSTARTUP
8720 8730 \family default
8721 8731 ) to the standard Python interactive interpreter.
8722 8732 \layout List
8723 8733 \labelwidthstring 00.00.0000
8724 8734
8725 8735 IPP by Janko Hauser.
8726 8736 Very well organized, great usability.
8727 8737 Had an old help system.
8728 8738 IPP was used as the `container' code into which I added the functionality
8729 8739 from ipython and LazyPython.
8730 8740 \layout List
8731 8741 \labelwidthstring 00.00.0000
8732 8742
8733 8743 LazyPython by Nathan Gray.
8734 8744 Simple but
8735 8745 \emph on
8736 8746 very
8737 8747 \emph default
8738 8748 powerful.
8739 8749 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
8740 8750 were all taken from here.
8741 8751 \layout Standard
8742 8752
8743 8753 When I found out (see sec.
8744 8754
8745 8755 \begin_inset LatexCommand \ref{figgins}
8746 8756
8747 8757 \end_inset
8748 8758
8749 8759 ) about IPP and LazyPython I tried to join all three into a unified system.
8750 8760 I thought this could provide a very nice working environment, both for
8751 8761 regular programming and scientific computing: shell-like features, IDL/Matlab
8752 8762 numerics, Mathematica-type prompt history and great object introspection
8753 8763 and help facilities.
8754 8764 I think it worked reasonably well, though it was a lot more work than I
8755 8765 had initially planned.
8756 8766 \layout Subsection
8757 8767
8758 8768 Current status
8759 8769 \layout Standard
8760 8770
8761 8771 The above listed features work, and quite well for the most part.
8762 8772 But until a major internal restructuring is done (see below), only bug
8763 8773 fixing will be done, no other features will be added (unless very minor
8764 8774 and well localized in the cleaner parts of the code).
8765 8775 \layout Standard
8766 8776
8767 8777 IPython consists of some 18000 lines of pure python code, of which roughly
8768 8778 two thirds is reasonably clean.
8769 8779 The rest is, messy code which needs a massive restructuring before any
8770 8780 further major work is done.
8771 8781 Even the messy code is fairly well documented though, and most of the problems
8772 8782 in the (non-existent) class design are well pointed to by a PyChecker run.
8773 8783 So the rewriting work isn't that bad, it will just be time-consuming.
8774 8784 \layout Subsection
8775 8785
8776 8786 Future
8777 8787 \layout Standard
8778 8788
8779 8789 See the separate
8780 8790 \family typewriter
8781 8791 new_design
8782 8792 \family default
8783 8793 document for details.
8784 8794 Ultimately, I would like to see IPython become part of the standard Python
8785 8795 distribution as a `big brother with batteries' to the standard Python interacti
8786 8796 ve interpreter.
8787 8797 But that will never happen with the current state of the code, so all contribut
8788 8798 ions are welcome.
8789 8799 \layout Section
8790 8800
8791 8801 License
8792 8802 \layout Standard
8793 8803
8794 8804 IPython is released under the terms of the BSD license, whose general form
8795 8805 can be found at:
8796 8806 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
8797 8807
8798 8808 \end_inset
8799 8809
8800 8810 .
8801 8811 The full text of the IPython license is reproduced below:
8802 8812 \layout Quote
8803 8813
8804 8814
8805 8815 \family typewriter
8806 8816 \size small
8807 8817 IPython is released under a BSD-type license.
8808 8818 \layout Quote
8809 8819
8810 8820
8811 8821 \family typewriter
8812 8822 \size small
8813 8823 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
8814 8824 \layout Quote
8815 8825
8816 8826
8817 8827 \family typewriter
8818 8828 \size small
8819 8829 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
8820 8830 \newline
8821 8831 Nathaniel Gray <n8gray@caltech.edu>.
8822 8832 \layout Quote
8823 8833
8824 8834
8825 8835 \family typewriter
8826 8836 \size small
8827 8837 All rights reserved.
8828 8838 \layout Quote
8829 8839
8830 8840
8831 8841 \family typewriter
8832 8842 \size small
8833 8843 Redistribution and use in source and binary forms, with or without modification,
8834 8844 are permitted provided that the following conditions are met:
8835 8845 \layout Quote
8836 8846
8837 8847
8838 8848 \family typewriter
8839 8849 \size small
8840 8850 a.
8841 8851 Redistributions of source code must retain the above copyright notice,
8842 8852 this list of conditions and the following disclaimer.
8843 8853 \layout Quote
8844 8854
8845 8855
8846 8856 \family typewriter
8847 8857 \size small
8848 8858 b.
8849 8859 Redistributions in binary form must reproduce the above copyright notice,
8850 8860 this list of conditions and the following disclaimer in the documentation
8851 8861 and/or other materials provided with the distribution.
8852 8862 \layout Quote
8853 8863
8854 8864
8855 8865 \family typewriter
8856 8866 \size small
8857 8867 c.
8858 8868 Neither the name of the copyright holders nor the names of any contributors
8859 8869 to this software may be used to endorse or promote products derived from
8860 8870 this software without specific prior written permission.
8861 8871 \layout Quote
8862 8872
8863 8873
8864 8874 \family typewriter
8865 8875 \size small
8866 8876 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
8867 8877 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8868 8878 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8869 8879 PURPOSE ARE DISCLAIMED.
8870 8880 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
8871 8881 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
8872 8882 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
8873 8883 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8874 8884 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8875 8885 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8876 8886 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8877 8887
8878 8888 \layout Standard
8879 8889
8880 8890 Individual authors are the holders of the copyright for their code and are
8881 8891 listed in each file.
8882 8892 \layout Standard
8883 8893
8884 8894 Some files (
8885 8895 \family typewriter
8886 8896 DPyGetOpt.py
8887 8897 \family default
8888 8898 , for example) may be licensed under different conditions.
8889 8899 Ultimately each file indicates clearly the conditions under which its author/au
8890 8900 thors have decided to publish the code.
8891 8901 \layout Standard
8892 8902
8893 8903 Versions of IPython up to and including 0.6.3 were released under the GNU
8894 8904 Lesser General Public License (LGPL), available at
8895 8905 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
8896 8906
8897 8907 \end_inset
8898 8908
8899 8909 .
8900 8910 \layout Section
8901 8911
8902 8912
8903 8913 \begin_inset LatexCommand \label{sec:credits}
8904 8914
8905 8915 \end_inset
8906 8916
8907 8917 Credits
8908 8918 \layout Standard
8909 8919
8910 8920 IPython is mainly developed by Fernando P
8911 8921 \begin_inset ERT
8912 8922 status Collapsed
8913 8923
8914 8924 \layout Standard
8915 8925
8916 8926 \backslash
8917 8927 '{e}
8918 8928 \end_inset
8919 8929
8920 8930 rez
8921 8931 \family typewriter
8922 8932 <Fernando.Perez@colorado.edu>
8923 8933 \family default
8924 8934 , but the project was born from mixing in Fernando's code with the IPP project
8925 8935 by Janko Hauser
8926 8936 \family typewriter
8927 8937 <jhauser-AT-zscout.de>
8928 8938 \family default
8929 8939 and LazyPython by Nathan Gray
8930 8940 \family typewriter
8931 8941 <n8gray-AT-caltech.edu>
8932 8942 \family default
8933 8943 .
8934 8944 For all IPython-related requests, please contact Fernando.
8935 8945
8936 8946 \layout Standard
8937 8947
8938 8948 As of early 2006, the following developers have joined the core team:
8939 8949 \layout List
8940 8950 \labelwidthstring 00.00.0000
8941 8951
8942 8952 Robert\SpecialChar ~
8943 8953 Kern
8944 8954 \family typewriter
8945 8955 <rkern-AT-enthought.com>
8946 8956 \family default
8947 8957 : co-mentored the 2005 Google Summer of Code project to develop python interacti
8948 8958 ve notebooks (XML documents) and graphical interface.
8949 8959 This project was awarded to the students Tzanko Matev
8950 8960 \family typewriter
8951 8961 <tsanko-AT-gmail.com>
8952 8962 \family default
8953 8963 and Toni Alatalo
8954 8964 \family typewriter
8955 8965 <antont-AT-an.org>
8956 8966 \layout List
8957 8967 \labelwidthstring 00.00.0000
8958 8968
8959 8969 Brian\SpecialChar ~
8960 8970 Granger
8961 8971 \family typewriter
8962 8972 <bgranger-AT-scu.edu>
8963 8973 \family default
8964 8974 : extending IPython to allow support for interactive parallel computing.
8965 8975 \layout List
8966 8976 \labelwidthstring 00.00.0000
8967 8977
8968 8978 Ville\SpecialChar ~
8969 8979 Vainio
8970 8980 \family typewriter
8971 8981 <vivainio-AT-gmail.com>
8972 8982 \family default
8973 8983 : Ville is the new maintainer for the main trunk of IPython after version
8974 8984 0.7.1.
8975 8985 \layout Standard
8976 8986
8977 8987 User or development help should be requested via the IPython mailing lists:
8978 8988 \layout Description
8979 8989
8980 8990 User\SpecialChar ~
8981 8991 list:
8982 8992 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
8983 8993
8984 8994 \end_inset
8985 8995
8986 8996
8987 8997 \layout Description
8988 8998
8989 8999 Developer's\SpecialChar ~
8990 9000 list:
8991 9001 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
8992 9002
8993 9003 \end_inset
8994 9004
8995 9005
8996 9006 \layout Standard
8997 9007
8998 9008 The IPython project is also very grateful to
8999 9009 \begin_inset Foot
9000 9010 collapsed true
9001 9011
9002 9012 \layout Standard
9003 9013
9004 9014 I've mangled email addresses to reduce spam, since the IPython manuals can
9005 9015 be accessed online.
9006 9016 \end_inset
9007 9017
9008 9018 :
9009 9019 \layout Standard
9010 9020
9011 9021 Bill Bumgarner
9012 9022 \family typewriter
9013 9023 <bbum-AT-friday.com>
9014 9024 \family default
9015 9025 : for providing the DPyGetOpt module which gives very powerful and convenient
9016 9026 handling of command-line options (light years ahead of what Python 2.1.1's
9017 9027 getopt module does).
9018 9028 \layout Standard
9019 9029
9020 9030 Ka-Ping Yee
9021 9031 \family typewriter
9022 9032 <ping-AT-lfw.org>
9023 9033 \family default
9024 9034 : for providing the Itpl module for convenient and powerful string interpolation
9025 9035 with a much nicer syntax than formatting through the '%' operator.
9026 9036 \layout Standard
9027 9037
9028 9038 Arnd Baecker
9029 9039 \family typewriter
9030 9040 <baecker-AT-physik.tu-dresden.de>
9031 9041 \family default
9032 9042 : for his many very useful suggestions and comments, and lots of help with
9033 9043 testing and documentation checking.
9034 9044 Many of IPython's newer features are a result of discussions with him (bugs
9035 9045 are still my fault, not his).
9036 9046 \layout Standard
9037 9047
9038 9048 Obviously Guido van\SpecialChar ~
9039 9049 Rossum and the whole Python development team, that goes
9040 9050 without saying.
9041 9051 \layout Standard
9042 9052
9043 9053 IPython's website is generously hosted at
9044 9054 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
9045 9055
9046 9056 \end_inset
9047 9057
9048 9058 by Enthought (
9049 9059 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
9050 9060
9051 9061 \end_inset
9052 9062
9053 9063 ).
9054 9064 I am very grateful to them and all of the SciPy team for their contribution.
9055 9065 \layout Standard
9056 9066
9057 9067
9058 9068 \begin_inset LatexCommand \label{figgins}
9059 9069
9060 9070 \end_inset
9061 9071
9062 9072 Fernando would also like to thank Stephen Figgins
9063 9073 \family typewriter
9064 9074 <fig-AT-monitor.net>
9065 9075 \family default
9066 9076 , an O'Reilly Python editor.
9067 9077 His Oct/11/2001 article about IPP and LazyPython, was what got this project
9068 9078 started.
9069 9079 You can read it at:
9070 9080 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
9071 9081
9072 9082 \end_inset
9073 9083
9074 9084 .
9075 9085 \layout Standard
9076 9086
9077 9087 And last but not least, all the kind IPython users who have emailed new
9078 9088 code, bug reports, fixes, comments and ideas.
9079 9089 A brief list follows, please let me know if I have ommitted your name by
9080 9090 accident:
9081 9091 \layout List
9082 9092 \labelwidthstring 00.00.0000
9083 9093
9084 9094 Jack\SpecialChar ~
9085 9095 Moffit
9086 9096 \family typewriter
9087 9097 <jack-AT-xiph.org>
9088 9098 \family default
9089 9099 Bug fixes, including the infamous color problem.
9090 9100 This bug alone caused many lost hours and frustration, many thanks to him
9091 9101 for the fix.
9092 9102 I've always been a fan of Ogg & friends, now I have one more reason to
9093 9103 like these folks.
9094 9104 \newline
9095 9105 Jack is also contributing with Debian packaging and many other things.
9096 9106 \layout List
9097 9107 \labelwidthstring 00.00.0000
9098 9108
9099 9109 Alexander\SpecialChar ~
9100 9110 Schmolck
9101 9111 \family typewriter
9102 9112 <a.schmolck-AT-gmx.net>
9103 9113 \family default
9104 9114 Emacs work, bug reports, bug fixes, ideas, lots more.
9105 9115 The ipython.el mode for (X)Emacs is Alex's code, providing full support
9106 9116 for IPython under (X)Emacs.
9107 9117 \layout List
9108 9118 \labelwidthstring 00.00.0000
9109 9119
9110 9120 Andrea\SpecialChar ~
9111 9121 Riciputi
9112 9122 \family typewriter
9113 9123 <andrea.riciputi-AT-libero.it>
9114 9124 \family default
9115 9125 Mac OSX information, Fink package management.
9116 9126 \layout List
9117 9127 \labelwidthstring 00.00.0000
9118 9128
9119 9129 Gary\SpecialChar ~
9120 9130 Bishop
9121 9131 \family typewriter
9122 9132 <gb-AT-cs.unc.edu>
9123 9133 \family default
9124 9134 Bug reports, and patches to work around the exception handling idiosyncracies
9125 9135 of WxPython.
9126 9136 Readline and color support for Windows.
9127 9137 \layout List
9128 9138 \labelwidthstring 00.00.0000
9129 9139
9130 9140 Jeffrey\SpecialChar ~
9131 9141 Collins
9132 9142 \family typewriter
9133 9143 <Jeff.Collins-AT-vexcel.com>
9134 9144 \family default
9135 9145 Bug reports.
9136 9146 Much improved readline support, including fixes for Python 2.3.
9137 9147 \layout List
9138 9148 \labelwidthstring 00.00.0000
9139 9149
9140 9150 Dryice\SpecialChar ~
9141 9151 Liu
9142 9152 \family typewriter
9143 9153 <dryice-AT-liu.com.cn>
9144 9154 \family default
9145 9155 FreeBSD port.
9146 9156 \layout List
9147 9157 \labelwidthstring 00.00.0000
9148 9158
9149 9159 Mike\SpecialChar ~
9150 9160 Heeter
9151 9161 \family typewriter
9152 9162 <korora-AT-SDF.LONESTAR.ORG>
9153 9163 \layout List
9154 9164 \labelwidthstring 00.00.0000
9155 9165
9156 9166 Christopher\SpecialChar ~
9157 9167 Hart
9158 9168 \family typewriter
9159 9169 <hart-AT-caltech.edu>
9160 9170 \family default
9161 9171 PDB integration.
9162 9172 \layout List
9163 9173 \labelwidthstring 00.00.0000
9164 9174
9165 9175 Milan\SpecialChar ~
9166 9176 Zamazal
9167 9177 \family typewriter
9168 9178 <pdm-AT-zamazal.org>
9169 9179 \family default
9170 9180 Emacs info.
9171 9181 \layout List
9172 9182 \labelwidthstring 00.00.0000
9173 9183
9174 9184 Philip\SpecialChar ~
9175 9185 Hisley
9176 9186 \family typewriter
9177 9187 <compsys-AT-starpower.net>
9178 9188 \layout List
9179 9189 \labelwidthstring 00.00.0000
9180 9190
9181 9191 Holger\SpecialChar ~
9182 9192 Krekel
9183 9193 \family typewriter
9184 9194 <pyth-AT-devel.trillke.net>
9185 9195 \family default
9186 9196 Tab completion, lots more.
9187 9197 \layout List
9188 9198 \labelwidthstring 00.00.0000
9189 9199
9190 9200 Robin\SpecialChar ~
9191 9201 Siebler
9192 9202 \family typewriter
9193 9203 <robinsiebler-AT-starband.net>
9194 9204 \layout List
9195 9205 \labelwidthstring 00.00.0000
9196 9206
9197 9207 Ralf\SpecialChar ~
9198 9208 Ahlbrink
9199 9209 \family typewriter
9200 9210 <ralf_ahlbrink-AT-web.de>
9201 9211 \layout List
9202 9212 \labelwidthstring 00.00.0000
9203 9213
9204 9214 Thorsten\SpecialChar ~
9205 9215 Kampe
9206 9216 \family typewriter
9207 9217 <thorsten-AT-thorstenkampe.de>
9208 9218 \layout List
9209 9219 \labelwidthstring 00.00.0000
9210 9220
9211 9221 Fredrik\SpecialChar ~
9212 9222 Kant
9213 9223 \family typewriter
9214 9224 <fredrik.kant-AT-front.com>
9215 9225 \family default
9216 9226 Windows setup.
9217 9227 \layout List
9218 9228 \labelwidthstring 00.00.0000
9219 9229
9220 9230 Syver\SpecialChar ~
9221 9231 Enstad
9222 9232 \family typewriter
9223 9233 <syver-en-AT-online.no>
9224 9234 \family default
9225 9235 Windows setup.
9226 9236 \layout List
9227 9237 \labelwidthstring 00.00.0000
9228 9238
9229 9239 Richard
9230 9240 \family typewriter
9231 9241 <rxe-AT-renre-europe.com>
9232 9242 \family default
9233 9243 Global embedding.
9234 9244 \layout List
9235 9245 \labelwidthstring 00.00.0000
9236 9246
9237 9247 Hayden\SpecialChar ~
9238 9248 Callow
9239 9249 \family typewriter
9240 9250 <h.callow-AT-elec.canterbury.ac.nz>
9241 9251 \family default
9242 9252 Gnuplot.py 1.6 compatibility.
9243 9253 \layout List
9244 9254 \labelwidthstring 00.00.0000
9245 9255
9246 9256 Leonardo\SpecialChar ~
9247 9257 Santagada
9248 9258 \family typewriter
9249 9259 <retype-AT-terra.com.br>
9250 9260 \family default
9251 9261 Fixes for Windows installation.
9252 9262 \layout List
9253 9263 \labelwidthstring 00.00.0000
9254 9264
9255 9265 Christopher\SpecialChar ~
9256 9266 Armstrong
9257 9267 \family typewriter
9258 9268 <radix-AT-twistedmatrix.com>
9259 9269 \family default
9260 9270 Bugfixes.
9261 9271 \layout List
9262 9272 \labelwidthstring 00.00.0000
9263 9273
9264 9274 Francois\SpecialChar ~
9265 9275 Pinard
9266 9276 \family typewriter
9267 9277 <pinard-AT-iro.umontreal.ca>
9268 9278 \family default
9269 9279 Code and documentation fixes.
9270 9280 \layout List
9271 9281 \labelwidthstring 00.00.0000
9272 9282
9273 9283 Cory\SpecialChar ~
9274 9284 Dodt
9275 9285 \family typewriter
9276 9286 <cdodt-AT-fcoe.k12.ca.us>
9277 9287 \family default
9278 9288 Bug reports and Windows ideas.
9279 9289 Patches for Windows installer.
9280 9290 \layout List
9281 9291 \labelwidthstring 00.00.0000
9282 9292
9283 9293 Olivier\SpecialChar ~
9284 9294 Aubert
9285 9295 \family typewriter
9286 9296 <oaubert-AT-bat710.univ-lyon1.fr>
9287 9297 \family default
9288 9298 New magics.
9289 9299 \layout List
9290 9300 \labelwidthstring 00.00.0000
9291 9301
9292 9302 King\SpecialChar ~
9293 9303 C.\SpecialChar ~
9294 9304 Shu
9295 9305 \family typewriter
9296 9306 <kingshu-AT-myrealbox.com>
9297 9307 \family default
9298 9308 Autoindent patch.
9299 9309 \layout List
9300 9310 \labelwidthstring 00.00.0000
9301 9311
9302 9312 Chris\SpecialChar ~
9303 9313 Drexler
9304 9314 \family typewriter
9305 9315 <chris-AT-ac-drexler.de>
9306 9316 \family default
9307 9317 Readline packages for Win32/CygWin.
9308 9318 \layout List
9309 9319 \labelwidthstring 00.00.0000
9310 9320
9311 9321 Gustavo\SpecialChar ~
9312 9322 Cordova\SpecialChar ~
9313 9323 Avila
9314 9324 \family typewriter
9315 9325 <gcordova-AT-sismex.com>
9316 9326 \family default
9317 9327 EvalDict code for nice, lightweight string interpolation.
9318 9328 \layout List
9319 9329 \labelwidthstring 00.00.0000
9320 9330
9321 9331 Kasper\SpecialChar ~
9322 9332 Souren
9323 9333 \family typewriter
9324 9334 <Kasper.Souren-AT-ircam.fr>
9325 9335 \family default
9326 9336 Bug reports, ideas.
9327 9337 \layout List
9328 9338 \labelwidthstring 00.00.0000
9329 9339
9330 9340 Gever\SpecialChar ~
9331 9341 Tulley
9332 9342 \family typewriter
9333 9343 <gever-AT-helium.com>
9334 9344 \family default
9335 9345 Code contributions.
9336 9346 \layout List
9337 9347 \labelwidthstring 00.00.0000
9338 9348
9339 9349 Ralf\SpecialChar ~
9340 9350 Schmitt
9341 9351 \family typewriter
9342 9352 <ralf-AT-brainbot.com>
9343 9353 \family default
9344 9354 Bug reports & fixes.
9345 9355 \layout List
9346 9356 \labelwidthstring 00.00.0000
9347 9357
9348 9358 Oliver\SpecialChar ~
9349 9359 Sander
9350 9360 \family typewriter
9351 9361 <osander-AT-gmx.de>
9352 9362 \family default
9353 9363 Bug reports.
9354 9364 \layout List
9355 9365 \labelwidthstring 00.00.0000
9356 9366
9357 9367 Rod\SpecialChar ~
9358 9368 Holland
9359 9369 \family typewriter
9360 9370 <rhh-AT-structurelabs.com>
9361 9371 \family default
9362 9372 Bug reports and fixes to logging module.
9363 9373 \layout List
9364 9374 \labelwidthstring 00.00.0000
9365 9375
9366 9376 Daniel\SpecialChar ~
9367 9377 'Dang'\SpecialChar ~
9368 9378 Griffith
9369 9379 \family typewriter
9370 9380 <pythondev-dang-AT-lazytwinacres.net>
9371 9381 \family default
9372 9382 Fixes, enhancement suggestions for system shell use.
9373 9383 \layout List
9374 9384 \labelwidthstring 00.00.0000
9375 9385
9376 9386 Viktor\SpecialChar ~
9377 9387 Ransmayr
9378 9388 \family typewriter
9379 9389 <viktor.ransmayr-AT-t-online.de>
9380 9390 \family default
9381 9391 Tests and reports on Windows installation issues.
9382 9392 Contributed a true Windows binary installer.
9383 9393 \layout List
9384 9394 \labelwidthstring 00.00.0000
9385 9395
9386 9396 Mike\SpecialChar ~
9387 9397 Salib
9388 9398 \family typewriter
9389 9399 <msalib-AT-mit.edu>
9390 9400 \family default
9391 9401 Help fixing a subtle bug related to traceback printing.
9392 9402 \layout List
9393 9403 \labelwidthstring 00.00.0000
9394 9404
9395 9405 W.J.\SpecialChar ~
9396 9406 van\SpecialChar ~
9397 9407 der\SpecialChar ~
9398 9408 Laan
9399 9409 \family typewriter
9400 9410 <gnufnork-AT-hetdigitalegat.nl>
9401 9411 \family default
9402 9412 Bash-like prompt specials.
9403 9413 \layout List
9404 9414 \labelwidthstring 00.00.0000
9405 9415
9406 9416 Antoon\SpecialChar ~
9407 9417 Pardon
9408 9418 \family typewriter
9409 9419 <Antoon.Pardon-AT-rece.vub.ac.be>
9410 9420 \family default
9411 9421 Critical fix for the multithreaded IPython.
9412 9422 \layout List
9413 9423 \labelwidthstring 00.00.0000
9414 9424
9415 9425 John\SpecialChar ~
9416 9426 Hunter
9417 9427 \family typewriter
9418 9428 <jdhunter-AT-nitace.bsd.uchicago.edu>
9419 9429 \family default
9420 9430 Matplotlib author, helped with all the development of support for matplotlib
9421 9431 in IPyhton, including making necessary changes to matplotlib itself.
9422 9432 \layout List
9423 9433 \labelwidthstring 00.00.0000
9424 9434
9425 9435 Matthew\SpecialChar ~
9426 9436 Arnison
9427 9437 \family typewriter
9428 9438 <maffew-AT-cat.org.au>
9429 9439 \family default
9430 9440 Bug reports, `
9431 9441 \family typewriter
9432 9442 %run -d
9433 9443 \family default
9434 9444 ' idea.
9435 9445 \layout List
9436 9446 \labelwidthstring 00.00.0000
9437 9447
9438 9448 Prabhu\SpecialChar ~
9439 9449 Ramachandran
9440 9450 \family typewriter
9441 9451 <prabhu_r-AT-users.sourceforge.net>
9442 9452 \family default
9443 9453 Help with (X)Emacs support, threading patches, ideas...
9444 9454 \layout List
9445 9455 \labelwidthstring 00.00.0000
9446 9456
9447 9457 Norbert\SpecialChar ~
9448 9458 Tretkowski
9449 9459 \family typewriter
9450 9460 <tretkowski-AT-inittab.de>
9451 9461 \family default
9452 9462 help with Debian packaging and distribution.
9453 9463 \layout List
9454 9464 \labelwidthstring 00.00.0000
9455 9465
9456 9466 George\SpecialChar ~
9457 9467 Sakkis <
9458 9468 \family typewriter
9459 9469 gsakkis-AT-eden.rutgers.edu>
9460 9470 \family default
9461 9471 New matcher for tab-completing named arguments of user-defined functions.
9462 9472 \layout List
9463 9473 \labelwidthstring 00.00.0000
9464 9474
9465 9475 J�rgen\SpecialChar ~
9466 9476 Stenarson
9467 9477 \family typewriter
9468 9478 <jorgen.stenarson-AT-bostream.nu>
9469 9479 \family default
9470 9480 Wildcard support implementation for searching namespaces.
9471 9481 \layout List
9472 9482 \labelwidthstring 00.00.0000
9473 9483
9474 9484 Vivian\SpecialChar ~
9475 9485 De\SpecialChar ~
9476 9486 Smedt
9477 9487 \family typewriter
9478 9488 <vivian-AT-vdesmedt.com>
9479 9489 \family default
9480 9490 Debugger enhancements, so that when pdb is activated from within IPython,
9481 9491 coloring, tab completion and other features continue to work seamlessly.
9482 9492 \layout List
9483 9493 \labelwidthstring 00.00.0000
9484 9494
9485 9495 Scott\SpecialChar ~
9486 9496 Tsai
9487 9497 \family typewriter
9488 9498 <scottt958-AT-yahoo.com.tw>
9489 9499 \family default
9490 9500 Support for automatic editor invocation on syntax errors (see
9491 9501 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython/issue36}
9492 9502
9493 9503 \end_inset
9494 9504
9495 9505 ).
9496 9506 \layout List
9497 9507 \labelwidthstring 00.00.0000
9498 9508
9499 9509 Alexander\SpecialChar ~
9500 9510 Belchenko
9501 9511 \family typewriter
9502 9512 <bialix-AT-ukr.net>
9503 9513 \family default
9504 9514 Improvements for win32 paging system.
9505 9515 \the_end
General Comments 0
You need to be logged in to leave comments. Login now