##// END OF EJS Templates
Unify command-line usage information in one place....
Fernando Perez -
Show More
@@ -51,26 +51,41 b' class ApplicationError(Exception):'
51 51
52 52
53 53 app_cl_args = (
54 (('--ipython-dir', ), dict(
55 dest='Global.ipython_dir',type=unicode,
56 help='Set to override default location of Global.ipython_dir.',
57 default=NoConfigDefault,
58 metavar='Global.ipython_dir') ),
59 (('-p', '--profile',), dict(
60 dest='Global.profile',type=unicode,
61 help='The string name of the ipython profile to be used.',
62 default=NoConfigDefault,
63 metavar='Global.profile') ),
64 (('--log-level',), dict(
65 dest="Global.log_level",type=int,
66 help='Set the log level (0,10,20,30,40,50). Default is 30.',
67 default=NoConfigDefault,
68 metavar='Global.log_level')),
69 (('--config-file',), dict(
70 dest='Global.config_file',type=unicode,
71 help='Set the config file name to override default.',
72 default=NoConfigDefault,
73 metavar='Global.config_file')),
54 (('--ipython-dir', ), dict(
55 dest='Global.ipython_dir',type=unicode,
56 help=
57 """Set to override default location of the IPython directory
58 IPYTHON_DIR, stored as Global.ipython_dir. This can also be specified
59 through the environment variable IPYTHON_DIR.""",
60 default=NoConfigDefault,
61 metavar='Global.ipython_dir') ),
62 (('-p', '--profile',), dict(
63 dest='Global.profile',type=unicode,
64 help=
65 """The string name of the ipython profile to be used. Assume that your
66 config file is ipython_config-<name>.py (looks in current dir first,
67 then in IPYTHON_DIR). This is a quick way to keep and load multiple
68 config files for different tasks, especially if include your basic one
69 in your more specialized ones. You can keep a basic
70 IPYTHON_DIR/ipython_config.py file and then have other 'profiles' which
71 include this one and load extra things for particular tasks.""",
72 default=NoConfigDefault,
73 metavar='Global.profile') ),
74 (('--log-level',), dict(
75 dest="Global.log_level",type=int,
76 help='Set the log level (0,10,20,30,40,50). Default is 30.',
77 default=NoConfigDefault,
78 metavar='Global.log_level')),
79 (('--config-file',), dict(
80 dest='Global.config_file',type=unicode,
81 help=
82 """Set the config file name to override default. Normally IPython
83 loads ipython_config.py (from current directory) or
84 IPYTHON_DIR/ipython_config.py. If the loading of your config file
85 fails, IPython starts with a bare bones configuration (no modules
86 loaded at all).""",
87 default=NoConfigDefault,
88 metavar='Global.config_file')),
74 89 )
75 90
76 91 class Application(object):
@@ -78,7 +93,8 b' class Application(object):'
78 93
79 94 name = u'ipython'
80 95 description = 'IPython: an enhanced interactive Python shell.'
81
96 #: usage message printed by argparse. If None, auto-generate
97 usage = None
82 98 config_file_name = u'ipython_config.py'
83 99 # Track the default and actual separately because some messages are
84 100 # only printed if we aren't using the default.
@@ -199,7 +215,9 b' class Application(object):'
199 215 """Create and return a command line config loader."""
200 216 return ArgParseConfigLoader(self.argv, self.cl_arguments,
201 217 description=self.description,
202 version=release.version)
218 version=release.version,
219 usage=self.usage,
220 )
203 221
204 222 def pre_load_command_line_config(self):
205 223 """Do actions just before loading the command line config."""
@@ -4,17 +4,15 b''
4 4 The :class:`~IPython.core.application.Application` object for the command
5 5 line :command:`ipython` program.
6 6
7 Authors:
7 Authors
8 -------
8 9
9 10 * Brian Granger
10 11 * Fernando Perez
11
12 Notes
13 -----
14 12 """
15 13
16 14 #-----------------------------------------------------------------------------
17 # Copyright (C) 2008-2009 The IPython Development Team
15 # Copyright (C) 2008-2010 The IPython Development Team
18 16 #
19 17 # Distributed under the terms of the BSD License. The full license is in
20 18 # the file COPYING, distributed as part of this software.
@@ -23,6 +21,7 b' Notes'
23 21 #-----------------------------------------------------------------------------
24 22 # Imports
25 23 #-----------------------------------------------------------------------------
24 from __future__ import absolute_import
26 25
27 26 import logging
28 27 import os
@@ -41,62 +40,78 b' from IPython.config.loader import ('
41 40 )
42 41 from IPython.lib import inputhook
43 42 from IPython.utils.genutils import filefind, get_ipython_dir
43 from . import usage
44 44
45 45 #-----------------------------------------------------------------------------
46 # Utilities and helpers
46 # Globals, utilities and helpers
47 47 #-----------------------------------------------------------------------------
48 48
49 ipython_desc = """
50 A Python shell with automatic history (input and output), dynamic object
51 introspection, easier configuration, command completion, access to the system
52 shell and more.
53 """
54
55 #-----------------------------------------------------------------------------
56 # Main classes and functions
57 #-----------------------------------------------------------------------------
49 default_config_file_name = u'ipython_config.py'
58 50
59 51 cl_args = (
60 52 (('--autocall',), dict(
61 53 type=int, dest='InteractiveShell.autocall', default=NoConfigDefault,
62 help='Set the autocall value (0,1,2).',
54 help=
55 """Make IPython automatically call any callable object even if you
56 didn't type explicit parentheses. For example, 'str 43' becomes
57 'str(43)' automatically. The value can be '0' to disable the feature,
58 '1' for 'smart' autocall, where it is not applied if there are no more
59 arguments on the line, and '2' for 'full' autocall, where all callable
60 objects are automatically called (even if no arguments are present).
61 The default is '1'.""",
63 62 metavar='InteractiveShell.autocall')
64 63 ),
65 64 (('--autoindent',), dict(
66 action='store_true', dest='InteractiveShell.autoindent', default=NoConfigDefault,
65 action='store_true', dest='InteractiveShell.autoindent',
66 default=NoConfigDefault,
67 67 help='Turn on autoindenting.')
68 68 ),
69 69 (('--no-autoindent',), dict(
70 action='store_false', dest='InteractiveShell.autoindent', default=NoConfigDefault,
70 action='store_false', dest='InteractiveShell.autoindent',
71 default=NoConfigDefault,
71 72 help='Turn off autoindenting.')
72 73 ),
73 74 (('--automagic',), dict(
74 action='store_true', dest='InteractiveShell.automagic', default=NoConfigDefault,
75 help='Turn on the auto calling of magic commands.')
76 ),
75 action='store_true', dest='InteractiveShell.automagic',
76 default=NoConfigDefault,
77 help='Turn on the auto calling of magic commands.'
78 'Type %%magic at the IPython prompt for more information.')
79 ),
77 80 (('--no-automagic',), dict(
78 action='store_false', dest='InteractiveShell.automagic', default=NoConfigDefault,
81 action='store_false', dest='InteractiveShell.automagic',
82 default=NoConfigDefault,
79 83 help='Turn off the auto calling of magic commands.')
80 84 ),
81 85 (('--autoedit-syntax',), dict(
82 action='store_true', dest='InteractiveShell.autoedit_syntax', default=NoConfigDefault,
86 action='store_true', dest='InteractiveShell.autoedit_syntax',
87 default=NoConfigDefault,
83 88 help='Turn on auto editing of files with syntax errors.')
84 89 ),
85 90 (('--no-autoedit-syntax',), dict(
86 action='store_false', dest='InteractiveShell.autoedit_syntax', default=NoConfigDefault,
91 action='store_false', dest='InteractiveShell.autoedit_syntax',
92 default=NoConfigDefault,
87 93 help='Turn off auto editing of files with syntax errors.')
88 94 ),
89 95 (('--banner',), dict(
90 action='store_true', dest='Global.display_banner', default=NoConfigDefault,
96 action='store_true', dest='Global.display_banner',
97 default=NoConfigDefault,
91 98 help='Display a banner upon starting IPython.')
92 99 ),
93 100 (('--no-banner',), dict(
94 action='store_false', dest='Global.display_banner', default=NoConfigDefault,
101 action='store_false', dest='Global.display_banner',
102 default=NoConfigDefault,
95 103 help="Don't display a banner upon starting IPython.")
96 104 ),
97 105 (('--cache-size',), dict(
98 106 type=int, dest='InteractiveShell.cache_size', default=NoConfigDefault,
99 help="Set the size of the output cache.",
107 help=
108 """Set the size of the output cache. The default is 1000, you can
109 change it permanently in your config file. Setting it to 0 completely
110 disables the caching system, and the minimum value accepted is 20 (if
111 you provide a value less than 20, it is reset to 0 and a warning is
112 issued). This limit is defined because otherwise you'll spend more
113 time re-flushing a too small cache than working.
114 """,
100 115 metavar='InteractiveShell.cache_size')
101 116 ),
102 117 (('--classic',), dict(
@@ -109,27 +124,57 b' cl_args = ('
109 124 metavar='InteractiveShell.colors')
110 125 ),
111 126 (('--color-info',), dict(
112 action='store_true', dest='InteractiveShell.color_info', default=NoConfigDefault,
113 help="Enable using colors for info related things.")
127 action='store_true', dest='InteractiveShell.color_info',
128 default=NoConfigDefault,
129 help=
130 """IPython can display information about objects via a set of func-
131 tions, and optionally can use colors for this, syntax highlighting
132 source code and various other elements. However, because this
133 information is passed through a pager (like 'less') and many pagers get
134 confused with color codes, this option is off by default. You can test
135 it and turn it on permanently in your ipython_config.py file if it
136 works for you. Test it and turn it on permanently if it works with
137 your system. The magic function %%color_info allows you to toggle this
138 inter- actively for testing."""
139 )
114 140 ),
115 141 (('--no-color-info',), dict(
116 action='store_false', dest='InteractiveShell.color_info', default=NoConfigDefault,
142 action='store_false', dest='InteractiveShell.color_info',
143 default=NoConfigDefault,
117 144 help="Disable using colors for info related things.")
118 145 ),
119 146 (('--confirm-exit',), dict(
120 action='store_true', dest='InteractiveShell.confirm_exit', default=NoConfigDefault,
121 help="Prompt the user when existing.")
147 action='store_true', dest='InteractiveShell.confirm_exit',
148 default=NoConfigDefault,
149 help=
150 """Set to confirm when you try to exit IPython with an EOF (Control-D
151 in Unix, Control-Z/Enter in Windows). By typing 'exit', 'quit' or
152 '%%Exit', you can force a direct exit without any confirmation.
153 """
154 )
122 155 ),
123 156 (('--no-confirm-exit',), dict(
124 action='store_false', dest='InteractiveShell.confirm_exit', default=NoConfigDefault,
125 help="Don't prompt the user when existing.")
157 action='store_false', dest='InteractiveShell.confirm_exit',
158 default=NoConfigDefault,
159 help="Don't prompt the user when exiting.")
126 160 ),
127 161 (('--deep-reload',), dict(
128 action='store_true', dest='InteractiveShell.deep_reload', default=NoConfigDefault,
129 help="Enable deep (recursive) reloading by default.")
162 action='store_true', dest='InteractiveShell.deep_reload',
163 default=NoConfigDefault,
164 help=
165 """Enable deep (recursive) reloading by default. IPython can use the
166 deep_reload module which reloads changes in modules recursively (it
167 replaces the reload() function, so you don't need to change anything to
168 use it). deep_reload() forces a full reload of modules whose code may
169 have changed, which the default reload() function does not. When
170 deep_reload is off, IPython will use the normal reload(), but
171 deep_reload will still be available as dreload(). This fea- ture is off
172 by default [which means that you have both normal reload() and
173 dreload()].""")
130 174 ),
131 175 (('--no-deep-reload',), dict(
132 action='store_false', dest='InteractiveShell.deep_reload', default=NoConfigDefault,
176 action='store_false', dest='InteractiveShell.deep_reload',
177 default=NoConfigDefault,
133 178 help="Disable deep (recursive) reloading by default.")
134 179 ),
135 180 (('--editor',), dict(
@@ -138,43 +183,62 b' cl_args = ('
138 183 metavar='InteractiveShell.editor')
139 184 ),
140 185 (('--log','-l'), dict(
141 action='store_true', dest='InteractiveShell.logstart', default=NoConfigDefault,
142 help="Start logging to the default file (./ipython_log.py).")
186 action='store_true', dest='InteractiveShell.logstart',
187 default=NoConfigDefault,
188 help="Start logging to the default log file (./ipython_log.py).")
143 189 ),
144 190 (('--logfile','-lf'), dict(
145 191 type=unicode, dest='InteractiveShell.logfile', default=NoConfigDefault,
146 help="Start logging to logfile.",
192 help="Start logging to logfile with this name.",
147 193 metavar='InteractiveShell.logfile')
148 194 ),
149 195 (('--log-append','-la'), dict(
150 type=unicode, dest='InteractiveShell.logappend', default=NoConfigDefault,
151 help="Start logging to the give file in append mode.",
196 type=unicode, dest='InteractiveShell.logappend',
197 default=NoConfigDefault,
198 help="Start logging to the given file in append mode.",
152 199 metavar='InteractiveShell.logfile')
153 200 ),
154 201 (('--pdb',), dict(
155 action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault,
202 action='store_true', dest='InteractiveShell.pdb',
203 default=NoConfigDefault,
156 204 help="Enable auto calling the pdb debugger after every exception.")
157 205 ),
158 206 (('--no-pdb',), dict(
159 action='store_false', dest='InteractiveShell.pdb', default=NoConfigDefault,
207 action='store_false', dest='InteractiveShell.pdb',
208 default=NoConfigDefault,
160 209 help="Disable auto calling the pdb debugger after every exception.")
161 210 ),
162 211 (('--pprint',), dict(
163 action='store_true', dest='InteractiveShell.pprint', default=NoConfigDefault,
212 action='store_true', dest='InteractiveShell.pprint',
213 default=NoConfigDefault,
164 214 help="Enable auto pretty printing of results.")
165 215 ),
166 216 (('--no-pprint',), dict(
167 action='store_false', dest='InteractiveShell.pprint', default=NoConfigDefault,
217 action='store_false', dest='InteractiveShell.pprint',
218 default=NoConfigDefault,
168 219 help="Disable auto auto pretty printing of results.")
169 220 ),
170 221 (('--prompt-in1','-pi1'), dict(
171 222 type=str, dest='InteractiveShell.prompt_in1', default=NoConfigDefault,
172 help="Set the main input prompt ('In [\#]: ')",
223 help=
224 """Set the main input prompt ('In [\#]: '). Note that if you are using
225 numbered prompts, the number is represented with a '\#' in the string.
226 Don't forget to quote strings with spaces embedded in them. Most
227 bash-like escapes can be used to customize IPython's prompts, as well
228 as a few additional ones which are IPython-spe- cific. All valid
229 prompt escapes are described in detail in the Customization section of
230 the IPython manual.""",
173 231 metavar='InteractiveShell.prompt_in1')
174 232 ),
175 233 (('--prompt-in2','-pi2'), dict(
176 234 type=str, dest='InteractiveShell.prompt_in2', default=NoConfigDefault,
177 help="Set the secondary input prompt (' .\D.: ')",
235 help=
236 """Set the secondary input prompt (' .\D.: '). Similar to the previous
237 option, but used for the continuation prompts. The special sequence
238 '\D' is similar to '\#', but with all digits replaced by dots (so you
239 can have your continuation prompt aligned with your input prompt).
240 Default: ' .\D.: ' (note three spaces at the start for alignment with
241 'In [\#]')""",
178 242 metavar='InteractiveShell.prompt_in2')
179 243 ),
180 244 (('--prompt-out','-po'), dict(
@@ -187,30 +251,44 b' cl_args = ('
187 251 help="Enable quick startup with no config files.")
188 252 ),
189 253 (('--readline',), dict(
190 action='store_true', dest='InteractiveShell.readline_use', default=NoConfigDefault,
254 action='store_true', dest='InteractiveShell.readline_use',
255 default=NoConfigDefault,
191 256 help="Enable readline for command line usage.")
192 257 ),
193 258 (('--no-readline',), dict(
194 action='store_false', dest='InteractiveShell.readline_use', default=NoConfigDefault,
259 action='store_false', dest='InteractiveShell.readline_use',
260 default=NoConfigDefault,
195 261 help="Disable readline for command line usage.")
196 262 ),
197 263 (('--screen-length','-sl'), dict(
198 type=int, dest='InteractiveShell.screen_length', default=NoConfigDefault,
199 help='Number of lines on screen, used to control printing of long strings.',
264 type=int, dest='InteractiveShell.screen_length',
265 default=NoConfigDefault,
266 help=
267 """Number of lines of your screen, used to control printing of very
268 long strings. Strings longer than this number of lines will be sent
269 through a pager instead of directly printed. The default value for
270 this is 0, which means IPython will auto-detect your screen size every
271 time it needs to print certain potentially long strings (this doesn't
272 change the behavior of the 'print' keyword, it's only triggered
273 internally). If for some reason this isn't working well (it needs
274 curses support), specify it yourself. Otherwise don't change the
275 default.""",
200 276 metavar='InteractiveShell.screen_length')
201 277 ),
202 278 (('--separate-in','-si'), dict(
203 279 type=str, dest='InteractiveShell.separate_in', default=NoConfigDefault,
204 help="Separator before input prompts. Default '\n'.",
280 help="Separator before input prompts. Default '\\n'.",
205 281 metavar='InteractiveShell.separate_in')
206 282 ),
207 283 (('--separate-out','-so'), dict(
208 type=str, dest='InteractiveShell.separate_out', default=NoConfigDefault,
284 type=str, dest='InteractiveShell.separate_out',
285 default=NoConfigDefault,
209 286 help="Separator before output prompts. Default 0 (nothing).",
210 287 metavar='InteractiveShell.separate_out')
211 288 ),
212 289 (('--separate-out2','-so2'), dict(
213 type=str, dest='InteractiveShell.separate_out2', default=NoConfigDefault,
290 type=str, dest='InteractiveShell.separate_out2',
291 default=NoConfigDefault,
214 292 help="Separator after output prompts. Default 0 (nonight).",
215 293 metavar='InteractiveShell.separate_out2')
216 294 ),
@@ -219,16 +297,29 b' cl_args = ('
219 297 help="Eliminate all spacing between prompts.")
220 298 ),
221 299 (('--term-title',), dict(
222 action='store_true', dest='InteractiveShell.term_title', default=NoConfigDefault,
300 action='store_true', dest='InteractiveShell.term_title',
301 default=NoConfigDefault,
223 302 help="Enable auto setting the terminal title.")
224 303 ),
225 304 (('--no-term-title',), dict(
226 action='store_false', dest='InteractiveShell.term_title', default=NoConfigDefault,
305 action='store_false', dest='InteractiveShell.term_title',
306 default=NoConfigDefault,
227 307 help="Disable auto setting the terminal title.")
228 308 ),
229 309 (('--xmode',), dict(
230 310 type=str, dest='InteractiveShell.xmode', default=NoConfigDefault,
231 help="Exception mode ('Plain','Context','Verbose')",
311 help=
312 """Exception reporting mode ('Plain','Context','Verbose'). Plain:
313 similar to python's normal traceback printing. Context: prints 5 lines
314 of context source code around each line in the traceback. Verbose:
315 similar to Context, but additionally prints the variables currently
316 visible where the exception happened (shortening their strings if too
317 long). This can potentially be very slow, if you happen to have a huge
318 data structure whose string representation is complex to compute.
319 Your computer may appear to freeze for a while with cpu usage at 100%%.
320 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
321 it more than once).
322 """,
232 323 metavar='InteractiveShell.xmode')
233 324 ),
234 325 (('--ext',), dict(
@@ -242,8 +333,11 b' cl_args = ('
242 333 metavar='Global.code_to_run')
243 334 ),
244 335 (('-i',), dict(
245 action='store_true', dest='Global.force_interact', default=NoConfigDefault,
246 help="If running code from the command line, become interactive afterwards.")
336 action='store_true', dest='Global.force_interact',
337 default=NoConfigDefault,
338 help=
339 "If running code from the command line, become interactive afterwards."
340 )
247 341 ),
248 342
249 343 # Options to start with GUI control enabled from the beginning
@@ -280,12 +374,17 b' cl_args = ('
280 374 ),
281 375 )
282 376
283
284 default_config_file_name = u'ipython_config.py'
377 #-----------------------------------------------------------------------------
378 # Main classes and functions
379 #-----------------------------------------------------------------------------
285 380
286 381 class IPythonApp(Application):
287 382 name = u'ipython'
288 description = 'IPython: an enhanced interactive Python shell.'
383 #: argparse formats better the 'usage' than the 'description' field
384 description = None
385 #: usage message printed by argparse. If None, auto-generate
386 usage = usage.cl_usage
387
289 388 config_file_name = default_config_file_name
290 389
291 390 cl_arguments = Application.cl_arguments + cl_args
@@ -309,7 +408,6 b' class IPythonApp(Application):'
309 408 super(IPythonApp, self).__init__(argv)
310 409 self.shell_params = shell_params
311 410
312
313 411 def create_default_config(self):
314 412 super(IPythonApp, self).create_default_config()
315 413 # Eliminate multiple lookups
@@ -1,338 +1,47 b''
1 1 # -*- coding: utf-8 -*-
2 #*****************************************************************************
3 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
2 """Usage information for the main IPython applications.
3 """
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2010 The IPython Development Team
6 # Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
4 7 #
5 8 # Distributed under the terms of the BSD License. The full license is in
6 9 # the file COPYING, distributed as part of this software.
7 #*****************************************************************************
10 #-----------------------------------------------------------------------------
8 11
9 12 import sys
10 13 from IPython.core import release
11 14
12 __doc__ = """
13 IPython -- An enhanced Interactive Python
14 =========================================
15 cl_usage = """\
16 ipython [options] [files]
15 17
16 A Python shell with automatic history (input and output), dynamic object
17 introspection, easier configuration, command completion, access to the system
18 shell and more.
19
20 IPython can also be embedded in running programs. See EMBEDDING below.
21
22
23 USAGE
24 ipython [options] files
25
26 If invoked with no options, it executes all the files listed in
27 sequence and drops you into the interpreter while still acknowledging
28 any options you may have set in your ipythonrc file. This behavior is
29 different from standard Python, which when called as python -i will
30 only execute one file and will ignore your configuration setup.
31
32 Please note that some of the configuration options are not available at
33 the command line, simply because they are not practical here. Look into
34 your ipythonrc configuration file for details on those. This file
35 typically installed in the $HOME/.ipython directory.
36
37 For Windows users, $HOME resolves to C:\\Documents and
38 Settings\\YourUserName in most instances, and _ipython is used instead
39 of .ipython, since some Win32 programs have problems with dotted names
40 in directories.
41
42 In the rest of this text, we will refer to this directory as
43 IPYTHON_DIR.
44
45 REGULAR OPTIONS
46 After the above threading options have been given, regular options can
47 follow in any order. All options can be abbreviated to their shortest
48 non-ambiguous form and are case-sensitive. One or two dashes can be
49 used. Some options have an alternate short form, indicated after a |.
50
51 Most options can also be set from your ipythonrc configuration file.
52 See the provided examples for assistance. Options given on the comman-
53 dline override the values set in the ipythonrc file.
54
55 All options with a [no] prepended can be specified in negated form
56 (using -nooption instead of -option) to turn the feature off.
57
58 -h, --help
59 Show summary of options.
60
61 -autocall <val>
62 Make IPython automatically call any callable object even if you
63 didn't type explicit parentheses. For example, 'str 43' becomes
64 'str(43)' automatically. The value can be '0' to disable the
65 feature, '1' for 'smart' autocall, where it is not applied if
66 there are no more arguments on the line, and '2' for 'full'
67 autocall, where all callable objects are automatically called
68 (even if no arguments are present). The default is '1'.
69
70 -[no]autoindent
71 Turn automatic indentation on/off.
72
73 -[no]automagic
74 Make magic commands automatic (without needing their first char-
75 acter to be %). Type %magic at the IPython prompt for more
76 information.
77
78 -[no]autoedit_syntax
79 When a syntax error occurs after editing a file, automatically
80 open the file to the trouble causing line for convenient fixing.
81
82 -[no]banner
83 Print the intial information banner (default on).
84
85 -c <command>
86 Execute the given command string, and set sys.argv to ['c'].
87 This is similar to the -c option in the normal Python inter-
88 preter.
89
90 -cache_size|cs <n>
91 Size of the output cache (maximum number of entries to hold in
92 memory). The default is 1000, you can change it permanently in
93 your config file. Setting it to 0 completely disables the
94 caching system, and the minimum value accepted is 20 (if you
95 provide a value less than 20, it is reset to 0 and a warning is
96 issued). This limit is defined because otherwise you'll spend
97 more time re-flushing a too small cache than working.
98
99 -classic|cl
100 Gives IPython a similar feel to the classic Python prompt.
101
102 -colors <scheme>
103 Color scheme for prompts and exception reporting. Currently
104 implemented: NoColor, Linux, and LightBG.
105
106 -[no]color_info
107 IPython can display information about objects via a set of func-
108 tions, and optionally can use colors for this, syntax highlight-
109 ing source code and various other elements. However, because
110 this information is passed through a pager (like 'less') and
111 many pagers get confused with color codes, this option is off by
112 default. You can test it and turn it on permanently in your
113 ipythonrc file if it works for you. As a reference, the 'less'
114 pager supplied with Mandrake 8.2 works ok, but that in RedHat
115 7.2 doesn't.
116
117 Test it and turn it on permanently if it works with your system.
118 The magic function @color_info allows you to toggle this inter-
119 actively for testing.
120
121 -[no]confirm_exit
122 Set to confirm when you try to exit IPython with an EOF (Con-
123 trol-D in Unix, Control-Z/Enter in Windows). Note that using the
124 magic functions @Exit or @Quit you can force a direct exit,
125 bypassing any confirmation.
126
127 -[no]debug
128 Show information about the loading process. Very useful to pin
129 down problems with your configuration files or to get details
130 about session restores.
131
132 -[no]deep_reload
133 IPython can use the deep_reload module which reloads changes in
134 modules recursively (it replaces the reload() function, so you
135 don't need to change anything to use it). deep_reload() forces a
136 full reload of modules whose code may have changed, which the
137 default reload() function does not.
138
139 When deep_reload is off, IPython will use the normal reload(),
140 but deep_reload will still be available as dreload(). This fea-
141 ture is off by default [which means that you have both normal
142 reload() and dreload()].
143
144 -editor <name>
145 Which editor to use with the @edit command. By default, IPython
146 will honor your EDITOR environment variable (if not set, vi is
147 the Unix default and notepad the Windows one). Since this editor
148 is invoked on the fly by IPython and is meant for editing small
149 code snippets, you may want to use a small, lightweight editor
150 here (in case your default EDITOR is something like Emacs).
151
152 -ipythondir <name>
153 The name of your IPython configuration directory IPYTHON_DIR.
154 This can also be specified through the environment variable
155 IPYTHON_DIR.
156
157 -log|l Generate a log file of all input. The file is named
158 ipython_log.py in your current directory (which prevents logs
159 from multiple IPython sessions from trampling each other). You
160 can use this to later restore a session by loading your logfile
161 as a file to be executed with option -logplay (see below).
162
163 -logfile|lf
164 Specify the name of your logfile.
165
166 -logplay|lp
167 Replay a previous log. For restoring a session as close as pos-
168 sible to the state you left it in, use this option (don't just
169 run the logfile). With -logplay, IPython will try to reconstruct
170 the previous working environment in full, not just execute the
171 commands in the logfile.
172 When a session is restored, logging is automatically turned on
173 again with the name of the logfile it was invoked with (it is
174 read from the log header). So once you've turned logging on for
175 a session, you can quit IPython and reload it as many times as
176 you want and it will continue to log its history and restore
177 from the beginning every time.
178
179 Caveats: there are limitations in this option. The history vari-
180 ables _i*,_* and _dh don't get restored properly. In the future
181 we will try to implement full session saving by writing and
182 retrieving a failed because of inherent limitations of Python's
183 Pickle module, so this may have to wait.
184
185 -[no]messages
186 Print messages which IPython collects about its startup process
187 (default on).
188
189 -[no]pdb
190 Automatically call the pdb debugger after every uncaught excep-
191 tion. If you are used to debugging using pdb, this puts you
192 automatically inside of it after any call (either in IPython or
193 in code called by it) which triggers an exception which goes
194 uncaught.
195
196 -[no]pprint
197 IPython can optionally use the pprint (pretty printer) module
198 for displaying results. pprint tends to give a nicer display of
199 nested data structures. If you like it, you can turn it on per-
200 manently in your config file (default off).
201
202 -profile|p <name>
203 Assume that your config file is ipythonrc-<name> (looks in cur-
204 rent dir first, then in IPYTHON_DIR). This is a quick way to keep
205 and load multiple config files for different tasks, especially
206 if you use the include option of config files. You can keep a
207 basic IPYTHON_DIR/ipythonrc file and then have other 'profiles'
208 which include this one and load extra things for particular
209 tasks. For example:
210
211 1) $HOME/.ipython/ipythonrc : load basic things you always want.
212 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-
213 related modules.
214 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
215 plotting modules.
216
217 Since it is possible to create an endless loop by having circu-
218 lar file inclusions, IPython will stop if it reaches 15 recur-
219 sive inclusions.
220
221 -prompt_in1|pi1 <string>
222 Specify the string used for input prompts. Note that if you are
223 using numbered prompts, the number is represented with a '\#' in
224 the string. Don't forget to quote strings with spaces embedded
225 in them. Default: 'In [\#]: '.
226
227 Most bash-like escapes can be used to customize IPython's
228 prompts, as well as a few additional ones which are IPython-spe-
229 cific. All valid prompt escapes are described in detail in the
230 Customization section of the IPython HTML/PDF manual.
231
232 -prompt_in2|pi2 <string>
233 Similar to the previous option, but used for the continuation
234 prompts. The special sequence '\D' is similar to '\#', but with
235 all digits replaced dots (so you can have your continuation
236 prompt aligned with your input prompt). Default: ' .\D.: '
237 (note three spaces at the start for alignment with 'In [\#]').
238
239 -prompt_out|po <string>
240 String used for output prompts, also uses numbers like
241 prompt_in1. Default: 'Out[\#]:'.
242
243 -quick Start in bare bones mode (no config file loaded).
244
245 -rcfile <name>
246 Name of your IPython resource configuration file. normally
247 IPython loads ipythonrc (from current directory) or
248 IPYTHON_DIR/ipythonrc. If the loading of your config file fails,
249 IPython starts with a bare bones configuration (no modules
250 loaded at all).
251
252 -[no]readline
253 Use the readline library, which is needed to support name com-
254 pletion and command history, among other things. It is enabled
255 by default, but may cause problems for users of X/Emacs in
256 Python comint or shell buffers.
257
258 Note that emacs 'eterm' buffers (opened with M-x term) support
259 IPython's readline and syntax coloring fine, only 'emacs' (M-x
260 shell and C-c !) buffers do not.
261
262 -screen_length|sl <n>
263 Number of lines of your screen. This is used to control print-
264 ing of very long strings. Strings longer than this number of
265 lines will be sent through a pager instead of directly printed.
266
267 The default value for this is 0, which means IPython will auto-
268 detect your screen size every time it needs to print certain
269 potentially long strings (this doesn't change the behavior of
270 the 'print' keyword, it's only triggered internally). If for
271 some reason this isn't working well (it needs curses support),
272 specify it yourself. Otherwise don't change the default.
273
274 -separate_in|si <string>
275 Separator before input prompts. Default '0.
276
277 -separate_out|so <string>
278 Separator before output prompts. Default: 0 (nothing).
279
280 -separate_out2|so2 <string>
281 Separator after output prompts. Default: 0 (nothing).
282
283 -nosep Shorthand for '-separate_in 0 -separate_out 0 -separate_out2 0'.
284 Simply removes all input/output separators.
285
286 -upgrade
287 Allows you to upgrade your IPYTHON_DIR configuration when you
288 install a new version of IPython. Since new versions may
289 include new command lines options or example files, this copies
290 updated ipythonrc-type files. However, it backs up (with a .old
291 extension) all files which it overwrites so that you can merge
292 back any custimizations you might have in your personal files.
293
294 -Version
295 Print version information and exit.
296
297 -wxversion <string>
298 Select a specific version of wxPython (used in conjunction with
299 -wthread). Requires the wxversion module, part of recent
300 wxPython distributions.
301
302 -xmode <modename>
303 Mode for exception reporting. The valid modes are Plain, Con-
304 text, and Verbose.
305
306 - Plain: similar to python's normal traceback printing.
307
308 - Context: prints 5 lines of context source code around each
309 line in the traceback.
310
311 - Verbose: similar to Context, but additionally prints the vari-
312 ables currently visible where the exception happened (shortening
313 their strings if too long). This can potentially be very slow,
314 if you happen to have a huge data structure whose string repre-
315 sentation is complex to compute. Your computer may appear to
316 freeze for a while with cpu usage at 100%. If this occurs, you
317 can cancel the traceback with Ctrl-C (maybe hitting it more than
318 once).
319
320
321 EMBEDDING
322 It is possible to start an IPython instance inside your own Python pro-
323 grams. In the documentation example files there are some illustrations
324 on how to do this.
325
326 This feature allows you to evalutate dynamically the state of your
327 code, operate with your variables, analyze them, etc. Note however
328 that any changes you make to values while in the shell do NOT propagate
329 back to the running code, so it is safe to modify your values because
330 you won't break your code in bizarre ways by doing so.
331 """
18 IPython: an enhanced interactive Python shell.
19
20 A Python shell with automatic history (input and output), dynamic object
21 introspection, easier configuration, command completion, access to the
22 system shell and more. IPython can also be embedded in running programs.
332 23
333 cmd_line_usage = __doc__
24 If invoked with no options, it executes all the files listed in sequence
25 and exits, use -i to enter interactive mode after running the files. Files
26 ending in .py will be treated as normal Python, but files ending in .ipy
27 can contain special IPython syntax (magic commands, shell expansions, etc.)
28
29 Please note that some of the configuration options are not available at the
30 command line, simply because they are not practical here. Look into your
31 ipython_config.py configuration file for details on those.
32
33 This file typically installed in the $HOME/.ipython directory. For Windows
34 users, $HOME resolves to C:\\Documents and Settings\\YourUserName in most
35 instances.
36
37 In IPython's documentation, we will refer to this directory as IPYTHON_DIR,
38 you can change its default location by setting any path you want in this
39 environment variable.
40
41 For more information, see the manual available in HTML and PDF in your
42 installation, or online at http://ipython.scipy.org.
43 """
334 44
335 #---------------------------------------------------------------------------
336 45 interactive_usage = """
337 46 IPython -- An enhanced Interactive Python
338 47 =========================================
General Comments 0
You need to be logged in to leave comments. Login now