annotate .ipython/ipy_user_conf.py @ 183:fe810e9731f0

global ignores: never track .noseids
author Augie Fackler <durin42@gmail.com>
date Tue, 26 Jan 2010 11:47:33 -0600
parents c1519e52dcd0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
148
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 """ User configuration file for IPython
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 This is a more flexible and safe way to configure ipython than *rc files
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 (ipythonrc, ipythonrc-pysh etc.)
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 This file is always imported on ipython startup. You can import the
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 ipython extensions you need here (see IPython/Extensions directory).
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 Feel free to edit this file to customize your ipython experience.
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 Note that as such this file does nothing, for backwards compatibility.
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 Consult e.g. file 'ipy_profile_sh.py' for an example of the things
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 you can do here.
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 description on what you could do here.
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 """
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 # Most of your config files and extensions will probably start with this import
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 import IPython.ipapi
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 ip = IPython.ipapi.get()
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 # You probably want to uncomment this if you did %upgrade -nolegacy
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 # import ipy_defaults
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 import os
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 def main():
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 # uncomment if you want to get ipython -p sh behaviour
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32 # without having to use command line switches
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 # import ipy_profile_sh
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 # Configure your favourite editor?
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 # Good idea e.g. for %edit os.path.isfile
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 #import ipy_editors
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 # Choose one of these:
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 #ipy_editors.scite()
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 #ipy_editors.scite('c:/opt/scite/scite.exe')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 #ipy_editors.komodo()
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 #ipy_editors.idle()
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 # ... or many others, try 'ipy_editors??' after import to see them
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48 # Or roll your own:
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 #ipy_editors.install_editor("c:/opt/jed +$line $file")
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52 o = ip.options
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53 # An example on how to set options
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54 #o.autocall = 1
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 o.system_verbose = 0
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 #import_all("os sys")
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58 #execf('~/_ipython/ns.py')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 # -- prompt
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 # A different, more compact set of prompts from the default ones, that
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63 # always show your current location in the filesystem:
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65 #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66 #o.prompt_in2 = r'.\D: '
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67 #o.prompt_out = r'[\#] '
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 # Try one of these color settings if you can't read the text easily
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70 # autoexec is a list of IPython commands to execute on startup
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71 #o.autoexec.append('%colors LightBG')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 #o.autoexec.append('%colors NoColor')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 #o.autoexec.append('%colors Linux')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
74
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 # for sane integer division that converts to float (1/2 == 0.5)
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76 #o.autoexec.append('from __future__ import division')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
78 # For %tasks and %kill
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
79 #import jobctrl
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
80
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
81 # For autoreloading of modules (%autoreload, %aimport)
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
82 #import ipy_autoreload
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
83
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
84 # For winpdb support (%wdb)
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
85 #import ipy_winpdb
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
86
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
87 # For bzr completer, requires bzrlib (the python installation of bzr)
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88 #ip.load('ipy_bzr')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
89
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90 # Tab completer that is not quite so picky (i.e.
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
91 # "foo".<TAB> and str(2).<TAB> will work). Complete
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
92 # at your own risk!
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
93 #import ipy_greedycompleter
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
94
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
95 # If you are on Linux, you may be annoyed by
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
96 # "Display all N possibilities? (y or n)" on tab completion,
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
97 # as well as the paging through "more". Uncomment the following
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
98 # lines to disable that behaviour
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
99 #import readline
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
100 #readline.parse_and_bind('set completion-query-items 1000')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
101 #readline.parse_and_bind('set page-completions no')
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
102
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
103
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
104 # some config helper functions you can use
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
105 def import_all(modules):
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
106 """ Usage: import_all("os sys") """
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
107 for m in modules.split():
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
108 ip.ex("from %s import *" % m)
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
109
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
110 def execf(fname):
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
111 """ Execute a file in user namespace """
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
112 ip.ex('execfile("%s")' % os.path.expanduser(fname))
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
113
c1519e52dcd0 Upgraded to newer ipython configuration.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
114 main()