##// END OF EJS Templates
Changed how config files are loaded....
Brian Granger -
Show More
@@ -1,29 +1,32 b''
1 # Get the config being loaded so we can set attributes on it
2 c = get_config()
3
1 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
2 # Global options
5 # Global options
3 #-----------------------------------------------------------------------------
6 #-----------------------------------------------------------------------------
4
7
5 # Global.display_banner = True
8 # c.Global.display_banner = True
6
9
7 # Global.classic = False
10 # c.Global.classic = False
8
11
9 # Global.nosep = True
12 # c.Global.nosep = True
10
13
11 # Set this to determine the detail of what is logged at startup.
14 # 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.
15 # The default is 30 and possible values are 0,10,20,30,40,50.
13 # Global.log_level = 30
16 c.Global.log_level = 20
14
17
15 # This should be a list of importable Python modules that have an
18 # 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
19 # 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
20 # 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
21 # 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.
22 # during extension loading, so you can put them there as well.
20 # Global.extensions = [
23 # c.Global.extensions = [
21 # 'myextension'
24 # 'myextension'
22 # ]
25 # ]
23
26
24 # These lines are run in IPython in the user's namespace after extensions
27 # 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.
28 # are loaded. They can contain full IPython syntax with magics etc.
26 # Global.exec_lines = [
29 # c.Global.exec_lines = [
27 # 'import numpy',
30 # 'import numpy',
28 # 'a = 10; b = 20',
31 # 'a = 10; b = 20',
29 # '1/0'
32 # '1/0'
@@ -33,7 +36,7 b''
33 # extension need to be pure Python. Files with a .ipy extension can have
36 # extension need to be pure Python. Files with a .ipy extension can have
34 # custom IPython syntax (like magics, etc.).
37 # custom IPython syntax (like magics, etc.).
35 # These files need to be in the cwd, the ipythondir or be absolute paths.
38 # These files need to be in the cwd, the ipythondir or be absolute paths.
36 # Global.exec_files = [
39 # c.Global.exec_files = [
37 # 'mycode.py',
40 # 'mycode.py',
38 # 'fancy.ipy'
41 # 'fancy.ipy'
39 # ]
42 # ]
@@ -42,56 +45,55 b''
42 # InteractiveShell options
45 # InteractiveShell options
43 #-----------------------------------------------------------------------------
46 #-----------------------------------------------------------------------------
44
47
48 # c.InteractiveShell.autocall = 1
45
49
46 # InteractiveShell.autocall = 1
50 # c.InteractiveShell.autoedit_syntax = False
47
48 # InteractiveShell.autoedit_syntax = False
49
51
50 # InteractiveShell.autoindent = True
52 # c.InteractiveShell.autoindent = True
51
53
52 # InteractiveShell.automagic = False
54 # c.InteractiveShell.automagic = False
53
55
54 # InteractiveShell.banner1 = 'This if for overriding the default IPython banner'
56 # c.InteractiveShell.banner1 = 'This if for overriding the default IPython banner'
55
57
56 # InteractiveShell.banner2 = "This is for extra banner text"
58 # c.InteractiveShell.banner2 = "This is for extra banner text"
57
59
58 # InteractiveShell.cache_size = 1000
60 # c.InteractiveShell.cache_size = 1000
59
61
60 # InteractiveShell.colors = 'LightBG'
62 # c.InteractiveShell.colors = 'LightBG'
61
63
62 # InteractiveShell.color_info = True
64 # c.InteractiveShell.color_info = True
63
65
64 # InteractiveShell.confirm_exit = True
66 # c.InteractiveShell.confirm_exit = True
65
67
66 # InteractiveShell.deep_reload = False
68 # c.InteractiveShell.deep_reload = False
67
69
68 # InteractiveShell.editor = 'nano'
70 # c.InteractiveShell.editor = 'nano'
69
71
70 # InteractiveShell.logstart = True
72 # c.InteractiveShell.logstart = True
71
73
72 # InteractiveShell.logfile = 'ipython_log.py'
74 # c.InteractiveShell.logfile = 'ipython_log.py'
73
75
74 # InteractiveShell.logplay = 'mylog.py'
76 # c.InteractiveShell.logplay = 'mylog.py'
75
77
76 # InteractiveShell.object_info_string_level = 0
78 # c.InteractiveShell.object_info_string_level = 0
77
79
78 # InteractiveShell.pager = 'less'
80 # c.InteractiveShell.pager = 'less'
79
81
80 # InteractiveShell.pdb = False
82 # c.InteractiveShell.pdb = False
81
83
82 # InteractiveShell.pprint = True
84 # c.InteractiveShell.pprint = True
83
85
84 # InteractiveShell.prompt_in1 = 'In [\#]: '
86 # c.InteractiveShell.prompt_in1 = 'In [\#]: '
85 # InteractiveShell.prompt_in2 = ' .\D.: '
87 # c.InteractiveShell.prompt_in2 = ' .\D.: '
86 # InteractiveShell.prompt_out = 'Out[\#]: '
88 # c.InteractiveShell.prompt_out = 'Out[\#]: '
87 # InteractiveShell.prompts_pad_left = True
89 # c.InteractiveShell.prompts_pad_left = True
88
90
89 # InteractiveShell.quiet = False
91 # c.InteractiveShell.quiet = False
90
92
91 # Readline
93 # Readline
92 # InteractiveShell.readline_use = True
94 # c.InteractiveShell.readline_use = True
93
95
94 # InteractiveShell.readline_parse_and_bind = [
96 # c.InteractiveShell.readline_parse_and_bind = [
95 # 'tab: complete',
97 # 'tab: complete',
96 # '"\C-l": possible-completions',
98 # '"\C-l": possible-completions',
97 # 'set show-all-if-ambiguous on',
99 # 'set show-all-if-ambiguous on',
@@ -108,39 +110,39 b''
108 # '"\C-k": kill-line',
110 # '"\C-k": kill-line',
109 # '"\C-u": unix-line-discard',
111 # '"\C-u": unix-line-discard',
110 # ]
112 # ]
111 # InteractiveShell.readline_remove_delims = '-/~'
113 # c.InteractiveShell.readline_remove_delims = '-/~'
112 # InteractiveShell.readline_merge_completions = True
114 # c.InteractiveShell.readline_merge_completions = True
113 # InteractiveShell.readline_omit_names = 0
115 # c.InteractiveShell.readline_omit_names = 0
114
116
115 # InteractiveShell.screen_length = 0
117 # c.InteractiveShell.screen_length = 0
116
118
117 # InteractiveShell.separate_in = '\n'
119 # c.InteractiveShell.separate_in = '\n'
118 # InteractiveShell.separate_out = ''
120 # c.InteractiveShell.separate_out = ''
119 # InteractiveShell.separate_out2 = ''
121 # c.InteractiveShell.separate_out2 = ''
120
122
121 # InteractiveShell.system_header = "IPython system call: "
123 # c.InteractiveShell.system_header = "IPython system call: "
122
124
123 # InteractiveShell.system_verbose = True
125 # c.InteractiveShell.system_verbose = True
124
126
125 # InteractiveShell.term_title = False
127 # c.InteractiveShell.term_title = False
126
128
127 # InteractiveShell.wildcards_case_sensitive = True
129 # c.InteractiveShell.wildcards_case_sensitive = True
128
130
129 # InteractiveShell.xmode = 'Context'
131 # c.InteractiveShell.xmode = 'Context'
130
132
131 #-----------------------------------------------------------------------------
133 #-----------------------------------------------------------------------------
132 # PrefilterManager options
134 # PrefilterManager options
133 #-----------------------------------------------------------------------------
135 #-----------------------------------------------------------------------------
134
136
135 # PrefilterManager.multi_line_specials = True
137 # c.PrefilterManager.multi_line_specials = True
136
138
137 #-----------------------------------------------------------------------------
139 #-----------------------------------------------------------------------------
138 # AliasManager options
140 # AliasManager options
139 #-----------------------------------------------------------------------------
141 #-----------------------------------------------------------------------------
140
142
141 # Do this to enable all defaults
143 # Do this to enable all defaults
142 # AliasManager.default_aliases = []
144 # c.AliasManager.default_aliases = []
143
145
144 # AliasManager.user_aliases = [
146 # c.AliasManager.user_aliases = [
145 # ('foo', 'echo Hi')
147 # ('foo', 'echo Hi')
146 # ] No newline at end of file
148 # ]
@@ -247,12 +247,13 b' class PyFileConfigLoader(FileConfigLoader):'
247 sub_config = loader.load_config()
247 sub_config = loader.load_config()
248 self.config._merge(sub_config)
248 self.config._merge(sub_config)
249
249
250 self.config.load_subconfig = load_subconfig
250 # Again, this needs to be a closure and should be used in config
251 try:
251 # files to get the config being loaded.
252 execfile(self.full_filename, self.config)
252 def get_config():
253 finally:
253 return self.config
254 del self.config.load_subconfig
254
255 del self.config['__builtins__']
255 namespace = dict(load_subconfig=load_subconfig, get_config=get_config)
256 execfile(self.full_filename, namespace)
256
257
257 def _convert_to_config(self):
258 def _convert_to_config(self):
258 if self.data is None:
259 if self.data is None:
@@ -1,3 +1,5 b''
1 c = get_config()
2
1 # This can be used at any point in a config file to load a sub config
3 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
4 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
5 load_subconfig('ipython_config.py')
@@ -10,8 +12,8 b' from math import *'
10 # You have to make sure that attributes that are containers already
12 # You have to make sure that attributes that are containers already
11 # exist before using them. Simple assigning a new list will override
13 # exist before using them. Simple assigning a new list will override
12 # all previous values.
14 # all previous values.
13 if hasattr(Global, 'exec_lines'):
15 if hasattr(c.Global, 'exec_lines'):
14 Global.exec_lines.append(lines)
16 c.Global.exec_lines.append(lines)
15 else:
17 else:
16 Global.exec_lines = [lines]
18 c.Global.exec_lines = [lines]
17
19
@@ -1,3 +1,5 b''
1 c = get_config()
2
1 # This can be used at any point in a config file to load a sub config
3 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
4 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
5 load_subconfig('ipython_config.py')
@@ -12,7 +14,7 b' import scipy as sp'
12 # You have to make sure that attributes that are containers already
14 # You have to make sure that attributes that are containers already
13 # exist before using them. Simple assigning a new list will override
15 # exist before using them. Simple assigning a new list will override
14 # all previous values.
16 # all previous values.
15 if hasattr(Global, 'exec_lines'):
17 if hasattr(c.Global, 'exec_lines'):
16 Global.exec_lines.append(lines)
18 c.Global.exec_lines.append(lines)
17 else:
19 else:
18 Global.exec_lines = [lines] No newline at end of file
20 c.Global.exec_lines = [lines] No newline at end of file
@@ -1,3 +1,5 b''
1 c = get_config()
2
1 # This can be used at any point in a config file to load a sub config
3 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
4 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
5 load_subconfig('ipython_config.py')
@@ -14,7 +16,7 b' from matplotlib.pyplot import *'
14 # You have to make sure that attributes that are containers already
16 # You have to make sure that attributes that are containers already
15 # exist before using them. Simple assigning a new list will override
17 # exist before using them. Simple assigning a new list will override
16 # all previous values.
18 # all previous values.
17 if hasattr(Global, 'exec_lines'):
19 if hasattr(c.Global, 'exec_lines'):
18 Global.exec_lines.append(lines)
20 c.Global.exec_lines.append(lines)
19 else:
21 else:
20 Global.exec_lines = [lines] No newline at end of file
22 c.Global.exec_lines = [lines] No newline at end of file
@@ -1,18 +1,20 b''
1 c = get_config()
2
1 # This can be used at any point in a config file to load a sub config
3 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
4 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
5 load_subconfig('ipython_config.py')
4
6
5 InteractiveShell.prompt_in1 = '\C_LightGreen\u@\h\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> '
7 c.InteractiveShell.prompt_in1 = '\C_LightGreen\u@\h\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> '
6 InteractiveShell.prompt_in2 = '\C_Green|\C_LightGreen\D\C_Green> '
8 c.InteractiveShell.prompt_in2 = '\C_Green|\C_LightGreen\D\C_Green> '
7 InteractiveShell.prompt_out = '<\#> '
9 c.InteractiveShell.prompt_out = '<\#> '
8
10
9 InteractiveShell.prompts_pad_left = True
11 c.InteractiveShell.prompts_pad_left = True
10
12
11 InteractiveShell.separate_in = ''
13 c.InteractiveShell.separate_in = ''
12 InteractiveShell.separate_out = ''
14 c.InteractiveShell.separate_out = ''
13 InteractiveShell.separate_out2 = ''
15 c.InteractiveShell.separate_out2 = ''
14
16
15 PrefilterManager.multi_line_specials = True
17 c.PrefilterManager.multi_line_specials = True
16
18
17 lines = """
19 lines = """
18 %rehashx
20 %rehashx
@@ -21,7 +23,7 b' lines = """'
21 # You have to make sure that attributes that are containers already
23 # You have to make sure that attributes that are containers already
22 # exist before using them. Simple assigning a new list will override
24 # exist before using them. Simple assigning a new list will override
23 # all previous values.
25 # all previous values.
24 if hasattr(Global, 'exec_lines'):
26 if hasattr(c.Global, 'exec_lines'):
25 Global.exec_lines.append(lines)
27 c.Global.exec_lines.append(lines)
26 else:
28 else:
27 Global.exec_lines = [lines] No newline at end of file
29 c.Global.exec_lines = [lines] No newline at end of file
@@ -1,3 +1,5 b''
1 c = get_config()
2
1 # This can be used at any point in a config file to load a sub config
3 # This can be used at any point in a config file to load a sub config
2 # and merge it into the current one.
4 # and merge it into the current one.
3 load_subconfig('ipython_config.py')
5 load_subconfig('ipython_config.py')
@@ -13,7 +15,7 b" f, g, h = map(Function, 'fgh')"
13 # You have to make sure that attributes that are containers already
15 # You have to make sure that attributes that are containers already
14 # exist before using them. Simple assigning a new list will override
16 # exist before using them. Simple assigning a new list will override
15 # all previous values.
17 # all previous values.
16 if hasattr(Global, 'exec_lines'):
18 if hasattr(c.Global, 'exec_lines'):
17 Global.exec_lines.append(lines)
19 c.Global.exec_lines.append(lines)
18 else:
20 else:
19 Global.exec_lines = [lines]
21 c.Global.exec_lines = [lines]
General Comments 0
You need to be logged in to leave comments. Login now