##// END OF EJS Templates
r93:d01cf245
 @@ -1,7 +1,7 1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*- 2 """Magic functions for InteractiveShell. 2 """Magic functions for InteractiveShell. 3 3 4 $Id: Magic.py 994 2006-01-08 08:29:44Z fperez$""" 4 $Id: Magic.py 1000 2006-01-10 08:06:04Z fperez$""" 5 5 6 #***************************************************************************** 6 #***************************************************************************** 7 # Copyright (C) 2001 Janko Hauser and 7 # Copyright (C) 2001 Janko Hauser and @@ -250,7 +250,9 license. To use profiling, please install"python2.3-profiler" from non-free.""") 250 newline_re = re.compile(r'\\n') 250 newline_re = re.compile(r'\\n') 251 251 252 # Now build the string for output: 252 # Now build the string for output: 253 strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng) 253 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng) 254 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:', 255 strng) 254 strng = cmd_re.sub(r'\\texttt{\g}',strng) 256 strng = cmd_re.sub(r'\\texttt{\g}',strng) 255 strng = par_re.sub(r'\\\\',strng) 257 strng = par_re.sub(r'\\\\',strng) 256 strng = escape_re.sub(r'\\\1',strng) 258 strng = escape_re.sub(r'\\\1',strng) @@ -1709,6 +1711,7 Currently the magic system has the following functions:\n""" 1709 temporary file and will execute the contents of this file when you 1711 temporary file and will execute the contents of this file when you 1710 close it (don't forget to save it!). 1712 close it (don't forget to save it!). 1711 1713 1714 1712 Options: 1715 Options: 1713 1716 1714 -p: this will call the editor with the same data as the previous time 1717 -p: this will call the editor with the same data as the previous time @@ -1719,6 +1722,7 Currently the magic system has the following functions:\n""" 1719 mainly useful if you are editing programs which need to be called with 1722 mainly useful if you are editing programs which need to be called with 1720 command line arguments, which you can then do using %run. 1723 command line arguments, which you can then do using %run. 1721 1724 1725 1722 Arguments: 1726 Arguments: 1723 1727 1724 If arguments are given, the following possibilites exist: 1728 If arguments are given, the following possibilites exist: @@ -1917,6 +1921,7 Currently the magic system has the following functions:\n""" 1917 1921 1918 if use_temp: 1922 if use_temp: 1919 filename = self.shell.mktempfile(data) 1923 filename = self.shell.mktempfile(data) 1924 print 'IPython will make a temporary file named:',filename 1920 1925 1921 # do actual editing here 1926 # do actual editing here 1922 print 'Editing...', 1927 print 'Editing...',
 @@ -1,7 +1,7 1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*- 2 """Release data for the IPython project. 2 """Release data for the IPython project. 3 3 4 $Id: Release.py 994 2006-01-08 08:29:44Z fperez$""" 4 $Id: Release.py 1000 2006-01-10 08:06:04Z fperez$""" 5 5 6 #***************************************************************************** 6 #***************************************************************************** 7 # Copyright (C) 2001-2006 Fernando Perez 7 # Copyright (C) 2001-2006 Fernando Perez @@ -22,9 +22,9 name = 'ipython' 22 # because bdist_rpm does not accept dashes (an RPM) convention, and 22 # because bdist_rpm does not accept dashes (an RPM) convention, and 23 # bdist_deb does not accept underscores (a Debian convention). 23 # bdist_deb does not accept underscores (a Debian convention). 24 24 25 version = '0.7.0.rc8' 25 version = '0.7.0' 26 26 27 revision = '$Revision: 994$' 27 revision = '$Revision: 1000$' 28 28 29 description = "An enhanced interactive Python shell." 29 description = "An enhanced interactive Python shell." 30 30
 @@ -6,7 +6,7 Requires Python 2.1 or newer. 6 6 7 This file contains all the classes and helper functions specific to IPython. 7 This file contains all the classes and helper functions specific to IPython. 8 8 9 $Id: iplib.py 995 2006-01-08 16:23:20Z fperez$ 9 $Id: iplib.py 1000 2006-01-10 08:06:04Z fperez$ 10 """ 10 """ 11 11 12 #***************************************************************************** 12 #***************************************************************************** @@ -2033,7 +2033,7 want to merge them back into the new files.""" % locals() 2033 - data(None): if data is given, it gets written out to the temp file 2033 - data(None): if data is given, it gets written out to the temp file 2034 immediately, and the file is closed again.""" 2034 immediately, and the file is closed again.""" 2035 2035 2036 filename = tempfile.mktemp('.py') 2036 filename = tempfile.mktemp('.py','ipython_edit_') 2037 self.tempfiles.append(filename) 2037 self.tempfiles.append(filename) 2038 2038 2039 if data: 2039 if data:
 @@ -49,7 +49,7 49 \inputencoding latin1 49 \inputencoding latin1 50 \fontscheme palatino 50 \fontscheme palatino 51 \graphics default 51 \graphics default 52 \paperfontsize 10 52 \paperfontsize 11 53 \spacing single 53 \spacing single 54 \papersize Default 54 \papersize Default 55 \paperpackage a4 55 \paperpackage a4 @@ -58,9 +58,9 58 \use_natbib 0 58 \use_natbib 0 59 \use_numerical_citations 0 59 \use_numerical_citations 0 60 \paperorientation portrait 60 \paperorientation portrait 61 \leftmargin 1.1in 61 \leftmargin 1in 62 \topmargin 1in 62 \topmargin 1in 63 \rightmargin 1.1in 63 \rightmargin 1in 64 \bottommargin 1in 64 \bottommargin 1in 65 \secnumdepth 3 65 \secnumdepth 3 66 \tocdepth 3 66 \tocdepth 3 @@ -2234,63 +2234,6 Use your input history. 2234 code for your programs. 2234 code for your programs. 2235 \layout Itemize 2235 \layout Itemize 2236 2236 2237 Define your own macros with 2238 \family typewriter 2239 %macro 2240 \family default 2241 . 2242 This can be useful for automating sequences of expressions when working 2243 interactively. 2244 You can edit a macro (they are just Python variables holding your input 2245 as a string) by simply typing  2246 \family typewriter 2247 %edit macroname 2248 \family default 2249 ', and macros can be stored persistently across session with  2250 \family typewriter 2251 %store macroname 2252 \family default 2253 ' (the storage system is per-profile). 2254 The combination of quick macros, persistent storage and editing, allows 2255 you to easily refine quick-and-dirty interactive input into permanent utilities 2256 , always available both in IPython and as files for general reuse. 2257 \layout Itemize 2258 2259 While 2260 \family typewriter 2261 %macro 2262 \family default 2263 saves input lines into memory for interactive re-execution, sometimes you'd 2264 like to save your input directly to a file. 2265 The 2266 \family typewriter 2267 %save 2268 \family default 2269 magic does this: its input sytnax is the same as 2270 \family typewriter 2271 %macro 2272 \family default 2273 , but it saves your input directly to a Python file. 2274 Note that the 2275 \family typewriter 2276 %logstart 2277 \family default 2278 command also saves input, but it logs 2279 \emph on 2280 all 2281 \emph default 2282 input to disk (though you can temporarily suspend it and reactivate it 2283 with 2284 \family typewriter 2285 %logoff/%logon 2286 \family default 2287 ); 2288 \family typewriter 2289 %save 2290 \family default 2291 allows you to select which lines of input you need to save. 2292 \layout Itemize 2293 2294 Define your own system aliases. 2237 Define your own system aliases. 2295 Even though IPython gives you access to your system shell via the 2238 Even though IPython gives you access to your system shell via the 2296 \family typewriter 2239 \family typewriter @@ -2406,16 +2349,6 Use the Python profiler. 2406 calls). 2349 calls). 2407 \layout Itemize 2350 \layout Itemize 2408 2351 2409 Use 2410 \family typewriter 2411 %edit 2412 \family default 2413 to have almost multiline editing. 2414 While IPython doesn't support true multiline editing, this command allows 2415 you to call an editor on the spot, and IPython will execute the code you 2416 type in there as if it were typed interactively. 2417 \layout Itemize 2418 2419 Use the IPython.demo.Demo class to load any Python script as an interactive 2352 Use the IPython.demo.Demo class to load any Python script as an interactive 2420 demo. 2353 demo. 2421 With a minimal amount of simple markup, you can control the execution of 2354 With a minimal amount of simple markup, you can control the execution of @@ -2427,13 +2360,129 Use the IPython.demo.Demo class to load any Python script as an interactive 2427 \end_inset 2360 \end_inset 2428 2361 2429 for more. 2362 for more. 2363 \layout Subsection 2364 2365 Source code handling tips 2430 \layout Standard 2366 \layout Standard 2431 2367 2368 IPython is a line-oriented program, without full control of the terminal. 2369 Therefore, it doesn't support true multiline editing. 2370 However, it has a number of useful tools to help you in dealing effectively 2371 with more complex editing. 2372 \layout Standard 2432 2373 2433 \series bold 2374 The 2434 Effective logging: 2375 \family typewriter 2435 \series default 2376 %edit 2436 a very useful suggestion sent in by Robert Kern follows 2377 \family default 2378 command gives a reasonable approximation of multiline editing, by invoking 2379 your favorite editor on the spot. 2380 IPython will execute the code you type in there as if it were typed interactive 2381 ly. 2382 Type 2383 \family typewriter 2384 %edit? 2385 \family default 2386 for the full details on the edit command. 2387 \layout Standard 2388 2389 If you have typed various commands during a session, which you'd like to 2390 reuse, IPython provides you with a number of tools. 2391 Start by using 2392 \family typewriter 2393 %hist 2394 \family default 2395 to see your input history, so you can see the line numbers of all input. 2396 Let us say that you'd like to reuse lines 10 through 20, plus lines 24 2397 and 28. 2398 All the commands below can operate on these with the syntax 2399 \layout LyX-Code 2400 2401 %command 10-20 24 28 2402 \layout Standard 2403 2404 where the command given can be: 2405 \layout Itemize 2406 2407 2408 \family typewriter 2409 %macro 2410 \family default 2411 : this stores the lines into a variable which, when called at the prompt, 2412 re-executes the input. 2413 Macros can be edited later using 2414 \family typewriter 2415 %edit macroname 2416 \family default 2417 ', and they can be stored persistently across sessions with  2418 \family typewriter 2419 %store macroname 2420 \family default 2421 ' (the storage system is per-profile). 2422 The combination of quick macros, persistent storage and editing, allows 2423 you to easily refine quick-and-dirty interactive input into permanent utilities 2424 , always available both in IPython and as files for general reuse. 2425 \layout Itemize 2426 2427 2428 \family typewriter 2429 %edit 2430 \family default 2431 : this will open a text editor with those lines pre-loaded for further modificat 2432 ion. 2433 It will then execute the resulting file's contents as if you had typed 2434 it at the prompt. 2435 \layout Itemize 2436 2437 2438 \family typewriter 2439 %save 2440 \family default 2441 : this saves the lines directly to a named file on disk. 2442 \layout Standard 2443 2444 While 2445 \family typewriter 2446 %macro 2447 \family default 2448 saves input lines into memory for interactive re-execution, sometimes you'd 2449 like to save your input directly to a file. 2450 The 2451 \family typewriter 2452 %save 2453 \family default 2454 magic does this: its input sytnax is the same as 2455 \family typewriter 2456 %macro 2457 \family default 2458 , but it saves your input directly to a Python file. 2459 Note that the 2460 \family typewriter 2461 %logstart 2462 \family default 2463 command also saves input, but it logs 2464 \emph on 2465 all 2466 \emph default 2467 input to disk (though you can temporarily suspend it and reactivate it 2468 with 2469 \family typewriter 2470 %logoff/%logon 2471 \family default 2472 ); 2473 \family typewriter 2474 %save 2475 \family default 2476 allows you to select which lines of input you need to save. 2477 \layout Standard 2478 2479 And 2480 \layout Subsection 2481 2482 Effective logging 2483 \layout Standard 2484 2485 A very useful suggestion sent in by Robert Kern follows: 2437 \layout Standard 2486 \layout Standard 2438 2487 2439 I recently happened on a nifty way to keep tidy per-project log files. 2488 I recently happened on a nifty way to keep tidy per-project log files. @@ -8524,7 +8573,17 The current IPython system grew out of the following three projects: 8524 \layout List 8573 \layout List 8525 \labelwidthstring 00.00.0000 8574 \labelwidthstring 00.00.0000 8526 8575 8527 ipython by Fernando Pérez. 8576 ipython by Fernando P 8577 \begin_inset ERT 8578 status Collapsed 8579 8580 \layout Standard 8581 8582 \backslash 8583 '{e} 8584 \end_inset 8585 8586 rez. 8528 I was working on adding Mathematica-type prompts and a flexible configuration 8587 I was working on adding Mathematica-type prompts and a flexible configuration 8529 system (something better than 8588 system (something better than 8530 \family typewriter 8589 \family typewriter @@ -8576,10 +8635,10 The above listed features work, and quite well for the most part. 8576 and well localized in the cleaner parts of the code). 8635 and well localized in the cleaner parts of the code). 8577 \layout Standard 8636 \layout Standard 8578 8637 8579 IPython consists of some 12000 lines of pure python code, of which roughly 8638 IPython consists of some 18000 lines of pure python code, of which roughly 8580 50% are fairly clean. 8639 two thirds is reasonably clean. 8581 The other 50% are fragile, messy code which needs a massive restructuring 8640 The rest is, messy code which needs a massive restructuring before any 8582 before any further major work is done. 8641 further major work is done. 8583 Even the messy code is fairly well documented though, and most of the problems 8642 Even the messy code is fairly well documented though, and most of the problems 8584 in the (non-existent) class design are well pointed to by a PyChecker run. 8643 in the (non-existent) class design are well pointed to by a PyChecker run. 8585 So the rewriting work isn't that bad, it will just be time-consuming. 8644 So the rewriting work isn't that bad, it will just be time-consuming. @@ -8719,7 +8778,17 Versions of IPython up to and including 0.6.3 were released under the GNU 8719 Credits 8778 Credits 8720 \layout Standard 8779 \layout Standard 8721 8780 8722 IPython is mainly developed by Fernando Pérez 8781 IPython is mainly developed by Fernando P 8782 \begin_inset ERT 8783 status Collapsed 8784 8785 \layout Standard 8786 8787 \backslash 8788 '{e} 8789 \end_inset 8790 8791 rez 8723 \family typewriter 8792 \family typewriter 8724 8793 8725 \family default 8794 \family default @@ -8817,7 +8886,7 Ka-Ping Yee 8817 with a much nicer syntax than formatting through the '%' operator. 8886 with a much nicer syntax than formatting through the '%' operator. 8818 \layout Standard 8887 \layout Standard 8819 8888 8820 Arnd Bäcker 8889 Arnd Baecker 8821 \family typewriter 8890 \family typewriter 8822 8891 8823 \family default 8892 \family default @@ -9101,7 +9170,7 Drexler 9101 \labelwidthstring 00.00.0000 9170 \labelwidthstring 00.00.0000 9102 9171 9103 Gustavo\SpecialChar ~ 9172 Gustavo\SpecialChar ~ 9104 Córdova\SpecialChar ~ 9173 Cordova\SpecialChar ~ 9105 Avila 9174 Avila 9106 \family typewriter 9175 \family typewriter 9107 9176