[688] | 1 | # -*- Mode: Shell-Script -*- Not really, but shows comments correctly
|
---|
| 2 | #***************************************************************************
|
---|
| 3 | #
|
---|
| 4 | # Configuration file for ipython -- ipythonrc format
|
---|
| 5 | #
|
---|
| 6 | # The format of this file is one of 'key value' lines.
|
---|
| 7 | # Lines containing only whitespace at the beginning and then a # are ignored
|
---|
| 8 | # as comments. But comments can NOT be put on lines with data.
|
---|
| 9 | #***************************************************************************
|
---|
| 10 | autocall 1
|
---|
| 11 |
|
---|
| 12 | autoindent 1
|
---|
| 13 |
|
---|
| 14 | automagic 1
|
---|
| 15 |
|
---|
| 16 | # Size of the output cache. After this many entries are stored, the cache will
|
---|
| 17 | # get flushed. Depending on the size of your intermediate calculations, you
|
---|
| 18 | # may have memory problems if you make it too big, since keeping things in the
|
---|
| 19 | # cache prevents Python from reclaiming the memory for old results. Experiment
|
---|
| 20 | # with a value that works well for you.
|
---|
| 21 |
|
---|
| 22 | # If you choose cache_size 0 IPython will revert to python's regular >>>
|
---|
| 23 | # unnumbered prompt. You will still have _, __ and ___ for your last three
|
---|
| 24 | # results, but that will be it. No dynamic _1, _2, etc. will be created. If
|
---|
| 25 | # you are running on a slow machine or with very limited memory, this may
|
---|
| 26 | # help.
|
---|
| 27 |
|
---|
| 28 | cache_size 100
|
---|
| 29 |
|
---|
| 30 | # Currently available schemes: NoColor, Linux, LightBG.
|
---|
| 31 |
|
---|
| 32 | # keep uncommented only the one you want:
|
---|
| 33 | colors Linux
|
---|
| 34 | #colors LightBG
|
---|
| 35 | #colors NoColor
|
---|
| 36 |
|
---|
| 37 | # color_info: IPython can display information about objects via a set of
|
---|
| 38 | # functions, and optionally can use colors for this, syntax highlighting
|
---|
| 39 | # source code and various other elements. This information is passed through a
|
---|
| 40 | # pager (it defaults to 'less' if $PAGER is not set).
|
---|
| 41 |
|
---|
| 42 | # If your pager has problems, try to setting it to properly handle escapes
|
---|
| 43 | # (see the less manpage for detail), or disable this option. The magic
|
---|
| 44 | # function @color_info allows you to toggle this interactively for testing.
|
---|
| 45 |
|
---|
| 46 | color_info 1
|
---|
| 47 |
|
---|
| 48 | # confirm_exit: set to 1 if you want IPython to confirm when you try to exit
|
---|
| 49 | # with an EOF (Control-d in Unix, Control-Z/Enter in Windows). Note that using
|
---|
| 50 | # the magic functions @Exit or @Quit you can force a direct exit, bypassing
|
---|
| 51 | # any confirmation.
|
---|
| 52 |
|
---|
| 53 | confirm_exit 1
|
---|
| 54 |
|
---|
| 55 | # Use deep_reload() as a substitute for reload() by default. deep_reload() is
|
---|
| 56 | # still available as dreload() and appears as a builtin.
|
---|
| 57 |
|
---|
| 58 | deep_reload 0
|
---|
| 59 |
|
---|
| 60 | # Which editor to use with the @edit command. If you leave this at 0, IPython
|
---|
| 61 | # will honor your EDITOR environment variable. Since this editor is invoked on
|
---|
| 62 | # the fly by ipython and is meant for editing small code snippets, you may
|
---|
| 63 | # want to use a small, lightweight editor here.
|
---|
| 64 |
|
---|
| 65 | # For Emacs users, setting up your Emacs server properly as described in the
|
---|
| 66 | # manual is a good idea. An alternative is to use jed, a very light editor
|
---|
| 67 | # with much of the feel of Emacs (though not as powerful for heavy-duty work).
|
---|
| 68 |
|
---|
| 69 | editor 0
|
---|
| 70 |
|
---|
| 71 | # log 1 -> same as ipython -log. This automatically logs to ./ipython.log
|
---|
| 72 | log 0
|
---|
| 73 |
|
---|
| 74 | # Same as ipython -Logfile YourLogfileName.
|
---|
| 75 | # Don't use with log 1 (use one or the other)
|
---|
| 76 | logfile ''
|
---|
| 77 |
|
---|
| 78 | # banner 0 -> same as ipython -nobanner
|
---|
| 79 | banner 0
|
---|
| 80 |
|
---|
| 81 | # messages 0 -> same as ipython -nomessages
|
---|
| 82 | messages 0
|
---|
| 83 |
|
---|
| 84 | # Automatically call the pdb debugger after every uncaught exception. If you
|
---|
| 85 | # are used to debugging using pdb, this puts you automatically inside of it
|
---|
| 86 | # after any call (either in IPython or in code called by it) which triggers an
|
---|
| 87 | # exception which goes uncaught.
|
---|
| 88 | pdb 0
|
---|
| 89 |
|
---|
| 90 | # Enable the pprint module for printing. pprint tends to give a more readable
|
---|
| 91 | # display (than print) for complex nested data structures.
|
---|
| 92 | pprint 1
|
---|
| 93 |
|
---|
| 94 | # Prompt strings (see ipython --help for more details).
|
---|
| 95 | # Use %n to represent the current prompt number, and quote them to protect
|
---|
| 96 | # spaces.
|
---|
| 97 | prompt_in1 'ASAP>'
|
---|
| 98 |
|
---|
| 99 | # In prompt_in2, %n is replaced by as many dots as there are digits in the
|
---|
| 100 | # current value of %n.
|
---|
| 101 | prompt_in2 ' .%n.:'
|
---|
| 102 |
|
---|
| 103 | prompt_out 'asap>:'
|
---|
| 104 |
|
---|
| 105 | # quick 1 -> same as ipython -quick
|
---|
| 106 | quick 0
|
---|
| 107 |
|
---|
| 108 | # Use the readline library (1) or not (0). Most users will want this on, but
|
---|
| 109 | # if you experience strange problems with line management (mainly when using
|
---|
| 110 | # IPython inside Emacs buffers) you may try disabling it. Not having it on
|
---|
| 111 | # prevents you from getting command history with the arrow keys, searching and
|
---|
| 112 | # name completion using TAB.
|
---|
| 113 |
|
---|
| 114 | readline 1
|
---|
| 115 |
|
---|
| 116 | # Screen Length: number of lines of your screen. This is used to control
|
---|
| 117 | # printing of very long strings. Strings longer than this number of lines will
|
---|
| 118 | # be paged with the less command instead of directly printed.
|
---|
| 119 |
|
---|
| 120 | # The default value for this is 0, which means IPython will auto-detect your
|
---|
| 121 | # screen size every time it needs to print. If for some reason this isn't
|
---|
| 122 | # working well (it needs curses support), specify it yourself. Otherwise don't
|
---|
| 123 | # change the default.
|
---|
| 124 |
|
---|
| 125 | screen_length 0
|
---|
| 126 |
|
---|
| 127 | # Prompt separators for input and output.
|
---|
| 128 | # Use \n for newline explicitly, without quotes.
|
---|
| 129 | # Use 0 (like at the cmd line) to turn off a given separator.
|
---|
| 130 |
|
---|
| 131 | # The structure of prompt printing is:
|
---|
| 132 | # (SeparateIn)Input....
|
---|
| 133 | # (SeparateOut)Output...
|
---|
| 134 | # (SeparateOut2), # that is, no newline is printed after Out2
|
---|
| 135 | # By choosing these you can organize your output any way you want.
|
---|
| 136 |
|
---|
| 137 | separate_in \n
|
---|
| 138 |
|
---|
| 139 | separate_out 0
|
---|
| 140 |
|
---|
| 141 | separate_out2 0
|
---|
| 142 |
|
---|
| 143 | # 'nosep 1' is a shorthand for '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'.
|
---|
| 144 | # Simply removes all input/output separators, overriding the choices above.
|
---|
| 145 | nosep 0
|
---|
| 146 |
|
---|
| 147 | # xmode - Exception reporting mode.
|
---|
| 148 |
|
---|
| 149 | # Valid modes: Plain, Context and Verbose.
|
---|
| 150 |
|
---|
| 151 | # Plain: similar to python's normal traceback printing.
|
---|
| 152 |
|
---|
| 153 | # Context: prints 5 lines of context source code around each line in the
|
---|
| 154 | # traceback.
|
---|
| 155 |
|
---|
| 156 | # Verbose: similar to Context, but additionally prints the variables currently
|
---|
| 157 | # visible where the exception happened (shortening their strings if too
|
---|
| 158 | # long). This can potentially be very slow, if you happen to have a huge data
|
---|
| 159 | # structure whose string representation is complex to compute. Your computer
|
---|
| 160 | # may appear to freeze for a while with cpu usage at 100%. If this occurs, you
|
---|
| 161 | # can cancel the traceback with Ctrl-C (maybe hitting it more than once).
|
---|
| 162 |
|
---|
| 163 | xmode Plain
|
---|
| 164 | #xmode Context
|
---|
| 165 | #xmode Verbose
|
---|
| 166 |
|
---|
| 167 | #---------------------------------------------------------------------------
|
---|
| 168 | # Section: Readline configuration (readline is not available for MS-Windows)
|
---|
| 169 |
|
---|
| 170 | # This is done via the following options:
|
---|
| 171 |
|
---|
| 172 | # (i) readline_parse_and_bind: this option can appear as many times as you
|
---|
| 173 | # want, each time defining a string to be executed via a
|
---|
| 174 | # readline.parse_and_bind() command. The syntax for valid commands of this
|
---|
| 175 | # kind can be found by reading the documentation for the GNU readline library,
|
---|
| 176 | # as these commands are of the kind which readline accepts in its
|
---|
| 177 | # configuration file.
|
---|
| 178 |
|
---|
| 179 | # The TAB key can be used to complete names at the command line in one of two
|
---|
| 180 | # ways: 'complete' and 'menu-complete'. The difference is that 'complete' only
|
---|
| 181 | # completes as much as possible while 'menu-complete' cycles through all
|
---|
| 182 | # possible completions. Leave the one you prefer uncommented.
|
---|
| 183 |
|
---|
| 184 | readline_parse_and_bind tab: complete
|
---|
| 185 | #readline_parse_and_bind tab: menu-complete
|
---|
| 186 |
|
---|
| 187 | # This binds Control-l to printing the list of all possible completions when
|
---|
| 188 | # there is more than one (what 'complete' does when hitting TAB twice, or at
|
---|
| 189 | # the first TAB if show-all-if-ambiguous is on)
|
---|
| 190 | readline_parse_and_bind "\C-l": possible-completions
|
---|
| 191 |
|
---|
| 192 | # This forces readline to automatically print the above list when tab
|
---|
| 193 | # completion is set to 'complete'. You can still get this list manually by
|
---|
| 194 | # using the key bound to 'possible-completions' (Control-l by default) or by
|
---|
| 195 | # hitting TAB twice. Turning this on makes the printing happen at the first
|
---|
| 196 | # TAB.
|
---|
| 197 | readline_parse_and_bind set show-all-if-ambiguous on
|
---|
| 198 |
|
---|
| 199 | # If you have TAB set to complete names, you can rebind any key (Control-o by
|
---|
| 200 | # default) to insert a true TAB character.
|
---|
| 201 | readline_parse_and_bind "\C-o": tab-insert
|
---|
| 202 |
|
---|
| 203 | # These commands allow you to indent/unindent easily, with the 4-space
|
---|
| 204 | # convention of the Python coding standards. Since IPython's internal
|
---|
| 205 | # auto-indent system also uses 4 spaces, you should not change the number of
|
---|
| 206 | # spaces in the code below.
|
---|
| 207 | readline_parse_and_bind "\M-i": " "
|
---|
| 208 | readline_parse_and_bind "\M-o": "\d\d\d\d"
|
---|
| 209 | readline_parse_and_bind "\M-I": "\d\d\d\d"
|
---|
| 210 |
|
---|
| 211 | # Bindings for incremental searches in the history. These searches use the
|
---|
| 212 | # string typed so far on the command line and search anything in the previous
|
---|
| 213 | # input history containing them.
|
---|
| 214 | readline_parse_and_bind "\C-r": reverse-search-history
|
---|
| 215 | readline_parse_and_bind "\C-s": forward-search-history
|
---|
| 216 |
|
---|
| 217 | # Bindings for completing the current line in the history of previous
|
---|
| 218 | # commands. This allows you to recall any previous command by typing its first
|
---|
| 219 | # few letters and hitting Control-p, bypassing all intermediate commands which
|
---|
| 220 | # may be in the history (much faster than hitting up-arrow 50 times!)
|
---|
| 221 | readline_parse_and_bind "\C-p": history-search-backward
|
---|
| 222 | readline_parse_and_bind "\C-n": history-search-forward
|
---|
| 223 |
|
---|
| 224 | # (ii) readline_remove_delims: a string of characters to be removed from the
|
---|
| 225 | # default word-delimiters list used by readline, so that completions may be
|
---|
| 226 | # performed on strings which contain them.
|
---|
| 227 |
|
---|
| 228 | readline_remove_delims '"[]{}-/~
|
---|
| 229 |
|
---|
| 230 | #"' -- just to fix emacs coloring which gets confused by unmatched quotes.
|
---|
| 231 |
|
---|
| 232 | # (iii) readline_omit__names: normally hitting <tab> after a '.' in a name
|
---|
| 233 | # will complete all attributes of an object, including all the special methods
|
---|
| 234 | # whose names inlclude double underscores (like __getitem__ or __class__). If
|
---|
| 235 | # you'd rather not see these names by default, you can set this option to 1.
|
---|
| 236 |
|
---|
| 237 | # Note that even when this option is set, you can still see those names by
|
---|
| 238 | # explicitly typing a _ after the period and hitting <tab>: 'name._<tab>' will
|
---|
| 239 | # always complete attribute names starting with '_'.
|
---|
| 240 |
|
---|
| 241 | # This option is off by default so that new users see all attributes of any
|
---|
| 242 | # objects they are dealing with.
|
---|
| 243 |
|
---|
| 244 | readline_omit__names 0
|
---|
| 245 |
|
---|
| 246 | #---------------------------------------------------------------------------
|
---|
| 247 | # Section: modules to be loaded with 'import ...'
|
---|
| 248 |
|
---|
| 249 | # List, separated by spaces, the names of the modules you want to import
|
---|
| 250 |
|
---|
| 251 | # Example:
|
---|
| 252 | # import_mod sys os
|
---|
| 253 | # will produce internally the statements
|
---|
| 254 | # import sys
|
---|
| 255 | # import os
|
---|
| 256 |
|
---|
| 257 | # Each import is executed in its own try/except block, so if one module
|
---|
| 258 | # fails to load the others will still be ok.
|
---|
| 259 |
|
---|
[704] | 260 | import_mod sys
|
---|
[688] | 261 |
|
---|
| 262 | #---------------------------------------------------------------------------
|
---|
| 263 | # Section: modules to import some functions from: 'from ... import ...'
|
---|
| 264 |
|
---|
| 265 | # List, one per line, the modules for which you want only to import some
|
---|
| 266 | # functions. Give the module name first and then the name of functions to be
|
---|
| 267 | # imported from that module.
|
---|
| 268 |
|
---|
| 269 | # Example:
|
---|
| 270 | # import_some struct pack unpack
|
---|
| 271 | # will produce internally the statement
|
---|
| 272 | # from struct import pack,unpack
|
---|
| 273 |
|
---|
| 274 | # If you have more than one modules_some line, each gets its own try/except
|
---|
| 275 | # block (like modules, see above).
|
---|
| 276 |
|
---|
| 277 | import_some
|
---|
| 278 |
|
---|
| 279 | #---------------------------------------------------------------------------
|
---|
| 280 | # Section: modules to import all from : 'from ... import *'
|
---|
| 281 |
|
---|
| 282 | # List (same syntax as import_mod above) those modules for which you want to
|
---|
| 283 | # import all functions. Remember, this is a potentially dangerous thing to do,
|
---|
| 284 | # since it is very easy to overwrite names of things you need. Use with
|
---|
| 285 | # caution.
|
---|
| 286 |
|
---|
| 287 | # Example:
|
---|
| 288 | # import_all sys os
|
---|
| 289 | # will produce internally the statements
|
---|
| 290 | # from sys import *
|
---|
| 291 | # from os import *
|
---|
| 292 |
|
---|
| 293 | # As before, each will be called in a separate try/except block.
|
---|
| 294 |
|
---|
| 295 | import_all asap
|
---|
| 296 |
|
---|
| 297 | #---------------------------------------------------------------------------
|
---|
| 298 | # Section: Python code to execute.
|
---|
| 299 |
|
---|
| 300 | # Put here code to be explicitly executed (keep it simple!)
|
---|
| 301 | # Put one line of python code per line. All whitespace is removed (this is a
|
---|
| 302 | # feature, not a bug), so don't get fancy building loops here.
|
---|
| 303 | # This is just for quick convenient creation of things you want available.
|
---|
| 304 |
|
---|
| 305 | # Example:
|
---|
[704] | 306 | # banner 0 disables sys.stdout
|
---|
| 307 | execute sys.stdout = sys.__stdout__
|
---|
[688] | 308 | # and each *line* (not each statement, we don't do python syntax parsing) is
|
---|
| 309 | # executed in its own try/except block.
|
---|
[704] | 310 | execute print welcome()
|
---|
[688] | 311 |
|
---|
| 312 | # Note for the adventurous: you can use this to define your own names for the
|
---|
| 313 | # magic functions, by playing some namespace tricks:
|
---|
| 314 |
|
---|
| 315 | # execute __IP.magic_cl = __IP.magic_clear
|
---|
| 316 |
|
---|
| 317 | # defines @cl as a new name for @clear.
|
---|
| 318 |
|
---|
| 319 | #---------------------------------------------------------------------------
|
---|
| 320 | # Section: Pyhton files to load and execute.
|
---|
| 321 |
|
---|
| 322 | # Put here the full names of files you want executed with execfile(file). If
|
---|
| 323 | # you want complicated initialization, just write whatever you want in a
|
---|
| 324 | # regular python file and load it from here.
|
---|
| 325 |
|
---|
| 326 | # Filenames defined here (which *must* include the extension) are searched for
|
---|
| 327 | # through all of sys.path. Since IPython adds your .ipython directory to
|
---|
| 328 | # sys.path, they can also be placed in your .ipython dir and will be
|
---|
| 329 | # found. Otherwise (if you want to execute things not in .ipyton nor in
|
---|
| 330 | # sys.path) give a full path (you can use ~, it gets expanded)
|
---|
| 331 |
|
---|
| 332 | # Example:
|
---|
| 333 | # execfile file1.py ~/file2.py
|
---|
| 334 | # will generate
|
---|
| 335 | # execfile('file1.py')
|
---|
| 336 | # execfile('_path_to_your_home/file2.py')
|
---|
| 337 |
|
---|
| 338 | # As before, each file gets its own try/except block.
|
---|
| 339 |
|
---|
| 340 | execfile asapuserfuncs.py
|
---|
| 341 |
|
---|
| 342 | # If you are feeling adventurous, you can even add functionality to IPython
|
---|
| 343 | # through here. IPython works through a global variable called __ip which
|
---|
| 344 | # exists at the time when these files are read. If you know what you are doing
|
---|
| 345 | # (read the source) you can add functions to __ip in files loaded here.
|
---|
| 346 |
|
---|
| 347 | # The file example-magic.py contains a simple but correct example. Try it:
|
---|
| 348 |
|
---|
| 349 | # execfile example-magic.py
|
---|
| 350 |
|
---|
| 351 | # Look at the examples in IPython/iplib.py for more details on how these magic
|
---|
| 352 | # functions need to process their arguments.
|
---|
| 353 |
|
---|
| 354 | #---------------------------------------------------------------------------
|
---|
| 355 | # Section: aliases for system shell commands
|
---|
| 356 |
|
---|
| 357 | # Here you can define your own names for system commands. The syntax is
|
---|
| 358 | # similar to that of the builtin @alias function:
|
---|
| 359 |
|
---|
| 360 | # alias alias_name command_string
|
---|
| 361 |
|
---|
| 362 | # The resulting aliases are auto-generated magic functions (hence usable as
|
---|
| 363 | # @alias_name)
|
---|
| 364 |
|
---|
| 365 | # For example:
|
---|
| 366 |
|
---|
| 367 | # alias myls ls -la
|
---|
| 368 |
|
---|
| 369 | # will define '@myls' as an alias for executing the system command 'ls -la'.
|
---|
| 370 | # If automagic is on, you can just type myls like you would at a system shell
|
---|
| 371 | # prompt. This allows you to customize IPython's environment to have the same
|
---|
| 372 | # aliases you are accustomed to from your own shell.
|
---|
| 373 |
|
---|
| 374 | # You can also define aliases with parameters using %s specifiers (one per
|
---|
| 375 | # parameter):
|
---|
| 376 |
|
---|
| 377 | # alias parts echo first %s second %s
|
---|
| 378 |
|
---|
| 379 | # will give you in IPython:
|
---|
| 380 | # >>> @parts A B
|
---|
| 381 | # first A second B
|
---|
| 382 |
|
---|
| 383 | # Use one 'alias' statement per alias you wish to define.
|
---|
| 384 |
|
---|
| 385 | #alias
|
---|