source: trunk/share/ipy_user_conf.py

Last change on this file was 1470, checked in by Malte Marquarding, 15 years ago

execute userfuncs

File size: 1.7 KB
Line 
1""" User configuration file for IPython
2
3This is a more flexible and safe way to configure ipython than *rc files
4(ipythonrc, ipythonrc-pysh etc.)
5
6This file is always imported on ipython startup. You can import the
7ipython extensions you need here (see IPython/Extensions directory).
8
9Feel free to edit this file to customize your ipython experience.
10
11Note that as such this file does nothing, for backwards compatibility.
12Consult e.g. file 'ipy_profile_sh.py' for an example of the things
13you can do here.
14
15See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed
16description on what you could do here.
17"""
18
19# Most of your config files and extensions will probably start with this import
20
21import IPython.ipapi
22ip = IPython.ipapi.get()
23
24# You probably want to uncomment this if you did %upgrade -nolegacy
25import ipy_defaults
26
27import os   
28
29def main():   
30    o = ip.options
31    o.autocall = 1
32    o.system_verbose = 0
33   
34    o.prompt_in1 = r'ASAP>'
35    #o.prompt_in2 = r'   .%n.:'
36    o.prompt_in2 = r'.\D: '
37    o.prompt_out = r'asap>:'
38
39    #o.autoexec.append('%colors LightBG')
40    #o.autoexec.append('%colors NoColor')
41    o.autoexec.append('%colors Linux')
42    o.autocall = 2
43    o.pprint = 1
44    o.confirm_exit = 0
45    o.banner = 0
46    o.xmode = 'Plain'
47    o.readline_omit__names = 1
48    import_all("asap")
49    # asap banner
50    execf("~/.asap/asapuserfuncs.py")
51    ip.ex('print welcome()')
52
53# some config helper functions you can use
54def import_all(modules):
55    """ Usage: import_all("os sys") """
56    for m in modules.split():
57        ip.ex("from %s import *" % m)
58       
59def execf(fname):
60    """ Execute a file in user namespace """
61    ip.ex('execfile("%s")' % os.path.expanduser(fname))
62
63main()
64
Note: See TracBrowser for help on using the repository browser.