##// END OF EJS Templates
Merge branch 'remove-ipythonrc-refs'
Thomas Kluyver -
r4715:ee9e1d9f merge
parent child Browse files
Show More
@@ -13,7 +13,7 b' itself, so hooks have full access to the entire IPython object.'
13
13
14 If you wish to define a new hook and activate it, you need to put the
14 If you wish to define a new hook and activate it, you need to put the
15 necessary code into a python file which can be either imported or execfile()'d
15 necessary code into a python file which can be either imported or execfile()'d
16 from within your ipythonrc configuration.
16 from within your profile's ipython_config.py configuration.
17
17
18 For example, suppose that you have a module called 'myiphooks' in your
18 For example, suppose that you have a module called 'myiphooks' in your
19 PYTHONPATH, which contains the following definition:
19 PYTHONPATH, which contains the following definition:
@@ -640,11 +640,10 b' Currently the magic system has the following functions:\\n"""'
640 search.
640 search.
641
641
642 -i/-c: make the pattern case insensitive/sensitive. If neither of
642 -i/-c: make the pattern case insensitive/sensitive. If neither of
643 these options is given, the default is read from your ipythonrc
643 these options are given, the default is read from your configuration
644 file. The option name which sets this value is
644 file, with the option ``InteractiveShell.wildcards_case_sensitive``.
645 'wildcards_case_sensitive'. If this option is not specified in your
645 If this option is not specified in your configuration file, IPython's
646 ipythonrc file, IPython's internal default is to do a case sensitive
646 internal default is to do a case sensitive search.
647 search.
648
647
649 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
648 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
650 specifiy can be searched in any of the following namespaces:
649 specifiy can be searched in any of the following namespaces:
@@ -1230,8 +1229,8 b' Currently the magic system has the following functions:\\n"""'
1230 interactive pdb debugger after the traceback printout. %pdb toggles
1229 interactive pdb debugger after the traceback printout. %pdb toggles
1231 this feature on and off.
1230 this feature on and off.
1232
1231
1233 The initial state of this feature is set in your ipythonrc
1232 The initial state of this feature is set in your configuration
1234 configuration file (the variable is called 'pdb').
1233 file (the option is ``InteractiveShell.pdb``).
1235
1234
1236 If you want to just activate the debugger AFTER an exception has fired,
1235 If you want to just activate the debugger AFTER an exception has fired,
1237 without having to type '%pdb on' and rerunning your code, you can use
1236 without having to type '%pdb on' and rerunning your code, you can use
@@ -2268,16 +2267,17 b' Currently the magic system has the following functions:\\n"""'
2268 Usage:
2267 Usage:
2269 %edit [options] [args]
2268 %edit [options] [args]
2270
2269
2271 %edit runs IPython's editor hook. The default version of this hook is
2270 %edit runs IPython's editor hook. The default version of this hook is
2272 set to call the __IPYTHON__.rc.editor command. This is read from your
2271 set to call the editor specified by your $EDITOR environment variable.
2273 environment variable $EDITOR. If this isn't found, it will default to
2272 If this isn't found, it will default to vi under Linux/Unix and to
2274 vi under Linux/Unix and to notepad under Windows. See the end of this
2273 notepad under Windows. See the end of this docstring for how to change
2275 docstring for how to change the editor hook.
2274 the editor hook.
2276
2275
2277 You can also set the value of this editor via the command line option
2276 You can also set the value of this editor via the
2278 '-editor' or in your ipythonrc file. This is useful if you wish to use
2277 ``TerminalInteractiveShell.editor`` option in your configuration file.
2279 specifically for IPython an editor different from your typical default
2278 This is useful if you wish to use a different editor from your typical
2280 (and for Windows users who typically don't set environment variables).
2279 default with IPython (and for Windows users who typically don't set
2280 environment variables).
2281
2281
2282 This command allows you to conveniently edit multi-line code right in
2282 This command allows you to conveniently edit multi-line code right in
2283 your IPython session.
2283 your IPython session.
@@ -2316,25 +2316,25 b' Currently the magic system has the following functions:\\n"""'
2316 If arguments are given, the following possibilites exist:
2316 If arguments are given, the following possibilites exist:
2317
2317
2318 - If the argument is a filename, IPython will load that into the
2318 - If the argument is a filename, IPython will load that into the
2319 editor. It will execute its contents with execfile() when you exit,
2319 editor. It will execute its contents with execfile() when you exit,
2320 loading any code in the file into your interactive namespace.
2320 loading any code in the file into your interactive namespace.
2321
2321
2322 - The arguments are ranges of input history, e.g. "7 ~1/4-6".
2322 - The arguments are ranges of input history, e.g. "7 ~1/4-6".
2323 The syntax is the same as in the %history magic.
2323 The syntax is the same as in the %history magic.
2324
2324
2325 - If the argument is a string variable, its contents are loaded
2325 - If the argument is a string variable, its contents are loaded
2326 into the editor. You can thus edit any string which contains
2326 into the editor. You can thus edit any string which contains
2327 python code (including the result of previous edits).
2327 python code (including the result of previous edits).
2328
2328
2329 - If the argument is the name of an object (other than a string),
2329 - If the argument is the name of an object (other than a string),
2330 IPython will try to locate the file where it was defined and open the
2330 IPython will try to locate the file where it was defined and open the
2331 editor at the point where it is defined. You can use `%edit function`
2331 editor at the point where it is defined. You can use `%edit function`
2332 to load an editor exactly at the point where 'function' is defined,
2332 to load an editor exactly at the point where 'function' is defined,
2333 edit it and have the file be executed automatically.
2333 edit it and have the file be executed automatically.
2334
2334
2335 If the object is a macro (see %macro for details), this opens up your
2335 - If the object is a macro (see %macro for details), this opens up your
2336 specified editor with a temporary file containing the macro's data.
2336 specified editor with a temporary file containing the macro's data.
2337 Upon exit, the macro is reloaded with the contents of the file.
2337 Upon exit, the macro is reloaded with the contents of the file.
2338
2338
2339 Note: opening at an exact line is only supported under Unix, and some
2339 Note: opening at an exact line is only supported under Unix, and some
2340 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2340 editors (like kedit and gedit up to Gnome 2.8) do not understand the
@@ -81,7 +81,7 b' MAIN FEATURES'
81
81
82 * Magic commands: type %magic for information on the magic subsystem.
82 * Magic commands: type %magic for information on the magic subsystem.
83
83
84 * System command aliases, via the %alias command or the ipythonrc config file.
84 * System command aliases, via the %alias command or the configuration file(s).
85
85
86 * Dynamic object information:
86 * Dynamic object information:
87
87
@@ -328,9 +328,10 b' class PythonRunner(InteractiveRunner):'
328 class SAGERunner(InteractiveRunner):
328 class SAGERunner(InteractiveRunner):
329 """Interactive SAGE runner.
329 """Interactive SAGE runner.
330
330
331 WARNING: this runner only works if you manually configure your SAGE copy
331 WARNING: this runner only works if you manually adjust your SAGE
332 to use 'colors NoColor' in the ipythonrc config file, since currently the
332 configuration so that the 'color' option in the configuration file is set to
333 prompt matching regexp does not identify color sequences."""
333 'NoColor', because currently the prompt matching regexp does not identify
334 color sequences."""
334
335
335 def __init__(self,program='sage',args=None,out=sys.stdout,echo=True):
336 def __init__(self,program='sage',args=None,out=sys.stdout,echo=True):
336 """New runner, optionally passing the sage command to use."""
337 """New runner, optionally passing the sage command to use."""
@@ -3,10 +3,10 b''
3 Limitations:
3 Limitations:
4
4
5 - When generating examples for use as doctests, make sure that you have
5 - When generating examples for use as doctests, make sure that you have
6 pretty-printing OFF. This can be done either by starting ipython with the
6 pretty-printing OFF. This can be done either by setting the
7 flag '--nopprint', by setting pprint to 0 in your ipythonrc file, or by
7 ``PlainTextFormatter.pprint`` option in your configuration file to False, or
8 interactively disabling it with %Pprint. This is required so that IPython
8 by interactively disabling it with %Pprint. This is required so that IPython
9 output matches that of normal Python, which is used by doctest for internal
9 output matches that of normal Python, which is used by doctest for internal
10 execution.
10 execution.
11
11
12 - Do not rely on specific prompt numbers for results (such as using
12 - Do not rely on specific prompt numbers for results (such as using
@@ -235,16 +235,9 b' class ZMQInteractiveShell(InteractiveShell):'
235 Usage:
235 Usage:
236 %edit [options] [args]
236 %edit [options] [args]
237
237
238 %edit runs IPython's editor hook. The default version of this hook is
238 %edit runs an external text editor. You will need to set the command for
239 set to call the __IPYTHON__.rc.editor command. This is read from your
239 this editor via the ``TerminalInteractiveShell.editor`` option in your
240 environment variable $EDITOR. If this isn't found, it will default to
240 configuration file before it will work.
241 vi under Linux/Unix and to notepad under Windows. See the end of this
242 docstring for how to change the editor hook.
243
244 You can also set the value of this editor via the command line option
245 '-editor' or in your ipythonrc file. This is useful if you wish to use
246 specifically for IPython an editor different from your typical default
247 (and for Windows users who typically don't set environment variables).
248
241
249 This command allows you to conveniently edit multi-line code right in
242 This command allows you to conveniently edit multi-line code right in
250 your IPython session.
243 your IPython session.
@@ -363,16 +356,7 b' class ZMQInteractiveShell(InteractiveShell):'
363 Editing... done. Executing edited code...
356 Editing... done. Executing edited code...
364 hello again
357 hello again
365 Out[7]: "print 'hello again'n"
358 Out[7]: "print 'hello again'n"
366
359 """
367
368 Changing the default editor hook:
369
370 If you wish to write your own editor hook, you can put it in a
371 configuration file which you load at startup time. The default hook
372 is defined in the IPython.core.hooks module, and you can use that as a
373 starting example for further modifications. That file also has
374 general instructions on how to set a new hook for use once you've
375 defined it."""
376
360
377 opts,args = self.parse_options(parameter_s,'prn:')
361 opts,args = self.parse_options(parameter_s,'prn:')
378
362
@@ -19,10 +19,12 b' file and ignore your configuration setup.'
19
19
20 Please note that some of the configuration options are not available at
20 Please note that some of the configuration options are not available at
21 the command line, simply because they are not practical here. Look into
21 the command line, simply because they are not practical here. Look into
22 your ipythonrc configuration file for details on those. This file is typically
22 your configuration files for details on those. There are separate configuration
23 installed in the IPYTHON_DIR directory. For Linux
23 files for each profile, and the files look like "ipython_config.py" or
24 users, this will be $HOME/.config/ipython, and for other users it will be
24 "ipython_config_<frontendname>.py". Profile directories look like
25 $HOME/.ipython. For Windows users, $HOME resolves to C:\\Documents and
25 "profile_profilename" and are typically installed in the IPYTHON_DIR directory.
26 For Linux users, this will be $HOME/.config/ipython, and for other users it
27 will be $HOME/.ipython. For Windows users, $HOME resolves to C:\\Documents and
26 Settings\\YourUserName in most instances.
28 Settings\\YourUserName in most instances.
27
29
28
30
@@ -46,9 +48,9 b' follow in any order. All options can be abbreviated to their shortest'
46 non-ambiguous form and are case-sensitive. One or two dashes can be
48 non-ambiguous form and are case-sensitive. One or two dashes can be
47 used. Some options have an alternate short form, indicated after a ``|``.
49 used. Some options have an alternate short form, indicated after a ``|``.
48
50
49 Most options can also be set from your ipythonrc configuration file. See
51 Most options can also be set from your configuration file. See the provided
50 the provided example for more details on what the options do. Options
52 example for more details on what the options do. Options given at the command
51 given at the command line override the values set in the ipythonrc file.
53 line override the values set in the configuration file.
52
54
53 All options with a [no] prepended can be specified in negated form
55 All options with a [no] prepended can be specified in negated form
54 (--no-option instead of --option) to turn the feature off.
56 (--no-option instead of --option) to turn the feature off.
@@ -110,7 +112,7 b' All options with a [no] prepended can be specified in negated form'
110 code and various other elements. However, because this information is
112 code and various other elements. However, because this information is
111 passed through a pager (like 'less') and many pagers get confused with
113 passed through a pager (like 'less') and many pagers get confused with
112 color codes, this option is off by default. You can test it and turn
114 color codes, this option is off by default. You can test it and turn
113 it on permanently in your ipythonrc file if it works for you. As a
115 it on permanently in your configuration file if it works for you. As a
114 reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
116 reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
115 that in RedHat 7.2 doesn't.
117 that in RedHat 7.2 doesn't.
116
118
@@ -569,7 +571,7 b' syntax for this can be found in the readline documentation available'
569 with your system or on the Internet. IPython doesn't read this file (if
571 with your system or on the Internet. IPython doesn't read this file (if
570 it exists) directly, but it does support passing to readline valid
572 it exists) directly, but it does support passing to readline valid
571 options via a simple interface. In brief, you can customize readline by
573 options via a simple interface. In brief, you can customize readline by
572 setting the following options in your ipythonrc configuration file (note
574 setting the following options in your configuration file (note
573 that these options can not be specified at the command line):
575 that these options can not be specified at the command line):
574
576
575 * **readline_parse_and_bind**: this option can appear as many times as
577 * **readline_parse_and_bind**: this option can appear as many times as
@@ -594,8 +596,7 b' that these options can not be specified at the command line):'
594 This option is off by default so that new users see all
596 This option is off by default so that new users see all
595 attributes of any objects they are dealing with.
597 attributes of any objects they are dealing with.
596
598
597 You will find the default values along with a corresponding detailed
599 You will find the default values in your configuration file.
598 explanation in your ipythonrc file.
599
600
600
601
601 Session logging and restoring
602 Session logging and restoring
@@ -696,8 +697,7 b' Even object attributes can be expanded::'
696 System command aliases
697 System command aliases
697 ----------------------
698 ----------------------
698
699
699 The %alias magic function and the alias option in the ipythonrc
700 The %alias magic function allows you to define magic functions which are in fact
700 configuration file allow you to define magic functions which are in fact
701 system shell commands. These aliases can have parameters.
701 system shell commands. These aliases can have parameters.
702
702
703 ``%alias alias_name cmd`` defines 'alias_name' as an alias for 'cmd'
703 ``%alias alias_name cmd`` defines 'alias_name' as an alias for 'cmd'
@@ -828,7 +828,7 b' accidentally overwrite the Out variable you can recover it by typing'
828 This system obviously can potentially put heavy memory demands on your
828 This system obviously can potentially put heavy memory demands on your
829 system, since it prevents Python's garbage collector from removing any
829 system, since it prevents Python's garbage collector from removing any
830 previously computed results. You can control how many results are kept
830 previously computed results. You can control how many results are kept
831 in memory with the option (at the command line or in your ipythonrc
831 in memory with the option (at the command line or in your configuration
832 file) cache_size. If you set it to 0, the whole system is completely
832 file) cache_size. If you set it to 0, the whole system is completely
833 disabled and the prompts revert to the classic '>>>' of normal Python.
833 disabled and the prompts revert to the classic '>>>' of normal Python.
834
834
@@ -98,34 +98,3 b' Continuing with the example above, this should illustrate this idea::'
98 This section was written after a contribution by Alexander Belchenko on
98 This section was written after a contribution by Alexander Belchenko on
99 the IPython user list.
99 the IPython user list.
100
100
101 .. The section below needs to be updated for the new config system.
102
103 .. Effective logging
104 -----------------
105
106 .. A very useful suggestion sent in by Robert Kern follows:
107
108 .. I recently happened on a nifty way to keep tidy per-project log files. I
109 made a profile for my project (which is called "parkfield")::
110
111 include ipythonrc
112
113 # cancel earlier logfile invocation:
114
115 logfile ''
116
117 execute import time
118
119 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
120
121 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
122
123 .. I also added a shell alias for convenience::
124
125 alias parkfield="ipython --pylab profile=parkfield"
126
127 .. Now I have a nice little directory with everything I ever type in,
128 organized by project and date.
129
130
131
General Comments 0
You need to be logged in to leave comments. Login now