##// END OF EJS Templates
Config system is finished!...
Brian Granger -
Show More
@@ -2,106 +2,137 b''
2 # Global options
2 # Global options
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4
4
5 Global.classic = False
5 # Global.display_banner = True
6 Global.nosep = False
6
7 # Global.classic = False
8
9 # Global.nosep = True
10
11 # Set this to determine the detail of what is logged at startup.
12 # The default is 30 and possible values are 0,10,20,30,40,50.
13 # Global.log_level = 30
14
15 # This should be a list of importable Python modules that have an
16 # load_in_ipython(ip) method. This method gets called when the extension
17 # is loaded. You can put your extensions anywhere they can be imported
18 # but we add the extensions subdir of the ipython directory to sys.path
19 # during extension loading, so you can put them there as well.
20 # Global.extensions = [
21 # 'myextension'
22 # ]
23
24 # These lines are run in IPython in the user's namespace after extensions
25 # are loaded. They can contain full IPython syntax with magics etc.
26 # Global.exec_lines = [
27 # 'import numpy',
28 # 'a = 10; b = 20',
29 # '1/0'
30 # ]
31
32 # These files are run in IPython in the user's namespace. Files with a .py
33 # extension need to be pure Python. Files with a .ipy extension can have
34 # custom IPython syntax (like magics, etc.).
35 # These files need to be in the cwd, the ipythondir or be absolute paths.
36 # Global.exec_files = [
37 # 'mycode.py',
38 # 'fancy.ipy'
39 # ]
7
40
8 #-----------------------------------------------------------------------------
41 #-----------------------------------------------------------------------------
9 # InteractiveShell options
42 # InteractiveShell options
10 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
11
44
12
45
13 InteractiveShell.autocall = 1
46 # InteractiveShell.autocall = 1
14
47
15 InteractiveShell.autoedit_syntax = False
48 # InteractiveShell.autoedit_syntax = False
16
49
17 InteractiveShell.autoindent = True
50 # InteractiveShell.autoindent = True
18
51
19 InteractiveShell.automagic = False
52 # InteractiveShell.automagic = False
20
53
21 InteractiveShell.banner1 = 'This if for overriding the default IPython banner'
54 # InteractiveShell.banner1 = 'This if for overriding the default IPython banner'
22
55
23 InteractiveShell.banner2 = "This is for extra banner text"
56 # InteractiveShell.banner2 = "This is for extra banner text"
24
57
25 InteractiveShell.cache_size = 1000
58 # InteractiveShell.cache_size = 1000
26
59
27 InteractiveShell.colors = 'LightBG'
60 # InteractiveShell.colors = 'LightBG'
28
61
29 InteractiveShell.color_info = True
62 # InteractiveShell.color_info = True
30
63
31 InteractiveShell.confirm_exit = True
64 # InteractiveShell.confirm_exit = True
32
65
33 InteractiveShell.deep_reload = False
66 # InteractiveShell.deep_reload = False
34
67
35 InteractiveShell.display_banner = True
68 # InteractiveShell.editor = 'nano'
36
69
37 InteractiveShell.editor = 'nano'
70 # InteractiveShell.logstart = True
38
71
39 InteractiveShell.logstart = True
72 # InteractiveShell.logfile = 'ipython_log.py'
40
73
41 InteractiveShell.logfile = 'ipython_log.py'
74 # InteractiveShell.logplay = 'mylog.py'
42
75
43 InteractiveShell.logplay = 'mylog.py'
76 # InteractiveShell.object_info_string_level = 0
44
77
45 InteractiveShell.object_info_string_level = 0
78 # InteractiveShell.pager = 'less'
46
79
47 InteractiveShell.pager = 'less'
80 # InteractiveShell.pdb = False
48
81
49 InteractiveShell.pdb = False
82 # InteractiveShell.pprint = True
50
83
51 InteractiveShell.pprint = True
84 # InteractiveShell.prompt_in1 = 'In [\#]: '
85 # InteractiveShell.prompt_in2 = ' .\D.: '
86 # InteractiveShell.prompt_out = 'Out[\#]: '
87 # InteractiveShell.prompts_pad_left = True
52
88
53 InteractiveShell.prompt_in1 = 'In [\#]: '
89 # InteractiveShell.quiet = False
54 InteractiveShell.prompt_in2 = ' .\D.: '
55 InteractiveShell.prompt_out = 'Out[\#]: '
56 InteractiveShell.prompts_pad_left = True
57
58 InteractiveShell.quiet = False
59
90
60 # Readline
91 # Readline
61 InteractiveShell.readline_use = False
92 # InteractiveShell.readline_use = True
62
93
63 InteractiveShell.readline_parse_and_bind = [
94 # InteractiveShell.readline_parse_and_bind = [
64 'tab: complete',
95 # 'tab: complete',
65 '"\C-l": possible-completions',
96 # '"\C-l": possible-completions',
66 'set show-all-if-ambiguous on',
97 # 'set show-all-if-ambiguous on',
67 '"\C-o": tab-insert',
98 # '"\C-o": tab-insert',
68 '"\M-i": " "',
99 # '"\M-i": " "',
69 '"\M-o": "\d\d\d\d"',
100 # '"\M-o": "\d\d\d\d"',
70 '"\M-I": "\d\d\d\d"',
101 # '"\M-I": "\d\d\d\d"',
71 '"\C-r": reverse-search-history',
102 # '"\C-r": reverse-search-history',
72 '"\C-s": forward-search-history',
103 # '"\C-s": forward-search-history',
73 '"\C-p": history-search-backward',
104 # '"\C-p": history-search-backward',
74 '"\C-n": history-search-forward',
105 # '"\C-n": history-search-forward',
75 '"\e[A": history-search-backward',
106 # '"\e[A": history-search-backward',
76 '"\e[B": history-search-forward',
107 # '"\e[B": history-search-forward',
77 '"\C-k": kill-line',
108 # '"\C-k": kill-line',
78 '"\C-u": unix-line-discard',
109 # '"\C-u": unix-line-discard',
79 ]
110 # ]
80 InteractiveShell.readline_remove_delims = '-/~'
111 # InteractiveShell.readline_remove_delims = '-/~'
81 InteractiveShell.readline_merge_completions = True
112 # InteractiveShell.readline_merge_completions = True
82 InteractiveShell.readline_omit_names = 0
113 # InteractiveShell.readline_omit_names = 0
83
114
84 InteractiveShell.screen_length = 0
115 # InteractiveShell.screen_length = 0
85
116
86 InteractiveShell.separate_in = '\n'
117 # InteractiveShell.separate_in = '\n'
87 InteractiveShell.separate_out = ''
118 # InteractiveShell.separate_out = ''
88 InteractiveShell.separate_out2 = ''
119 # InteractiveShell.separate_out2 = ''
89
120
90 InteractiveShell.system_header = "IPython system call: "
121 # InteractiveShell.system_header = "IPython system call: "
91
122
92 InteractiveShell.system_verbose = True
123 # InteractiveShell.system_verbose = True
93
124
94 InteractiveShell.term_title = False
125 # InteractiveShell.term_title = False
95
126
96 InteractiveShell.wildcards_case_sensitive = True
127 # InteractiveShell.wildcards_case_sensitive = True
97
128
98 InteractiveShell.xmode = 'Context'
129 # InteractiveShell.xmode = 'Context'
99
130
100 #-----------------------------------------------------------------------------
131 #-----------------------------------------------------------------------------
101 # PrefilterManager options
132 # PrefilterManager options
102 #-----------------------------------------------------------------------------
133 #-----------------------------------------------------------------------------
103
134
104 PrefilterManager.multi_line_specials = True
135 # PrefilterManager.multi_line_specials = True
105
136
106 #-----------------------------------------------------------------------------
137 #-----------------------------------------------------------------------------
107 # AliasManager options
138 # AliasManager options
@@ -110,6 +141,6 b' PrefilterManager.multi_line_specials = True'
110 # Do this to enable all defaults
141 # Do this to enable all defaults
111 # AliasManager.default_aliases = []
142 # AliasManager.default_aliases = []
112
143
113 AliasManger.user_aliases = [
144 # AliasManger.user_aliases = [
114 ('foo', 'echo Hi')
145 # ('foo', 'echo Hi')
115 ] No newline at end of file
146 # ] No newline at end of file
@@ -234,12 +234,29 b' class PyFileConfigLoader(FileConfigLoader):'
234 self.full_filename = filefind(self.filename, self.path)
234 self.full_filename = filefind(self.filename, self.path)
235
235
236 def _read_file_as_dict(self):
236 def _read_file_as_dict(self):
237 execfile(self.full_filename, self.config)
237 """Load the config file into self.config, with recursive loading."""
238 # This closure is made available in the namespace that is used
239 # to exec the config file. This allows users to call
240 # load_subconfig('myconfig.py') to load config files recursively.
241 # It needs to be a closure because it has references to self.path
242 # and self.config. The sub-config is loaded with the same path
243 # as the parent, but it uses an empty config which is then merged
244 # with the parents.
245 def load_subconfig(fname):
246 loader = PyFileConfigLoader(fname, self.path)
247 sub_config = loader.load_config()
248 self.config._merge(sub_config)
249
250 self.config.load_subconfig = load_subconfig
251 try:
252 execfile(self.full_filename, self.config)
253 finally:
254 del self.config.load_subconfig
255 del self.config['__builtins__']
238
256
239 def _convert_to_config(self):
257 def _convert_to_config(self):
240 if self.data is None:
258 if self.data is None:
241 ConfigLoaderError('self.data does not exist')
259 ConfigLoaderError('self.data does not exist')
242 del self.config['__builtins__']
243
260
244
261
245 class CommandLineConfigLoader(ConfigLoader):
262 class CommandLineConfigLoader(ConfigLoader):
@@ -1,8 +1,17 b''
1 from ipython_config import *
1 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
2
4
3 Global.exec_lines.extend([
5 lines = """
4 'import cmath',
6 import cmath
5 'from math import *',
7 from math import *
6 'print "*** math functions available globally, cmath as a module"'
8 """
7 ])
9
10 # You have to make sure that attributes that are containers already
11 # exist before using them. Simple assigning a new list will override
12 # all previous values.
13 if hasattr(Global, 'exec_lines'):
14 Global.exec_lines.append(lines)
15 else:
16 Global.exec_lines = [lines]
8
17
@@ -1,8 +1,18 b''
1 from ipython_config import *
1 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
2
4
3 Global.exec_lines.extend([
5 lines = """
4 'import numpy',
6 import numpy
5 'import scipy',
7 import scipy
6 'import numpy as np',
8 import numpy as np
7 'import scipy as sp',
9 import scipy as sp
8 ]) No newline at end of file
10 """
11
12 # You have to make sure that attributes that are containers already
13 # exist before using them. Simple assigning a new list will override
14 # all previous values.
15 if hasattr(Global, 'exec_lines'):
16 Global.exec_lines.append(lines)
17 else:
18 Global.exec_lines = [lines] No newline at end of file
@@ -1,8 +1,20 b''
1 from ipython_config_numeric import *
1 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
2
4
3 Global.exec_lines.extend([
5 lines = """
4 'import matplotlib',
6 import matplotlib
5 'from matplotlib import pyplot as plt',
7 %gui -a wx
6 'from matplotlib.pyplot import *'
8 matplotlib.use('wxagg')
7 ])
9 matplotlib.interactive(True)
10 from matplotlib import pyplot as plt
11 from matplotlib.pyplot import *
12 """
8
13
14 # You have to make sure that attributes that are containers already
15 # exist before using them. Simple assigning a new list will override
16 # all previous values.
17 if hasattr(Global, 'exec_lines'):
18 Global.exec_lines.append(lines)
19 else:
20 Global.exec_lines = [lines] No newline at end of file
@@ -1,6 +1,8 b''
1 from ipython_config import *
1 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
2
4
3 InteractiveShell.prompt_in2 = '\C_LightGreen\u@\h\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> '
5 InteractiveShell.prompt_in1 = '\C_LightGreen\u@\h\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> '
4 InteractiveShell.prompt_in2 = '\C_Green|\C_LightGreen\D\C_Green> '
6 InteractiveShell.prompt_in2 = '\C_Green|\C_LightGreen\D\C_Green> '
5 InteractiveShell.prompt_out = '<\#> '
7 InteractiveShell.prompt_out = '<\#> '
6
8
@@ -10,4 +12,16 b" InteractiveShell.separate_in = ''"
10 InteractiveShell.separate_out = ''
12 InteractiveShell.separate_out = ''
11 InteractiveShell.separate_out2 = ''
13 InteractiveShell.separate_out2 = ''
12
14
13 PrefilterManager.multi_line_specials = True No newline at end of file
15 PrefilterManager.multi_line_specials = True
16
17 lines = """
18 %rehashx
19 """
20
21 # You have to make sure that attributes that are containers already
22 # exist before using them. Simple assigning a new list will override
23 # all previous values.
24 if hasattr(Global, 'exec_lines'):
25 Global.exec_lines.append(lines)
26 else:
27 Global.exec_lines = [lines] No newline at end of file
@@ -1,9 +1,19 b''
1 from ipython_config import *
1 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
2
4
3 Global.exec_lines.extend([
5 lines = """
4 "from __future__ import division"
6 from __future__ import division
5 "from sympy import *"
7 from sympy import *
6 "x, y, z = symbols('xyz')"
8 x, y, z = symbols('xyz')
7 "k, m, n = symbols('kmn', integer=True)"
9 k, m, n = symbols('kmn', integer=True)
8 "f, g, h = map(Function, 'fgh')"
10 f, g, h = map(Function, 'fgh')
9 ])
11 """
12
13 # You have to make sure that attributes that are containers already
14 # exist before using them. Simple assigning a new list will override
15 # all previous values.
16 if hasattr(Global, 'exec_lines'):
17 Global.exec_lines.append(lines)
18 else:
19 Global.exec_lines = [lines]
General Comments 0
You need to be logged in to leave comments. Login now