Show More
@@ -1,107 +1,116 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 |
|
30 | |||
31 | # uncomment if you want to get ipython -p sh behaviour |
|
31 | # uncomment if you want to get ipython -p sh behaviour | |
32 | # without having to use command line switches |
|
32 | # without having to use command line switches | |
33 | # import ipy_profile_sh |
|
33 | # import ipy_profile_sh | |
34 |
|
34 | |||
35 | # Configure your favourite editor? |
|
35 | # Configure your favourite editor? | |
36 | # Good idea e.g. for %edit os.path.isfile |
|
36 | # Good idea e.g. for %edit os.path.isfile | |
37 |
|
37 | |||
38 | #import ipy_editors |
|
38 | #import ipy_editors | |
39 |
|
39 | |||
40 | # Choose one of these: |
|
40 | # Choose one of these: | |
41 |
|
41 | |||
42 | #ipy_editors.scite() |
|
42 | #ipy_editors.scite() | |
43 | #ipy_editors.scite('c:/opt/scite/scite.exe') |
|
43 | #ipy_editors.scite('c:/opt/scite/scite.exe') | |
44 | #ipy_editors.komodo() |
|
44 | #ipy_editors.komodo() | |
45 | #ipy_editors.idle() |
|
45 | #ipy_editors.idle() | |
46 | # ... or many others, try 'ipy_editors??' after import to see them |
|
46 | # ... or many others, try 'ipy_editors??' after import to see them | |
47 |
|
47 | |||
48 | # Or roll your own: |
|
48 | # Or roll your own: | |
49 | #ipy_editors.install_editor("c:/opt/jed +$line $file") |
|
49 | #ipy_editors.install_editor("c:/opt/jed +$line $file") | |
50 |
|
50 | |||
51 |
|
51 | |||
52 | o = ip.options |
|
52 | o = ip.options | |
53 | # An example on how to set options |
|
53 | # An example on how to set options | |
54 | #o.autocall = 1 |
|
54 | #o.autocall = 1 | |
55 | o.system_verbose = 0 |
|
55 | o.system_verbose = 0 | |
56 |
|
56 | |||
57 | #import_all("os sys") |
|
57 | #import_all("os sys") | |
58 | #execf('~/_ipython/ns.py') |
|
58 | #execf('~/_ipython/ns.py') | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | # -- prompt |
|
61 | # -- prompt | |
62 | # A different, more compact set of prompts from the default ones, that |
|
62 | # A different, more compact set of prompts from the default ones, that | |
63 | # always show your current location in the filesystem: |
|
63 | # always show your current location in the filesystem: | |
64 |
|
64 | |||
65 | #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>' |
|
65 | #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>' | |
66 | #o.prompt_in2 = r'.\D: ' |
|
66 | #o.prompt_in2 = r'.\D: ' | |
67 | #o.prompt_out = r'[\#] ' |
|
67 | #o.prompt_out = r'[\#] ' | |
68 |
|
68 | |||
69 | # Try one of these color settings if you can't read the text easily |
|
69 | # Try one of these color settings if you can't read the text easily | |
70 | # autoexec is a list of IPython commands to execute on startup |
|
70 | # autoexec is a list of IPython commands to execute on startup | |
71 | #o.autoexec.append('%colors LightBG') |
|
71 | #o.autoexec.append('%colors LightBG') | |
72 | #o.autoexec.append('%colors NoColor') |
|
72 | #o.autoexec.append('%colors NoColor') | |
73 | #o.autoexec.append('%colors Linux') |
|
73 | #o.autoexec.append('%colors Linux') | |
74 |
|
74 | |||
75 | # for sane integer division that converts to float (1/2 == 0.5) |
|
75 | # for sane integer division that converts to float (1/2 == 0.5) | |
76 | #o.autoexec.append('from __future__ import division') |
|
76 | #o.autoexec.append('from __future__ import division') | |
77 |
|
77 | |||
78 | # For %tasks and %kill |
|
78 | # For %tasks and %kill | |
79 | #import jobctrl |
|
79 | #import jobctrl | |
80 |
|
80 | |||
81 | # For autoreloading of modules (%autoreload, %aimport) |
|
81 | # For autoreloading of modules (%autoreload, %aimport) | |
82 | #import ipy_autoreload |
|
82 | #import ipy_autoreload | |
83 |
|
83 | |||
84 | # For winpdb support (%wdb) |
|
84 | # For winpdb support (%wdb) | |
85 | #import ipy_winpdb |
|
85 | #import ipy_winpdb | |
86 |
|
86 | |||
87 | # For bzr completer, requires bzrlib (the python installation of bzr) |
|
87 | # For bzr completer, requires bzrlib (the python installation of bzr) | |
88 | #ip.load('ipy_bzr') |
|
88 | #ip.load('ipy_bzr') | |
89 |
|
89 | |||
90 | # Tab completer that is not quite so picky (i.e. |
|
90 | # Tab completer that is not quite so picky (i.e. | |
91 | # "foo".<TAB> and str(2).<TAB> will work). Complete |
|
91 | # "foo".<TAB> and str(2).<TAB> will work). Complete | |
92 | # at your own risk! |
|
92 | # at your own risk! | |
93 | #import ipy_greedycompleter |
|
93 | #import ipy_greedycompleter | |
94 |
|
94 | |||
|
95 | # If you are on Linux, you may be annoyed by | |||
|
96 | # "Display all N possibilities? (y or n)" on tab completion, | |||
|
97 | # as well as the paging through "more". Uncomment the following | |||
|
98 | # lines to disable that behaviour | |||
|
99 | #import readline | |||
|
100 | #readline.parse_and_bind('set completion-query-items 1000') | |||
|
101 | #readline.parse_and_bind('set page-completions no') | |||
|
102 | ||||
|
103 | ||||
95 |
|
104 | |||
96 |
|
105 | |||
97 | # some config helper functions you can use |
|
106 | # some config helper functions you can use | |
98 | def import_all(modules): |
|
107 | def import_all(modules): | |
99 | """ Usage: import_all("os sys") """ |
|
108 | """ Usage: import_all("os sys") """ | |
100 | for m in modules.split(): |
|
109 | for m in modules.split(): | |
101 | ip.ex("from %s import *" % m) |
|
110 | ip.ex("from %s import *" % m) | |
102 |
|
111 | |||
103 | def execf(fname): |
|
112 | def execf(fname): | |
104 | """ Execute a file in user namespace """ |
|
113 | """ Execute a file in user namespace """ | |
105 | ip.ex('execfile("%s")' % os.path.expanduser(fname)) |
|
114 | ip.ex('execfile("%s")' % os.path.expanduser(fname)) | |
106 |
|
115 | |||
107 | main() |
|
116 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now