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