Show More
@@ -1,58 +1,68 b'' | |||||
1 | """ User configuration file for IPython |
|
1 | """ User configuration file for IPython | |
2 |
|
2 | |||
3 | This is a more flexible and safe way to configure ipython than *rc files |
|
3 | This is a more flexible and safe way to configure ipython than *rc files | |
4 | (ipythonrc, ipythonrc-pysh etc.) |
|
4 | (ipythonrc, ipythonrc-pysh etc.) | |
5 |
|
5 | |||
6 | This file is always imported on ipython startup. You can import the |
|
6 | This file is always imported on ipython startup. You can import the | |
7 | ipython extensions you need here (see IPython/Extensions directory). |
|
7 | ipython extensions you need here (see IPython/Extensions directory). | |
8 |
|
8 | |||
9 | Feel free to edit this file to customize your ipython experience. |
|
9 | Feel free to edit this file to customize your ipython experience. | |
10 |
|
10 | |||
11 | Note that as such this file does nothing, for backwards compatibility. |
|
11 | Note that as such this file does nothing, for backwards compatibility. | |
12 | Consult e.g. file 'ipy_profile_sh.py' for an example of the things |
|
12 | Consult e.g. file 'ipy_profile_sh.py' for an example of the things | |
13 | you can do here. |
|
13 | you can do here. | |
14 |
|
14 | |||
15 | See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed |
|
15 | See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed | |
16 | description on what you could do here. |
|
16 | description on what you could do here. | |
17 | """ |
|
17 | """ | |
18 |
|
18 | |||
19 | # Most of your config files and extensions will probably start with this import |
|
19 | # Most of your config files and extensions will probably start with this import | |
20 |
|
20 | |||
21 | import IPython.ipapi |
|
21 | import IPython.ipapi | |
22 | ip = IPython.ipapi.get() |
|
22 | ip = IPython.ipapi.get() | |
23 |
|
23 | |||
24 | # You probably want to uncomment this if you did %upgrade -nolegacy |
|
24 | # You probably want to uncomment this if you did %upgrade -nolegacy | |
25 | # import ipy_defaults |
|
25 | # import ipy_defaults | |
26 |
|
26 | |||
27 | import os |
|
27 | import os | |
28 |
|
28 | |||
29 | def main(): |
|
29 | def main(): | |
30 | # Handy tab-completers for %cd, %run, import etc. |
|
30 | # Handy tab-completers for %cd, %run, import etc. | |
31 | # Try commenting this out if you have completion problems/slowness |
|
31 | # Try commenting this out if you have completion problems/slowness | |
32 | # import ipy_stock_completers |
|
32 | # import ipy_stock_completers | |
33 |
|
33 | |||
34 | # uncomment if you want to get ipython -p sh behaviour |
|
34 | # uncomment if you want to get ipython -p sh behaviour | |
35 | # without having to use command line switches |
|
35 | # without having to use command line switches | |
36 |
|
36 | |||
37 | # import ipy_profile_sh |
|
37 | # import ipy_profile_sh | |
38 |
|
38 | |||
39 |
|
39 | |||
|
40 | # Configure your favourite editor? | |||
|
41 | # Good idea e.g. for %edit os.path.isfile | |||
|
42 | ||||
|
43 | #import ipy_editors | |||
|
44 | #ipy_editors.scite() | |||
|
45 | #ipy_editors.scite('c:/opt/scite/scite.exe') | |||
|
46 | #ipy_editors.komodo() | |||
|
47 | #ipy_editors.install_editor("c:/opt/jed +$line $file") | |||
|
48 | ||||
|
49 | ||||
40 | o = ip.options |
|
50 | o = ip.options | |
41 | # An example on how to set options |
|
51 | # An example on how to set options | |
42 | #o.autocall = 1 |
|
52 | #o.autocall = 1 | |
43 | o.system_verbose = 0 |
|
53 | o.system_verbose = 0 | |
44 |
|
54 | |||
45 | #import_all("os sys") |
|
55 | #import_all("os sys") | |
46 | #execf('~/_ipython/ns.py') |
|
56 | #execf('~/_ipython/ns.py') | |
47 |
|
57 | |||
48 | # some config helper functions you can use |
|
58 | # some config helper functions you can use | |
49 | def import_all(modules): |
|
59 | def import_all(modules): | |
50 | """ Usage: import_all("os sys") """ |
|
60 | """ Usage: import_all("os sys") """ | |
51 | for m in modules.split(): |
|
61 | for m in modules.split(): | |
52 | ip.ex("from %s import *" % m) |
|
62 | ip.ex("from %s import *" % m) | |
53 |
|
63 | |||
54 | def execf(fname): |
|
64 | def execf(fname): | |
55 | """ Execute a file in user namespace """ |
|
65 | """ Execute a file in user namespace """ | |
56 | ip.ex('execfile("%s")' % os.path.expanduser(fname)) |
|
66 | ip.ex('execfile("%s")' % os.path.expanduser(fname)) | |
57 |
|
67 | |||
58 | main() |
|
68 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now