Show More
1 | NO CONTENT: file renamed from docs/source/parallel/parallel_task_old.txt to docs/source/attic/parallel_task_old.txt |
|
NO CONTENT: file renamed from docs/source/parallel/parallel_task_old.txt to docs/source/attic/parallel_task_old.txt |
@@ -1,7 +1,6 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | # |
|
2 | # | |
3 |
# IPython documentation build configuration file |
|
3 | # IPython documentation build configuration file. | |
4 | # sphinx-quickstart on Thu May 8 16:45:02 2008. |
|
|||
5 |
|
4 | |||
6 | # NOTE: This file has been edited manually from the auto-generated one from |
|
5 | # NOTE: This file has been edited manually from the auto-generated one from | |
7 | # sphinx. Do NOT delete and re-generate. If any changes from sphinx are |
|
6 | # sphinx. Do NOT delete and re-generate. If any changes from sphinx are | |
@@ -21,7 +20,11 import sys, os | |||||
21 | # If your extensions are in another directory, add it here. If the directory |
|
20 | # If your extensions are in another directory, add it here. If the directory | |
22 | # is relative to the documentation root, use os.path.abspath to make it |
|
21 | # is relative to the documentation root, use os.path.abspath to make it | |
23 | # absolute, like shown here. |
|
22 | # absolute, like shown here. | |
24 |
|
|
23 | sys.path.append(os.path.abspath('../sphinxext')) | |
|
24 | ||||
|
25 | # Import support for ipython console session syntax highlighting (lives | |||
|
26 | # in the sphinxext directory defined above) | |||
|
27 | import ipython_console_highlighting | |||
25 |
|
28 | |||
26 | # We load the ipython release info into a dict by explicit execution |
|
29 | # We load the ipython release info into a dict by explicit execution | |
27 | iprelease = {} |
|
30 | iprelease = {} | |
@@ -32,7 +35,10 execfile('../../IPython/Release.py',iprelease) | |||||
32 |
|
35 | |||
33 | # Add any Sphinx extension module names here, as strings. They can be extensions |
|
36 | # Add any Sphinx extension module names here, as strings. They can be extensions | |
34 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. |
|
37 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. | |
35 | #extensions = [] |
|
38 | extensions = ['sphinx.ext.autodoc', | |
|
39 | 'inheritance_diagram', 'only_directives', 'plot_directive', | |||
|
40 | 'ipython_console_highlighting', | |||
|
41 | ] | |||
36 |
|
42 | |||
37 | # Add any paths that contain templates here, relative to this directory. |
|
43 | # Add any paths that contain templates here, relative to this directory. | |
38 | templates_path = ['_templates'] |
|
44 | templates_path = ['_templates'] | |
@@ -67,7 +73,7 today_fmt = '%B %d, %Y' | |||||
67 |
|
73 | |||
68 | # List of directories, relative to source directories, that shouldn't be searched |
|
74 | # List of directories, relative to source directories, that shouldn't be searched | |
69 | # for source files. |
|
75 | # for source files. | |
70 |
|
|
76 | exclude_dirs = ['attic'] | |
71 |
|
77 | |||
72 | # If true, '()' will be appended to :func: etc. cross-reference text. |
|
78 | # If true, '()' will be appended to :func: etc. cross-reference text. | |
73 | #add_function_parentheses = True |
|
79 | #add_function_parentheses = True | |
@@ -135,7 +141,7 html_last_updated_fmt = '%b %d, %Y' | |||||
135 | #html_file_suffix = '' |
|
141 | #html_file_suffix = '' | |
136 |
|
142 | |||
137 | # Output file base name for HTML help builder. |
|
143 | # Output file base name for HTML help builder. | |
138 |
htmlhelp_basename = ' |
|
144 | htmlhelp_basename = 'ipythondoc' | |
139 |
|
145 | |||
140 |
|
146 | |||
141 | # Options for LaTeX output |
|
147 | # Options for LaTeX output | |
@@ -173,5 +179,8 latex_documents = [ ('index', 'ipython.tex', 'IPython Documentation', | |||||
173 | #latex_use_modindex = True |
|
179 | #latex_use_modindex = True | |
174 |
|
180 | |||
175 |
|
181 | |||
176 | # Cleanup: delete release info to avoid pickling errors from sphinx |
|
182 | # Cleanup | |
|
183 | # ------- | |||
|
184 | # delete release info to avoid pickling errors from sphinx | |||
|
185 | ||||
177 | del iprelease |
|
186 | del iprelease |
@@ -18,6 +18,8 time. A hybrid approach of specifying a few options in ipythonrc and | |||||
18 | doing the more advanced configuration in ipy_user_conf.py is also |
|
18 | doing the more advanced configuration in ipy_user_conf.py is also | |
19 | possible. |
|
19 | possible. | |
20 |
|
20 | |||
|
21 | .. _ipythonrc: | |||
|
22 | ||||
21 | The ipythonrc approach |
|
23 | The ipythonrc approach | |
22 | ====================== |
|
24 | ====================== | |
23 |
|
25 | |||
@@ -36,11 +38,11 fairly primitive). Note that these are not python files, and this is | |||||
36 | deliberate, because it allows us to do some things which would be quite |
|
38 | deliberate, because it allows us to do some things which would be quite | |
37 | tricky to implement if they were normal python files. |
|
39 | tricky to implement if they were normal python files. | |
38 |
|
40 | |||
39 | First, an rcfile can contain permanent default values for almost all |
|
41 | First, an rcfile can contain permanent default values for almost all command | |
40 |
|
|
42 | line options (except things like -help or -Version). :ref:`This section | |
41 |
|
|
43 | <command_line_options>` contains a description of all command-line | |
42 | options. However, values you explicitly specify at the command line |
|
44 | options. However, values you explicitly specify at the command line override | |
43 |
|
|
45 | the values defined in the rcfile. | |
44 |
|
46 | |||
45 | Besides command line option values, the rcfile can specify values for |
|
47 | Besides command line option values, the rcfile can specify values for | |
46 | certain extra special options which are not available at the command |
|
48 | certain extra special options which are not available at the command | |
@@ -266,13 +268,13 which look like this:: | |||||
266 | IPython profiles |
|
268 | IPython profiles | |
267 | ================ |
|
269 | ================ | |
268 |
|
270 | |||
269 | As we already mentioned, IPython supports the -profile command-line |
|
271 | As we already mentioned, IPython supports the -profile command-line option (see | |
270 |
|
|
272 | :ref:`here <command_line_options>`). A profile is nothing more than a | |
271 |
|
|
273 | particular configuration file like your basic ipythonrc one, but with | |
272 |
|
|
274 | particular customizations for a specific purpose. When you start IPython with | |
273 |
|
|
275 | 'ipython -profile <name>', it assumes that in your IPYTHONDIR there is a file | |
274 | IPYTHONDIR there is a file called ipythonrc-<name> or |
|
276 | called ipythonrc-<name> or ipy_profile_<name>.py, and loads it instead of the | |
275 | ipy_profile_<name>.py, and loads it instead of the normal ipythonrc. |
|
277 | normal ipythonrc. | |
276 |
|
278 | |||
277 | This system allows you to maintain multiple configurations which load |
|
279 | This system allows you to maintain multiple configurations which load | |
278 | modules, set options, define functions, etc. suitable for different |
|
280 | modules, set options, define functions, etc. suitable for different |
@@ -11,28 +11,27 in a directory named by default $HOME/.ipython. You can change this by | |||||
11 | defining the environment variable IPYTHONDIR, or at runtime with the |
|
11 | defining the environment variable IPYTHONDIR, or at runtime with the | |
12 | command line option -ipythondir. |
|
12 | command line option -ipythondir. | |
13 |
|
13 | |||
14 | If all goes well, the first time you run IPython it should |
|
14 | If all goes well, the first time you run IPython it should automatically create | |
15 |
|
|
15 | a user copy of the config directory for you, based on its builtin defaults. You | |
16 | based on its builtin defaults. You can look at the files it creates to |
|
16 | can look at the files it creates to learn more about configuring the | |
17 | learn more about configuring the system. The main file you will modify |
|
17 | system. The main file you will modify to configure IPython's behavior is called | |
18 | to configure IPython's behavior is called ipythonrc (with a .ini |
|
18 | ipythonrc (with a .ini extension under Windows), included for reference | |
19 | extension under Windows), included for reference in `ipythonrc`_ |
|
19 | :ref:`here <ipythonrc>`. This file is very commented and has many variables you | |
20 | section. This file is very commented and has many variables you can |
|
20 | can change to suit your taste, you can find more details :ref:`here | |
21 | change to suit your taste, you can find more details in |
|
21 | <customization>`. Here we discuss the basic things you will want to make sure | |
22 | Sec. customization_. Here we discuss the basic things you will want to |
|
22 | things are working properly from the beginning. | |
23 | make sure things are working properly from the beginning. |
|
|||
24 |
|
23 | |||
25 |
|
24 | |||
26 |
.. _ |
|
25 | .. _accessing_help: | |
27 |
|
26 | |||
28 | Access to the Python help system |
|
27 | Access to the Python help system | |
29 | ================================ |
|
28 | ================================ | |
30 |
|
29 | |||
31 | This is true for Python in general (not just for IPython): you should |
|
30 | This is true for Python in general (not just for IPython): you should have an | |
32 |
|
|
31 | environment variable called PYTHONDOCS pointing to the directory where your | |
33 |
|
|
32 | HTML Python documentation lives. In my system it's | |
34 |
/usr/share/doc/python-doc |
|
33 | :file:`/usr/share/doc/python-doc/html`, check your local details or ask your | |
35 |
|
|
34 | systems administrator. | |
36 |
|
35 | |||
37 | This is the directory which holds the HTML version of the Python |
|
36 | This is the directory which holds the HTML version of the Python | |
38 | manuals. Unfortunately it seems that different Linux distributions |
|
37 | manuals. Unfortunately it seems that different Linux distributions | |
@@ -40,8 +39,9 package these files differently, so you may have to look around a bit. | |||||
40 | Below I show the contents of this directory on my system for reference:: |
|
39 | Below I show the contents of this directory on my system for reference:: | |
41 |
|
40 | |||
42 | [html]> ls |
|
41 | [html]> ls | |
43 | about.dat acks.html dist/ ext/ index.html lib/ modindex.html |
|
42 | about.html dist/ icons/ lib/ python2.5.devhelp.gz whatsnew/ | |
44 | stdabout.dat tut/ about.html api/ doc/ icons/ inst/ mac/ ref/ style.css |
|
43 | acks.html doc/ index.html mac/ ref/ | |
|
44 | api/ ext/ inst/ modindex.html tut/ | |||
45 |
|
45 | |||
46 | You should really make sure this variable is correctly set so that |
|
46 | You should really make sure this variable is correctly set so that | |
47 | Python's pydoc-based help system works. It is a powerful and convenient |
|
47 | Python's pydoc-based help system works. It is a powerful and convenient | |
@@ -108,6 +108,8 The following terminals seem to handle the color sequences fine: | |||||
108 | support under cygwin, please post to the IPython mailing list so |
|
108 | support under cygwin, please post to the IPython mailing list so | |
109 | this issue can be resolved for all users. |
|
109 | this issue can be resolved for all users. | |
110 |
|
110 | |||
|
111 | .. _pyreadline: https://code.launchpad.net/pyreadline | |||
|
112 | ||||
111 | These have shown problems: |
|
113 | These have shown problems: | |
112 |
|
114 | |||
113 | * Windows command prompt in WinXP/2k logged into a Linux machine via |
|
115 | * Windows command prompt in WinXP/2k logged into a Linux machine via | |
@@ -157,13 +159,12 $HOME/.ipython/ipythonrc and set the colors option to the desired value. | |||||
157 | Object details (types, docstrings, source code, etc.) |
|
159 | Object details (types, docstrings, source code, etc.) | |
158 | ===================================================== |
|
160 | ===================================================== | |
159 |
|
161 | |||
160 | IPython has a set of special functions for studying the objects you |
|
162 | IPython has a set of special functions for studying the objects you are working | |
161 | are working with, discussed in detail in Sec. `dynamic object |
|
163 | with, discussed in detail :ref:`here <dynamic_object_info>`. But this system | |
162 | information`_. But this system relies on passing information which is |
|
164 | relies on passing information which is longer than your screen through a data | |
163 | longer than your screen through a data pager, such as the common Unix |
|
165 | pager, such as the common Unix less and more programs. In order to be able to | |
164 | less and more programs. In order to be able to see this information in |
|
166 | see this information in color, your pager needs to be properly configured. I | |
165 | color, your pager needs to be properly configured. I strongly |
|
167 | strongly recommend using less instead of more, as it seems that more simply can | |
166 | recommend using less instead of more, as it seems that more simply can |
|
|||
167 | not understand colored text correctly. |
|
168 | not understand colored text correctly. | |
168 |
|
169 | |||
169 | In order to configure less as your default pager, do the following: |
|
170 | In order to configure less as your default pager, do the following: |
@@ -357,15 +357,19 This section outlines the various scenarios that we need to test before we relea | |||||
357 | Installation scenarios under Linux and OS X |
|
357 | Installation scenarios under Linux and OS X | |
358 | ------------------------------------------- |
|
358 | ------------------------------------------- | |
359 |
|
359 | |||
360 | 1. Install from tarball using `python setup.py install`. |
|
360 | 1. Install from tarball using ``python setup.py install``. | |
361 | a. With only readline+nose dependencies installed. |
|
361 | a. With only readline+nose dependencies installed. | |
362 | b. With all dependencies installed (readline, zope.interface, |
|
362 | b. With all dependencies installed (readline, zope.interface, Twisted, | |
363 |
|
|
363 | foolscap, Sphinx, nose, pyOpenSSL). | |
|
364 | ||||
364 | 2. Install using easy_install. |
|
365 | 2. Install using easy_install. | |
|
366 | ||||
365 | a. With only readline+nose dependencies installed. |
|
367 | a. With only readline+nose dependencies installed. | |
366 | i. Default dependencies: `easy_install ipython-0.9.beta3-py2.5.egg` |
|
368 | i. Default dependencies: ``easy_install ipython-0.9.beta3-py2.5.egg`` | |
367 | ii. Optional dependency sets: `easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]` |
|
369 | ii. Optional dependency sets: ``easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]`` | |
|
370 | ||||
368 | b. With all dependencies already installed. |
|
371 | b. With all dependencies already installed. | |
|
372 | ||||
369 |
|
373 | |||
370 | Installation scenarios under Win32 |
|
374 | Installation scenarios under Win32 | |
371 | ---------------------------------- |
|
375 | ---------------------------------- | |
@@ -381,6 +385,7 Tests to run for these scenarios | |||||
381 | 2. Start a controller and engines and try a few things by hand. |
|
385 | 2. Start a controller and engines and try a few things by hand. | |
382 | a. Using ipcluster. |
|
386 | a. Using ipcluster. | |
383 | b. Using ipcontroller/ipengine by hand. |
|
387 | b. Using ipcontroller/ipengine by hand. | |
|
388 | ||||
384 | 3. Run a few of the parallel examples. |
|
389 | 3. Run a few of the parallel examples. | |
385 | 4. Try the kernel with and without security with and without PyOpenSSL |
|
390 | 4. Try the kernel with and without security with and without PyOpenSSL | |
386 | installed. |
|
391 | installed. |
@@ -8,7 +8,7 IPython reference | |||||
8 |
|
8 | |||
9 | .. contents:: |
|
9 | .. contents:: | |
10 |
|
10 | |||
11 |
.. _ |
|
11 | .. _command_line_options: | |
12 |
|
12 | |||
13 | Command-line usage |
|
13 | Command-line usage | |
14 | ================== |
|
14 | ================== | |
@@ -288,12 +288,13 All options with a [no] prepended can be specified in negated form | |||||
288 | recursive inclusions. |
|
288 | recursive inclusions. | |
289 |
|
289 | |||
290 | -prompt_in1, pi1 <string> |
|
290 | -prompt_in1, pi1 <string> | |
291 | Specify the string used for input prompts. Note that if you |
|
291 | ||
292 | are using numbered prompts, the number is represented with a |
|
292 | Specify the string used for input prompts. Note that if you are using | |
293 | '\#' in the string. Don't forget to quote strings with spaces |
|
293 | numbered prompts, the number is represented with a '\#' in the | |
294 | embedded in them. Default: 'In [\#]:'. Sec. Prompts_ |
|
294 | string. Don't forget to quote strings with spaces embedded in | |
295 | discusses in detail all the available escapes to customize |
|
295 | them. Default: 'In [\#]:'. The :ref:`prompts section <prompts>` | |
296 | your prompts. |
|
296 | discusses in detail all the available escapes to customize your | |
|
297 | prompts. | |||
297 |
|
298 | |||
298 | -prompt_in2, pi2 <string> |
|
299 | -prompt_in2, pi2 <string> | |
299 | Similar to the previous option, but used for the continuation |
|
300 | Similar to the previous option, but used for the continuation | |
@@ -2077,13 +2078,14 customizations. | |||||
2077 | Access to the standard Python help |
|
2078 | Access to the standard Python help | |
2078 | ---------------------------------- |
|
2079 | ---------------------------------- | |
2079 |
|
2080 | |||
2080 | As of Python 2.1, a help system is available with access to object |
|
2081 | As of Python 2.1, a help system is available with access to object docstrings | |
2081 |
|
|
2082 | and the Python manuals. Simply type 'help' (no quotes) to access it. You can | |
2082 |
|
|
2083 | also type help(object) to obtain information about a given object, and | |
2083 |
|
|
2084 | help('keyword') for information on a keyword. As noted :ref:`here | |
2084 |
|
|
2085 | <accessing_help>`, you need to properly configure your environment variable | |
2085 |
|
|
2086 | PYTHONDOCS for this feature to work correctly. | |
2086 |
|
2087 | |||
|
2088 | .. _dynamic_object_info: | |||
2087 |
|
2089 | |||
2088 | Dynamic object information |
|
2090 | Dynamic object information | |
2089 | -------------------------- |
|
2091 | -------------------------- | |
@@ -2126,7 +2128,7 are not really defined as separate identifiers. Try for example typing | |||||
2126 | {}.get? or after doing import os, type os.path.abspath??. |
|
2128 | {}.get? or after doing import os, type os.path.abspath??. | |
2127 |
|
2129 | |||
2128 |
|
2130 | |||
2129 |
.. _ |
|
2131 | .. _readline: | |
2130 |
|
2132 | |||
2131 | Readline-based features |
|
2133 | Readline-based features | |
2132 | ----------------------- |
|
2134 | ----------------------- | |
@@ -2240,10 +2242,9 explanation in your ipythonrc file. | |||||
2240 | Session logging and restoring |
|
2242 | Session logging and restoring | |
2241 | ----------------------------- |
|
2243 | ----------------------------- | |
2242 |
|
2244 | |||
2243 | You can log all input from a session either by starting IPython with |
|
2245 | You can log all input from a session either by starting IPython with the | |
2244 |
|
|
2246 | command line switches -log or -logfile (see :ref:`here <command_line_options>`) | |
2245 |
|
|
2247 | or by activating the logging at any moment with the magic function %logstart. | |
2246 | function %logstart. |
|
|||
2247 |
|
2248 | |||
2248 | Log files can later be reloaded with the -logplay option and IPython |
|
2249 | Log files can later be reloaded with the -logplay option and IPython | |
2249 | will attempt to 'replay' the log by executing all the lines in it, thus |
|
2250 | will attempt to 'replay' the log by executing all the lines in it, thus | |
@@ -2279,6 +2280,8 resume logging to a file which had previously been started with | |||||
2279 | %logstart. They will fail (with an explanation) if you try to use them |
|
2280 | %logstart. They will fail (with an explanation) if you try to use them | |
2280 | before logging has been started. |
|
2281 | before logging has been started. | |
2281 |
|
2282 | |||
|
2283 | .. _system_shell_access: | |||
|
2284 | ||||
2282 | System shell access |
|
2285 | System shell access | |
2283 | ------------------- |
|
2286 | ------------------- | |
2284 |
|
2287 | |||
@@ -2389,7 +2392,7 These features are basically a terminal version of Ka-Ping Yee's cgitb | |||||
2389 | module, now part of the standard Python library. |
|
2392 | module, now part of the standard Python library. | |
2390 |
|
2393 | |||
2391 |
|
2394 | |||
2392 |
.. _ |
|
2395 | .. _input_caching: | |
2393 |
|
2396 | |||
2394 | Input caching system |
|
2397 | Input caching system | |
2395 | -------------------- |
|
2398 | -------------------- | |
@@ -2429,7 +2432,7 sec. 6.2 <#sec:magic> for more details on the macro system. | |||||
2429 | A history function %hist allows you to see any part of your input |
|
2432 | A history function %hist allows you to see any part of your input | |
2430 | history by printing a range of the _i variables. |
|
2433 | history by printing a range of the _i variables. | |
2431 |
|
2434 | |||
2432 |
.. _ |
|
2435 | .. _output_caching: | |
2433 |
|
2436 | |||
2434 | Output caching system |
|
2437 | Output caching system | |
2435 | --------------------- |
|
2438 | --------------------- | |
@@ -3034,7 +3037,7 which is being shared by the interactive IPython loop and your GUI | |||||
3034 | thread, you should really handle it with thread locking and |
|
3037 | thread, you should really handle it with thread locking and | |
3035 | syncrhonization properties. The Python documentation discusses these. |
|
3038 | syncrhonization properties. The Python documentation discusses these. | |
3036 |
|
3039 | |||
3037 |
.. _ |
|
3040 | .. _interactive_demos: | |
3038 |
|
3041 | |||
3039 | Interactive demos with IPython |
|
3042 | Interactive demos with IPython | |
3040 | ============================== |
|
3043 | ============================== | |
@@ -3143,21 +3146,17 toolkits, including Tk, GTK and WXPython. It also provides a number of | |||||
3143 | commands useful for scientific computing, all with a syntax compatible |
|
3146 | commands useful for scientific computing, all with a syntax compatible | |
3144 | with that of the popular Matlab program. |
|
3147 | with that of the popular Matlab program. | |
3145 |
|
3148 | |||
3146 |
IPython accepts the special option -pylab ( |
|
3149 | IPython accepts the special option -pylab (see :ref:`here | |
3147 |
options` |
|
3150 | <command_line_options>`). This configures it to support matplotlib, honoring | |
3148 | settings in the .matplotlibrc file. IPython will detect the user's |
|
3151 | the settings in the .matplotlibrc file. IPython will detect the user's choice | |
3149 |
|
|
3152 | of matplotlib GUI backend, and automatically select the proper threading model | |
3150 |
|
|
3153 | to prevent blocking. It also sets matplotlib in interactive mode and modifies | |
3151 | interactive mode and modifies %run slightly, so that any |
|
3154 | %run slightly, so that any matplotlib-based script can be executed using %run | |
3152 | matplotlib-based script can be executed using %run and the final |
|
3155 | and the final show() command does not block the interactive shell. | |
3153 | show() command does not block the interactive shell. |
|
3156 | ||
3154 |
|
3157 | The -pylab option must be given first in order for IPython to configure its | ||
3155 | The -pylab option must be given first in order for IPython to |
|
3158 | threading mode. However, you can still issue other options afterwards. This | |
3156 | configure its threading mode. However, you can still issue other |
|
3159 | allows you to have a matplotlib-based environment customized with additional | |
3157 | options afterwards. This allows you to have a matplotlib-based |
|
3160 | modules using the standard IPython profile mechanism (see :ref:`here | |
3158 | environment customized with additional modules using the standard |
|
3161 | <profiles>`): ``ipython -pylab -p myprofile`` will load the profile defined in | |
3159 | IPython profile mechanism (Sec. Profiles_): ''ipython -pylab -p |
|
3162 | ipythonrc-myprofile after configuring matplotlib. | |
3160 | myprofile'' will load the profile defined in ipythonrc-myprofile after |
|
|||
3161 | configuring matplotlib. |
|
|||
3162 |
|
||||
3163 |
|
@@ -24,11 +24,11 Tab completion | |||||
24 | -------------- |
|
24 | -------------- | |
25 |
|
25 | |||
26 | TAB-completion, especially for attributes, is a convenient way to explore the |
|
26 | TAB-completion, especially for attributes, is a convenient way to explore the | |
27 | structure of any object you're dealing with. Simply type object_name.<TAB> |
|
27 | structure of any object you're dealing with. Simply type object_name.<TAB> and | |
28 |
|
|
28 | a list of the object's attributes will be printed (see :ref:`the readline | |
29 |
more). Tab completion also works on file and directory |
|
29 | section <readline>` for more). Tab completion also works on file and directory | |
30 |
with IPython's alias system allows you to do from within |
|
30 | names, which combined with IPython's alias system allows you to do from within | |
31 | things you normally would need the system shell for. |
|
31 | IPython many of the things you normally would need the system shell for. | |
32 |
|
32 | |||
33 | Explore your objects |
|
33 | Explore your objects | |
34 | -------------------- |
|
34 | -------------------- | |
@@ -39,18 +39,18 constructor details for classes. The magic commands %pdoc, %pdef, %psource | |||||
39 | and %pfile will respectively print the docstring, function definition line, |
|
39 | and %pfile will respectively print the docstring, function definition line, | |
40 | full source code and the complete file for any object (when they can be |
|
40 | full source code and the complete file for any object (when they can be | |
41 | found). If automagic is on (it is by default), you don't need to type the '%' |
|
41 | found). If automagic is on (it is by default), you don't need to type the '%' | |
42 |
explicitly. See |
|
42 | explicitly. See :ref:`this section <dynamic_object_info>` for more. | |
43 |
|
43 | |||
44 | The `%run` magic command |
|
44 | The `%run` magic command | |
45 | ------------------------ |
|
45 | ------------------------ | |
46 |
|
46 | |||
47 | The %run magic command allows you to run any python script and load all of |
|
47 | The %run magic command allows you to run any python script and load all of its | |
48 |
|
|
48 | data directly into the interactive namespace. Since the file is re-read from | |
49 |
|
|
49 | disk each time, changes you make to it are reflected immediately (in contrast | |
50 |
|
|
50 | to the behavior of import). I rarely use import for code I am testing, relying | |
51 |
|
|
51 | on %run instead. See :ref:`this section <magic>` for more on this and other | |
52 |
|
|
52 | magic commands, or type the name of any magic command and ? to get details on | |
53 |
|
|
53 | it. See also :ref:`this section <dreload>` for a recursive reload command. %run | |
54 | also has special flags for timing the execution of your scripts (-t) and for |
|
54 | also has special flags for timing the execution of your scripts (-t) and for | |
55 | executing them under the control of either Python's pdb debugger (-d) or |
|
55 | executing them under the control of either Python's pdb debugger (-d) or | |
56 | profiler (-p). With all of these, %run can be used as the main tool for |
|
56 | profiler (-p). With all of these, %run can be used as the main tool for | |
@@ -60,21 +60,21 choice. | |||||
60 | Debug a Python script |
|
60 | Debug a Python script | |
61 | --------------------- |
|
61 | --------------------- | |
62 |
|
62 | |||
63 | Use the Python debugger, pdb. The %pdb command allows you to toggle on and |
|
63 | Use the Python debugger, pdb. The %pdb command allows you to toggle on and off | |
64 |
|
|
64 | the automatic invocation of an IPython-enhanced pdb debugger (with coloring, | |
65 |
|
|
65 | tab completion and more) at any uncaught exception. The advantage of this is | |
66 |
|
|
66 | that pdb starts inside the function where the exception occurred, with all data | |
67 |
|
|
67 | still available. You can print variables, see code, execute statements and even | |
68 |
|
|
68 | walk up and down the call stack to track down the true source of the problem | |
69 |
|
|
69 | (which often is many layers in the stack above where the exception gets | |
70 |
|
|
70 | triggered). Running programs with %run and pdb active can be an efficient to | |
71 |
|
|
71 | develop and debug code, in many cases eliminating the need for print statements | |
72 |
|
|
72 | or external debugging tools. I often simply put a 1/0 in a place where I want | |
73 |
|
|
73 | to take a look so that pdb gets called, quickly view whatever variables I need | |
74 |
|
|
74 | to or test various pieces of code and then remove the 1/0. Note also that '%run | |
75 | the 1/0. Note also that '%run -d' activates pdb and automatically sets |
|
75 | -d' activates pdb and automatically sets initial breakpoints for you to step | |
76 | initial breakpoints for you to step through your code, watch variables, etc. |
|
76 | through your code, watch variables, etc. The :ref:`output caching section | |
77 |
|
|
77 | <output_caching>` has more details. | |
78 |
|
78 | |||
79 | Use the output cache |
|
79 | Use the output cache | |
80 | -------------------- |
|
80 | -------------------- | |
@@ -84,7 +84,8 and variables named _1, _2, etc. alias them. For example, the result of input | |||||
84 | line 4 is available either as Out[4] or as _4. Additionally, three variables |
|
84 | line 4 is available either as Out[4] or as _4. Additionally, three variables | |
85 | named _, __ and ___ are always kept updated with the for the last three |
|
85 | named _, __ and ___ are always kept updated with the for the last three | |
86 | results. This allows you to recall any previous result and further use it for |
|
86 | results. This allows you to recall any previous result and further use it for | |
87 |
new calculations. See |
|
87 | new calculations. See :ref:`the output caching section <output_caching>` for | |
|
88 | more. | |||
88 |
|
89 | |||
89 | Suppress output |
|
90 | Suppress output | |
90 | --------------- |
|
91 | --------------- | |
@@ -102,7 +103,7 A similar system exists for caching input. All input is stored in a global | |||||
102 | list called In , so you can re-execute lines 22 through 28 plus line 34 by |
|
103 | list called In , so you can re-execute lines 22 through 28 plus line 34 by | |
103 | typing 'exec In[22:29]+In[34]' (using Python slicing notation). If you need |
|
104 | typing 'exec In[22:29]+In[34]' (using Python slicing notation). If you need | |
104 | to execute the same set of lines often, you can assign them to a macro with |
|
105 | to execute the same set of lines often, you can assign them to a macro with | |
105 |
the %macro function. See |
|
106 | the %macro function. See :ref:`here <input_caching>` for more. | |
106 |
|
107 | |||
107 | Use your input history |
|
108 | Use your input history | |
108 | ---------------------- |
|
109 | ---------------------- | |
@@ -134,17 +135,18 into Python variables. | |||||
134 | Use Python variables when calling the shell |
|
135 | Use Python variables when calling the shell | |
135 | ------------------------------------------- |
|
136 | ------------------------------------------- | |
136 |
|
137 | |||
137 | Expand python variables when calling the shell (either via '!' and '!!' or |
|
138 | Expand python variables when calling the shell (either via '!' and '!!' or via | |
138 |
|
|
139 | aliases) by prepending a $ in front of them. You can also expand complete | |
139 |
python expressions. See |
|
140 | python expressions. See :ref:`our shell section <system_shell_access>` for | |
|
141 | more details. | |||
140 |
|
142 | |||
141 | Use profiles |
|
143 | Use profiles | |
142 | ------------ |
|
144 | ------------ | |
143 |
|
145 | |||
144 | Use profiles to maintain different configurations (modules to load, function |
|
146 | Use profiles to maintain different configurations (modules to load, function | |
145 | definitions, option settings) for particular tasks. You can then have |
|
147 | definitions, option settings) for particular tasks. You can then have | |
146 |
customized versions of IPython for specific purposes. |
|
148 | customized versions of IPython for specific purposes. :ref:`This section | |
147 | more. |
|
149 | <profiles>` has more details. | |
148 |
|
150 | |||
149 |
|
151 | |||
150 | Embed IPython in your programs |
|
152 | Embed IPython in your programs | |
@@ -152,7 +154,7 Embed IPython in your programs | |||||
152 |
|
154 | |||
153 | A few lines of code are enough to load a complete IPython inside your own |
|
155 | A few lines of code are enough to load a complete IPython inside your own | |
154 | programs, giving you the ability to work with your data interactively after |
|
156 | programs, giving you the ability to work with your data interactively after | |
155 |
automatic processing has been completed. See |
|
157 | automatic processing has been completed. See :ref:`here <embedding>` for more. | |
156 |
|
158 | |||
157 | Use the Python profiler |
|
159 | Use the Python profiler | |
158 | ----------------------- |
|
160 | ----------------------- | |
@@ -166,8 +168,8 Use IPython to present interactive demos | |||||
166 | ---------------------------------------- |
|
168 | ---------------------------------------- | |
167 |
|
169 | |||
168 | Use the IPython.demo.Demo class to load any Python script as an interactive |
|
170 | Use the IPython.demo.Demo class to load any Python script as an interactive | |
169 | demo. With a minimal amount of simple markup, you can control the execution |
|
171 | demo. With a minimal amount of simple markup, you can control the execution of | |
170 |
|
|
172 | the script, stopping as needed. See :ref:`here <interactive_demos>` for more. | |
171 |
|
173 | |||
172 | Run doctests |
|
174 | Run doctests | |
173 | ------------ |
|
175 | ------------ |
General Comments 0
You need to be logged in to leave comments.
Login now