Show More
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Magic functions for InteractiveShell. |
|
2 | """Magic functions for InteractiveShell. | |
3 |
|
3 | |||
4 |
$Id: Magic.py |
|
4 | $Id: Magic.py 1000 2006-01-10 08:06:04Z fperez $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and | |
@@ -250,7 +250,9 b' 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<cmd>}',strng) |
|
256 | strng = cmd_re.sub(r'\\texttt{\g<cmd>}',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 b' 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 b' 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 b' 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 b'' | |||||
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 |
|
4 | $Id: Release.py 1000 2006-01-10 08:06:04Z fperez $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> |
|
7 | # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu> | |
@@ -22,9 +22,9 b" 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 |
|
25 | version = '0.7.0' | |
26 |
|
26 | |||
27 |
revision = '$Revision: |
|
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 b' 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 |
|
9 | $Id: iplib.py 1000 2006-01-10 08:06:04Z fperez $ | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
@@ -2033,7 +2033,7 b' 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: |
@@ -1,3 +1,13 b'' | |||||
|
1 | 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu> | |||
|
2 | ||||
|
3 | * IPython/Release.py (revision): tag version number to 0.7.0, | |||
|
4 | ready for release. | |||
|
5 | ||||
|
6 | * IPython/Magic.py (magic_edit): Add print statement to %edit so | |||
|
7 | it informs the user of the name of the temp. file used. This can | |||
|
8 | help if you decide later to reuse that same file, so you know | |||
|
9 | where to copy the info from. | |||
|
10 | ||||
1 | 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu> |
|
11 | 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu> | |
2 |
|
12 | |||
3 | * setup_bdist_egg.py: little script to build an egg. Added |
|
13 | * setup_bdist_egg.py: little script to build an egg. Added |
@@ -49,7 +49,7 b'' | |||||
49 | \inputencoding latin1 |
|
49 | \inputencoding latin1 | |
50 | \fontscheme palatino |
|
50 | \fontscheme palatino | |
51 | \graphics default |
|
51 | \graphics default | |
52 |
\paperfontsize 1 |
|
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 b'' | |||||
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 |
|
61 | \leftmargin 1in | |
62 | \topmargin 1in |
|
62 | \topmargin 1in | |
63 |
\rightmargin 1 |
|
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 b' 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 b' 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 b' 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 <macroname> | |||
|
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 <filename> | |||
|
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 b' 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 |
|
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 b' 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 1 |
|
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 |
|
8640 | The rest is, messy code which needs a massive restructuring before any | |
8582 |
|
|
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 b' 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 |
|
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 | <fperez@colorado.edu> |
|
8793 | <fperez@colorado.edu> | |
8725 | \family default |
|
8794 | \family default | |
@@ -8817,7 +8886,7 b' 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 |
|
8889 | Arnd Baecker | |
8821 | \family typewriter |
|
8890 | \family typewriter | |
8822 | <baecker-AT-physik.tu-dresden.de> |
|
8891 | <baecker-AT-physik.tu-dresden.de> | |
8823 | \family default |
|
8892 | \family default | |
@@ -9101,7 +9170,7 b' Drexler' | |||||
9101 | \labelwidthstring 00.00.0000 |
|
9170 | \labelwidthstring 00.00.0000 | |
9102 |
|
9171 | |||
9103 | Gustavo\SpecialChar ~ |
|
9172 | Gustavo\SpecialChar ~ | |
9104 |
C |
|
9173 | Cordova\SpecialChar ~ | |
9105 | Avila |
|
9174 | Avila | |
9106 | \family typewriter |
|
9175 | \family typewriter | |
9107 | <gcordova-AT-sismex.com> |
|
9176 | <gcordova-AT-sismex.com> |
@@ -1,11 +1,19 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 |
""" |
|
2 | """Wrapper to build IPython as an egg (setuptools format).""" | |
3 |
|
3 | |||
|
4 | import os | |||
4 | import sys |
|
5 | import sys | |
5 |
|
6 | |||
6 | import pkg_resources |
|
7 | # Add my local path to sys.path | |
7 | pkg_resources.require("setuptools") |
|
8 | home = os.environ['HOME'] | |
|
9 | sys.path.insert(0,'%s/usr/local/lib/python%s/site-packages' % | |||
|
10 | (home,sys.version[:3])) | |||
|
11 | ||||
|
12 | # now, import setuptools and build the actual egg | |||
8 | import setuptools |
|
13 | import setuptools | |
9 |
|
14 | |||
10 | sys.argv=['','bdist_egg'] |
|
15 | sys.argv=['','bdist_egg'] | |
11 | execfile('setup.py') |
|
16 | execfile('setup.py') | |
|
17 | ||||
|
18 | # clean up the junk left around by setuptools | |||
|
19 | os.system('rm -rf ipython.egg-info') |
General Comments 0
You need to be logged in to leave comments.
Login now