| 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 |  | 
|---|
| 117 | # Screen Length: number of lines of your screen. This is used to control | 
|---|
| 118 | # printing of very long strings. Strings longer than this number of lines will | 
|---|
| 119 | # be paged with the less command instead of directly printed. | 
|---|
| 120 |  | 
|---|
| 121 | # The default value for this is 0, which means IPython will auto-detect your | 
|---|
| 122 | # screen size every time it needs to print. If for some reason this isn't | 
|---|
| 123 | # working well (it needs curses support), specify it yourself. Otherwise don't | 
|---|
| 124 | # change the default. | 
|---|
| 125 |  | 
|---|
| 126 | screen_length 0 | 
|---|
| 127 |  | 
|---|
| 128 | # Prompt separators for input and output. | 
|---|
| 129 | # Use \n for newline explicitly, without quotes. | 
|---|
| 130 | # Use 0 (like at the cmd line) to turn off a given separator. | 
|---|
| 131 |  | 
|---|
| 132 | # The structure of prompt printing is: | 
|---|
| 133 | # (SeparateIn)Input.... | 
|---|
| 134 | # (SeparateOut)Output... | 
|---|
| 135 | # (SeparateOut2),   # that is, no newline is printed after Out2 | 
|---|
| 136 | # By choosing these you can organize your output any way you want. | 
|---|
| 137 |  | 
|---|
| 138 | separate_in \n | 
|---|
| 139 |  | 
|---|
| 140 | separate_out 0 | 
|---|
| 141 |  | 
|---|
| 142 | separate_out2 0 | 
|---|
| 143 |  | 
|---|
| 144 | # 'nosep 1' is a shorthand for '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'. | 
|---|
| 145 | # Simply removes all input/output separators, overriding the choices above. | 
|---|
| 146 | nosep 0 | 
|---|
| 147 |  | 
|---|
| 148 | # xmode - Exception reporting mode. | 
|---|
| 149 |  | 
|---|
| 150 | # Valid modes: Plain, Context and Verbose. | 
|---|
| 151 |  | 
|---|
| 152 | # Plain: similar to python's normal traceback printing. | 
|---|
| 153 |  | 
|---|
| 154 | # Context: prints 5 lines of context source code around each line in the | 
|---|
| 155 | # traceback. | 
|---|
| 156 |  | 
|---|
| 157 | # Verbose: similar to Context, but additionally prints the variables currently | 
|---|
| 158 | # visible where the exception happened (shortening their strings if too | 
|---|
| 159 | # long). This can potentially be very slow, if you happen to have a huge data | 
|---|
| 160 | # structure whose string representation is complex to compute. Your computer | 
|---|
| 161 | # may appear to freeze for a while with cpu usage at 100%. If this occurs, you | 
|---|
| 162 | # can cancel the traceback with Ctrl-C (maybe hitting it more than once). | 
|---|
| 163 |  | 
|---|
| 164 | xmode Plain | 
|---|
| 165 | #xmode Context | 
|---|
| 166 | #xmode Verbose | 
|---|
| 167 |  | 
|---|
| 168 | #--------------------------------------------------------------------------- | 
|---|
| 169 | # Section: Readline configuration (readline is not available for MS-Windows) | 
|---|
| 170 |  | 
|---|
| 171 | # This is done via the following options: | 
|---|
| 172 |  | 
|---|
| 173 | # (i) readline_parse_and_bind: this option can appear as many times as you | 
|---|
| 174 | # want, each time defining a string to be executed via a | 
|---|
| 175 | # readline.parse_and_bind() command. The syntax for valid commands of this | 
|---|
| 176 | # kind can be found by reading the documentation for the GNU readline library, | 
|---|
| 177 | # as these commands are of the kind which readline accepts in its | 
|---|
| 178 | # configuration file. | 
|---|
| 179 |  | 
|---|
| 180 | # The TAB key can be used to complete names at the command line in one of two | 
|---|
| 181 | # ways: 'complete' and 'menu-complete'. The difference is that 'complete' only | 
|---|
| 182 | # completes as much as possible while 'menu-complete' cycles through all | 
|---|
| 183 | # possible completions. Leave the one you prefer uncommented. | 
|---|
| 184 |  | 
|---|
| 185 | readline_parse_and_bind tab: complete | 
|---|
| 186 | #readline_parse_and_bind tab: menu-complete | 
|---|
| 187 |  | 
|---|
| 188 | # This binds Control-l to printing the list of all possible completions when | 
|---|
| 189 | # there is more than one (what 'complete' does when hitting TAB twice, or at | 
|---|
| 190 | # the first TAB if show-all-if-ambiguous is on) | 
|---|
| 191 | readline_parse_and_bind "\C-l": possible-completions | 
|---|
| 192 |  | 
|---|
| 193 | # This forces readline to automatically print the above list when tab | 
|---|
| 194 | # completion is set to 'complete'. You can still get this list manually by | 
|---|
| 195 | # using the key bound to 'possible-completions' (Control-l by default) or by | 
|---|
| 196 | # hitting TAB twice. Turning this on makes the printing happen at the first | 
|---|
| 197 | # TAB. | 
|---|
| 198 | readline_parse_and_bind set show-all-if-ambiguous on | 
|---|
| 199 |  | 
|---|
| 200 | # If you have TAB set to complete names, you can rebind any key (Control-o by | 
|---|
| 201 | # default) to insert a true TAB character. | 
|---|
| 202 | readline_parse_and_bind "\C-o": tab-insert | 
|---|
| 203 |  | 
|---|
| 204 | # These commands allow you to indent/unindent easily, with the 4-space | 
|---|
| 205 | # convention of the Python coding standards.  Since IPython's internal | 
|---|
| 206 | # auto-indent system also uses 4 spaces, you should not change the number of | 
|---|
| 207 | # spaces in the code below. | 
|---|
| 208 | readline_parse_and_bind "\M-i": "    " | 
|---|
| 209 | readline_parse_and_bind "\M-o": "\d\d\d\d" | 
|---|
| 210 | readline_parse_and_bind "\M-I": "\d\d\d\d" | 
|---|
| 211 |  | 
|---|
| 212 | # Bindings for incremental searches in the history. These searches use the | 
|---|
| 213 | # string typed so far on the command line and search anything in the previous | 
|---|
| 214 | # input history containing them. | 
|---|
| 215 | readline_parse_and_bind "\C-r": reverse-search-history | 
|---|
| 216 | readline_parse_and_bind "\C-s": forward-search-history | 
|---|
| 217 |  | 
|---|
| 218 | # Bindings for completing the current line in the history of previous | 
|---|
| 219 | # commands. This allows you to recall any previous command by typing its first | 
|---|
| 220 | # few letters and hitting Control-p, bypassing all intermediate commands which | 
|---|
| 221 | # may be in the history (much faster than hitting up-arrow 50 times!) | 
|---|
| 222 | readline_parse_and_bind "\C-p": history-search-backward | 
|---|
| 223 | readline_parse_and_bind "\C-n": history-search-forward | 
|---|
| 224 |  | 
|---|
| 225 | # (ii) readline_remove_delims: a string of characters to be removed from the | 
|---|
| 226 | # default word-delimiters list used by readline, so that completions may be | 
|---|
| 227 | # performed on strings which contain them. | 
|---|
| 228 |  | 
|---|
| 229 | readline_remove_delims -/~ | 
|---|
| 230 |  | 
|---|
| 231 | #"' -- just to fix emacs coloring which gets confused by unmatched quotes. | 
|---|
| 232 |  | 
|---|
| 233 | # (iii) readline_omit__names: normally hitting <tab> after a '.' in a name | 
|---|
| 234 | # will complete all attributes of an object, including all the special methods | 
|---|
| 235 | # whose names inlclude double underscores (like __getitem__ or __class__). If | 
|---|
| 236 | # you'd rather not see these names by default, you can set this option to 1. | 
|---|
| 237 |  | 
|---|
| 238 | # Note that even when this option is set, you can still see those names by | 
|---|
| 239 | # explicitly typing a _ after the period and hitting <tab>: 'name._<tab>' will | 
|---|
| 240 | # always complete attribute names starting with '_'. | 
|---|
| 241 |  | 
|---|
| 242 | # This option is off by default so that new users see all attributes of any | 
|---|
| 243 | # objects they are dealing with. | 
|---|
| 244 |  | 
|---|
| 245 | readline_omit__names 2 | 
|---|
| 246 |  | 
|---|
| 247 | #--------------------------------------------------------------------------- | 
|---|
| 248 | # Section: modules to be loaded with 'import ...' | 
|---|
| 249 |  | 
|---|
| 250 | # List, separated by spaces, the names of the modules you want to import | 
|---|
| 251 |  | 
|---|
| 252 | # Example: | 
|---|
| 253 | # import_mod sys os | 
|---|
| 254 | # will produce internally the statements | 
|---|
| 255 | # import sys | 
|---|
| 256 | # import os | 
|---|
| 257 |  | 
|---|
| 258 | # Each import is executed in its own try/except block, so if one module | 
|---|
| 259 | # fails to load the others will still be ok. | 
|---|
| 260 |  | 
|---|
| 261 | import_mod sys | 
|---|
| 262 |  | 
|---|
| 263 | #--------------------------------------------------------------------------- | 
|---|
| 264 | # Section: modules to import some functions from: 'from ... import ...' | 
|---|
| 265 |  | 
|---|
| 266 | # List, one per line, the modules for which you want only to import some | 
|---|
| 267 | # functions. Give the module name first and then the name of functions to be | 
|---|
| 268 | # imported from that module. | 
|---|
| 269 |  | 
|---|
| 270 | # Example: | 
|---|
| 271 | # import_some struct pack unpack | 
|---|
| 272 | # will produce internally the statement | 
|---|
| 273 | # from struct import pack,unpack | 
|---|
| 274 |  | 
|---|
| 275 | # If you have more than one modules_some line, each gets its own try/except | 
|---|
| 276 | # block (like modules, see above). | 
|---|
| 277 |  | 
|---|
| 278 | import_some | 
|---|
| 279 |  | 
|---|
| 280 | #--------------------------------------------------------------------------- | 
|---|
| 281 | # Section: modules to import all from : 'from ... import *' | 
|---|
| 282 |  | 
|---|
| 283 | # List (same syntax as import_mod above) those modules for which you want to | 
|---|
| 284 | # import all functions. Remember, this is a potentially dangerous thing to do, | 
|---|
| 285 | # since it is very easy to overwrite names of things you need. Use with | 
|---|
| 286 | # caution. | 
|---|
| 287 |  | 
|---|
| 288 | # Example: | 
|---|
| 289 | # import_all sys os | 
|---|
| 290 | # will produce internally the statements | 
|---|
| 291 | # from sys import * | 
|---|
| 292 | # from os import * | 
|---|
| 293 |  | 
|---|
| 294 | # As before, each will be called in a separate try/except block. | 
|---|
| 295 |  | 
|---|
| 296 | import_all asap | 
|---|
| 297 |  | 
|---|
| 298 | #--------------------------------------------------------------------------- | 
|---|
| 299 | # Section: Python code to execute. | 
|---|
| 300 |  | 
|---|
| 301 | # Put here code to be explicitly executed (keep it simple!) | 
|---|
| 302 | # Put one line of python code per line. All whitespace is removed (this is a | 
|---|
| 303 | # feature, not a bug), so don't get fancy building loops here. | 
|---|
| 304 | # This is just for quick convenient creation of things you want available. | 
|---|
| 305 |  | 
|---|
| 306 | # Example: | 
|---|
| 307 | # banner 0 disables  sys.stdout | 
|---|
| 308 | execute sys.stdout = sys.__stdout__ | 
|---|
| 309 | # and each *line* (not each statement, we don't do python syntax parsing) is | 
|---|
| 310 | # executed in its own try/except block. | 
|---|
| 311 | execute print welcome() | 
|---|
| 312 |  | 
|---|
| 313 | # Note for the adventurous: you can use this to define your own names for the | 
|---|
| 314 | # magic functions, by playing some namespace tricks: | 
|---|
| 315 |  | 
|---|
| 316 | # execute __IP.magic_cl = __IP.magic_clear | 
|---|
| 317 |  | 
|---|
| 318 | # defines @cl as a new name for @clear. | 
|---|
| 319 |  | 
|---|
| 320 | #--------------------------------------------------------------------------- | 
|---|
| 321 | # Section: Pyhton files to load and execute. | 
|---|
| 322 |  | 
|---|
| 323 | # Put here the full names of files you want executed with execfile(file).  If | 
|---|
| 324 | # you want complicated initialization, just write whatever you want in a | 
|---|
| 325 | # regular python file and load it from here. | 
|---|
| 326 |  | 
|---|
| 327 | # Filenames defined here (which *must* include the extension) are searched for | 
|---|
| 328 | # through all of sys.path. Since IPython adds your .ipython directory to | 
|---|
| 329 | # sys.path, they can also be placed in your .ipython dir and will be | 
|---|
| 330 | # found. Otherwise (if you want to execute things not in .ipyton nor in | 
|---|
| 331 | # sys.path) give a full path (you can use ~, it gets expanded) | 
|---|
| 332 |  | 
|---|
| 333 | # Example: | 
|---|
| 334 | # execfile file1.py ~/file2.py | 
|---|
| 335 | # will generate | 
|---|
| 336 | # execfile('file1.py') | 
|---|
| 337 | # execfile('_path_to_your_home/file2.py') | 
|---|
| 338 |  | 
|---|
| 339 | # As before, each file gets its own try/except block. | 
|---|
| 340 |  | 
|---|
| 341 | execfile asapuserfuncs.py | 
|---|
| 342 |  | 
|---|
| 343 | # If you are feeling adventurous, you can even add functionality to IPython | 
|---|
| 344 | # through here. IPython works through a global variable called __ip which | 
|---|
| 345 | # exists at the time when these files are read. If you know what you are doing | 
|---|
| 346 | # (read the source) you can add functions to __ip in files loaded here. | 
|---|
| 347 |  | 
|---|
| 348 | # The file example-magic.py contains a simple but correct example. Try it: | 
|---|
| 349 |  | 
|---|
| 350 | # execfile example-magic.py | 
|---|
| 351 |  | 
|---|
| 352 | # Look at the examples in IPython/iplib.py for more details on how these magic | 
|---|
| 353 | # functions need to process their arguments. | 
|---|
| 354 |  | 
|---|
| 355 | #--------------------------------------------------------------------------- | 
|---|
| 356 | # Section: aliases for system shell commands | 
|---|
| 357 |  | 
|---|
| 358 | # Here you can define your own names for system commands. The syntax is | 
|---|
| 359 | # similar to that of the builtin @alias function: | 
|---|
| 360 |  | 
|---|
| 361 | # alias alias_name command_string | 
|---|
| 362 |  | 
|---|
| 363 | # The resulting aliases are auto-generated magic functions (hence usable as | 
|---|
| 364 | # @alias_name) | 
|---|
| 365 |  | 
|---|
| 366 | # For example: | 
|---|
| 367 |  | 
|---|
| 368 | # alias myls ls -la | 
|---|
| 369 |  | 
|---|
| 370 | # will define '@myls' as an alias for executing the system command 'ls -la'. | 
|---|
| 371 | # If automagic is on, you can just type myls like you would at a system shell | 
|---|
| 372 | # prompt.  This allows you to customize IPython's environment to have the same | 
|---|
| 373 | # aliases you are accustomed to from your own shell. | 
|---|
| 374 |  | 
|---|
| 375 | # You can also define aliases with parameters using %s specifiers (one per | 
|---|
| 376 | # parameter): | 
|---|
| 377 |  | 
|---|
| 378 | # alias parts echo first %s second %s | 
|---|
| 379 |  | 
|---|
| 380 | # will give you in IPython: | 
|---|
| 381 | # >>> @parts A B | 
|---|
| 382 | # first A second B | 
|---|
| 383 |  | 
|---|
| 384 | # Use one 'alias' statement per alias you wish to define. | 
|---|
| 385 |  | 
|---|
| 386 | #alias | 
|---|