Show More
@@ -35,7 +35,7 b' c = get_config()' | |||||
35 | # These files are run in IPython in the user's namespace. Files with a .py |
|
35 | # These files are run in IPython in the user's namespace. Files with a .py | |
36 | # 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 | |
37 | # custom IPython syntax (like magics, etc.). |
|
37 | # custom IPython syntax (like magics, etc.). | |
38 | # These files need to be in the cwd, the ipythondir or be absolute paths. |
|
38 | # These files need to be in the cwd, the ipython_dir or be absolute paths. | |
39 | # c.Global.exec_files = [ |
|
39 | # c.Global.exec_files = [ | |
40 | # 'mycode.py', |
|
40 | # 'mycode.py', | |
41 | # 'fancy.ipy' |
|
41 | # 'fancy.ipy' |
@@ -51,22 +51,22 b' class BaseAppArgParseConfigLoader(ArgParseConfigLoader):' | |||||
51 | """Default command line options for IPython based applications.""" |
|
51 | """Default command line options for IPython based applications.""" | |
52 |
|
52 | |||
53 | def _add_other_arguments(self): |
|
53 | def _add_other_arguments(self): | |
54 |
self.parser.add_argument(' |
|
54 | self.parser.add_argument('--ipython-dir', | |
55 | dest='Global.ipythondir',type=str, |
|
55 | dest='Global.ipython_dir',type=str, | |
56 | help='Set to override default location of Global.ipythondir.', |
|
56 | help='Set to override default location of Global.ipython_dir.', | |
57 | default=NoConfigDefault, |
|
57 | default=NoConfigDefault, | |
58 | metavar='Global.ipythondir') |
|
58 | metavar='Global.ipython_dir') | |
59 |
self.parser.add_argument('-p', |
|
59 | self.parser.add_argument('-p', '--profile', | |
60 | dest='Global.profile',type=str, |
|
60 | dest='Global.profile',type=str, | |
61 | help='The string name of the ipython profile to be used.', |
|
61 | help='The string name of the ipython profile to be used.', | |
62 | default=NoConfigDefault, |
|
62 | default=NoConfigDefault, | |
63 | metavar='Global.profile') |
|
63 | metavar='Global.profile') | |
64 |
self.parser.add_argument(' |
|
64 | self.parser.add_argument('--log-level', | |
65 | dest="Global.log_level",type=int, |
|
65 | dest="Global.log_level",type=int, | |
66 | help='Set the log level (0,10,20,30,40,50). Default is 30.', |
|
66 | help='Set the log level (0,10,20,30,40,50). Default is 30.', | |
67 | default=NoConfigDefault, |
|
67 | default=NoConfigDefault, | |
68 | metavar='Global.log_level') |
|
68 | metavar='Global.log_level') | |
69 |
self.parser.add_argument(' |
|
69 | self.parser.add_argument('--config-file', | |
70 | dest='Global.config_file',type=str, |
|
70 | dest='Global.config_file',type=str, | |
71 | help='Set the config file name to override default.', |
|
71 | help='Set the config file name to override default.', | |
72 | default=NoConfigDefault, |
|
72 | default=NoConfigDefault, | |
@@ -119,7 +119,7 b' class Application(object):' | |||||
119 | self.set_command_line_config_log_level() |
|
119 | self.set_command_line_config_log_level() | |
120 | self.attempt(self.post_load_command_line_config) |
|
120 | self.attempt(self.post_load_command_line_config) | |
121 | self.log_command_line_config() |
|
121 | self.log_command_line_config() | |
122 | self.attempt(self.find_ipythondir) |
|
122 | self.attempt(self.find_ipython_dir) | |
123 | self.attempt(self.find_resources) |
|
123 | self.attempt(self.find_resources) | |
124 | self.attempt(self.find_config_file_name) |
|
124 | self.attempt(self.find_config_file_name) | |
125 | self.attempt(self.find_config_file_paths) |
|
125 | self.attempt(self.find_config_file_paths) | |
@@ -149,7 +149,7 b' class Application(object):' | |||||
149 | don't belong to a particular component. |
|
149 | don't belong to a particular component. | |
150 | """ |
|
150 | """ | |
151 | self.default_config = Config() |
|
151 | self.default_config = Config() | |
152 | self.default_config.Global.ipythondir = get_ipython_dir() |
|
152 | self.default_config.Global.ipython_dir = get_ipython_dir() | |
153 | self.default_config.Global.log_level = self.log_level |
|
153 | self.default_config.Global.log_level = self.log_level | |
154 |
|
154 | |||
155 | def log_default_config(self): |
|
155 | def log_default_config(self): | |
@@ -194,24 +194,24 b' class Application(object):' | |||||
194 | self.log.debug("Command line config loaded:") |
|
194 | self.log.debug("Command line config loaded:") | |
195 | self.log.debug(repr(self.command_line_config)) |
|
195 | self.log.debug(repr(self.command_line_config)) | |
196 |
|
196 | |||
197 | def find_ipythondir(self): |
|
197 | def find_ipython_dir(self): | |
198 | """Set the IPython directory. |
|
198 | """Set the IPython directory. | |
199 |
|
199 | |||
200 | This sets ``self.ipythondir``, but the actual value that is passed |
|
200 | This sets ``self.ipython_dir``, but the actual value that is passed | |
201 | to the application is kept in either ``self.default_config`` or |
|
201 | to the application is kept in either ``self.default_config`` or | |
202 | ``self.command_line_config``. This also adds ``self.ipythondir`` to |
|
202 | ``self.command_line_config``. This also adds ``self.ipython_dir`` to | |
203 | ``sys.path`` so config files there can be references by other config |
|
203 | ``sys.path`` so config files there can be references by other config | |
204 | files. |
|
204 | files. | |
205 | """ |
|
205 | """ | |
206 |
|
206 | |||
207 | try: |
|
207 | try: | |
208 | self.ipythondir = self.command_line_config.Global.ipythondir |
|
208 | self.ipython_dir = self.command_line_config.Global.ipython_dir | |
209 | except AttributeError: |
|
209 | except AttributeError: | |
210 | self.ipythondir = self.default_config.Global.ipythondir |
|
210 | self.ipython_dir = self.default_config.Global.ipython_dir | |
211 | sys.path.append(os.path.abspath(self.ipythondir)) |
|
211 | sys.path.append(os.path.abspath(self.ipython_dir)) | |
212 | if not os.path.isdir(self.ipythondir): |
|
212 | if not os.path.isdir(self.ipython_dir): | |
213 | os.makedirs(self.ipythondir, mode=0777) |
|
213 | os.makedirs(self.ipython_dir, mode=0777) | |
214 | self.log.debug("IPYTHONDIR set to: %s" % self.ipythondir) |
|
214 | self.log.debug("IPYTHON_DIR set to: %s" % self.ipython_dir) | |
215 |
|
215 | |||
216 | def find_resources(self): |
|
216 | def find_resources(self): | |
217 | """Find other resources that need to be in place. |
|
217 | """Find other resources that need to be in place. | |
@@ -253,7 +253,7 b' class Application(object):' | |||||
253 | This must set ``self.config_file_paths`` to a sequence of search |
|
253 | This must set ``self.config_file_paths`` to a sequence of search | |
254 | paths to pass to the config file loader. |
|
254 | paths to pass to the config file loader. | |
255 | """ |
|
255 | """ | |
256 | self.config_file_paths = (os.getcwd(), self.ipythondir) |
|
256 | self.config_file_paths = (os.getcwd(), self.ipython_dir) | |
257 |
|
257 | |||
258 | def pre_load_file_config(self): |
|
258 | def pre_load_file_config(self): | |
259 | """Do actions before the config file is loaded.""" |
|
259 | """Do actions before the config file is loaded.""" |
@@ -124,7 +124,7 b' $self.bug_tracker' | |||||
124 | #color_scheme = 'Linux' # dbg |
|
124 | #color_scheme = 'Linux' # dbg | |
125 |
|
125 | |||
126 | try: |
|
126 | try: | |
127 |
rptdir = self.IP. |
|
127 | rptdir = self.IP.ipython_dir | |
128 | except: |
|
128 | except: | |
129 | rptdir = os.getcwd() |
|
129 | rptdir = os.getcwd() | |
130 | if not os.path.isdir(rptdir): |
|
130 | if not os.path.isdir(rptdir): |
@@ -68,7 +68,7 b' class InteractiveShellEmbed(InteractiveShell):' | |||||
68 | # is True by default. |
|
68 | # is True by default. | |
69 | display_banner = CBool(True) |
|
69 | display_banner = CBool(True) | |
70 |
|
70 | |||
71 | def __init__(self, parent=None, config=None, ipythondir=None, usage=None, |
|
71 | def __init__(self, parent=None, config=None, ipython_dir=None, usage=None, | |
72 | user_ns=None, user_global_ns=None, |
|
72 | user_ns=None, user_global_ns=None, | |
73 | banner1=None, banner2=None, display_banner=None, |
|
73 | banner1=None, banner2=None, display_banner=None, | |
74 | custom_exceptions=((),None), exit_msg=''): |
|
74 | custom_exceptions=((),None), exit_msg=''): | |
@@ -76,7 +76,7 b' class InteractiveShellEmbed(InteractiveShell):' | |||||
76 | self.save_sys_ipcompleter() |
|
76 | self.save_sys_ipcompleter() | |
77 |
|
77 | |||
78 | super(InteractiveShellEmbed,self).__init__( |
|
78 | super(InteractiveShellEmbed,self).__init__( | |
79 | parent=parent, config=config, ipythondir=ipythondir, usage=usage, |
|
79 | parent=parent, config=config, ipython_dir=ipython_dir, usage=usage, | |
80 | user_ns=user_ns, user_global_ns=user_global_ns, |
|
80 | user_ns=user_ns, user_global_ns=user_global_ns, | |
81 | banner1=banner1, banner2=banner2, display_banner=display_banner, |
|
81 | banner1=banner1, banner2=banner2, display_banner=display_banner, | |
82 | custom_exceptions=custom_exceptions) |
|
82 | custom_exceptions=custom_exceptions) |
@@ -79,181 +79,181 b' See the %gui magic for information on the new interface.' | |||||
79 | #----------------------------------------------------------------------------- |
|
79 | #----------------------------------------------------------------------------- | |
80 |
|
80 | |||
81 | cl_args = ( |
|
81 | cl_args = ( | |
82 | (('-autocall',), dict( |
|
82 | (('--autocall',), dict( | |
83 | type=int, dest='InteractiveShell.autocall', default=NoConfigDefault, |
|
83 | type=int, dest='InteractiveShell.autocall', default=NoConfigDefault, | |
84 | help='Set the autocall value (0,1,2).', |
|
84 | help='Set the autocall value (0,1,2).', | |
85 | metavar='InteractiveShell.autocall') |
|
85 | metavar='InteractiveShell.autocall') | |
86 | ), |
|
86 | ), | |
87 | (('-autoindent',), dict( |
|
87 | (('--autoindent',), dict( | |
88 | action='store_true', dest='InteractiveShell.autoindent', default=NoConfigDefault, |
|
88 | action='store_true', dest='InteractiveShell.autoindent', default=NoConfigDefault, | |
89 | help='Turn on autoindenting.') |
|
89 | help='Turn on autoindenting.') | |
90 | ), |
|
90 | ), | |
91 | (('-noautoindent',), dict( |
|
91 | (('--no-autoindent',), dict( | |
92 | action='store_false', dest='InteractiveShell.autoindent', default=NoConfigDefault, |
|
92 | action='store_false', dest='InteractiveShell.autoindent', default=NoConfigDefault, | |
93 | help='Turn off autoindenting.') |
|
93 | help='Turn off autoindenting.') | |
94 | ), |
|
94 | ), | |
95 | (('-automagic',), dict( |
|
95 | (('--automagic',), dict( | |
96 | action='store_true', dest='InteractiveShell.automagic', default=NoConfigDefault, |
|
96 | action='store_true', dest='InteractiveShell.automagic', default=NoConfigDefault, | |
97 | help='Turn on the auto calling of magic commands.') |
|
97 | help='Turn on the auto calling of magic commands.') | |
98 | ), |
|
98 | ), | |
99 | (('-noautomagic',), dict( |
|
99 | (('--no-automagic',), dict( | |
100 | action='store_false', dest='InteractiveShell.automagic', default=NoConfigDefault, |
|
100 | action='store_false', dest='InteractiveShell.automagic', default=NoConfigDefault, | |
101 | help='Turn off the auto calling of magic commands.') |
|
101 | help='Turn off the auto calling of magic commands.') | |
102 | ), |
|
102 | ), | |
103 |
(('-autoedit |
|
103 | (('--autoedit-syntax',), dict( | |
104 | action='store_true', dest='InteractiveShell.autoedit_syntax', default=NoConfigDefault, |
|
104 | action='store_true', dest='InteractiveShell.autoedit_syntax', default=NoConfigDefault, | |
105 | help='Turn on auto editing of files with syntax errors.') |
|
105 | help='Turn on auto editing of files with syntax errors.') | |
106 | ), |
|
106 | ), | |
107 |
(('-noautoedit |
|
107 | (('--no-autoedit-syntax',), dict( | |
108 | action='store_false', dest='InteractiveShell.autoedit_syntax', default=NoConfigDefault, |
|
108 | action='store_false', dest='InteractiveShell.autoedit_syntax', default=NoConfigDefault, | |
109 | help='Turn off auto editing of files with syntax errors.') |
|
109 | help='Turn off auto editing of files with syntax errors.') | |
110 | ), |
|
110 | ), | |
111 | (('-banner',), dict( |
|
111 | (('--banner',), dict( | |
112 | action='store_true', dest='Global.display_banner', default=NoConfigDefault, |
|
112 | action='store_true', dest='Global.display_banner', default=NoConfigDefault, | |
113 | help='Display a banner upon starting IPython.') |
|
113 | help='Display a banner upon starting IPython.') | |
114 | ), |
|
114 | ), | |
115 | (('-nobanner',), dict( |
|
115 | (('--no-banner',), dict( | |
116 | action='store_false', dest='Global.display_banner', default=NoConfigDefault, |
|
116 | action='store_false', dest='Global.display_banner', default=NoConfigDefault, | |
117 | help="Don't display a banner upon starting IPython.") |
|
117 | help="Don't display a banner upon starting IPython.") | |
118 | ), |
|
118 | ), | |
119 |
(('-cache |
|
119 | (('--cache-size',), dict( | |
120 | type=int, dest='InteractiveShell.cache_size', default=NoConfigDefault, |
|
120 | type=int, dest='InteractiveShell.cache_size', default=NoConfigDefault, | |
121 | help="Set the size of the output cache.", |
|
121 | help="Set the size of the output cache.", | |
122 | metavar='InteractiveShell.cache_size') |
|
122 | metavar='InteractiveShell.cache_size') | |
123 | ), |
|
123 | ), | |
124 | (('-classic',), dict( |
|
124 | (('--classic',), dict( | |
125 | action='store_true', dest='Global.classic', default=NoConfigDefault, |
|
125 | action='store_true', dest='Global.classic', default=NoConfigDefault, | |
126 | help="Gives IPython a similar feel to the classic Python prompt.") |
|
126 | help="Gives IPython a similar feel to the classic Python prompt.") | |
127 | ), |
|
127 | ), | |
128 | (('-colors',), dict( |
|
128 | (('--colors',), dict( | |
129 | type=str, dest='InteractiveShell.colors', default=NoConfigDefault, |
|
129 | type=str, dest='InteractiveShell.colors', default=NoConfigDefault, | |
130 | help="Set the color scheme (NoColor, Linux, and LightBG).", |
|
130 | help="Set the color scheme (NoColor, Linux, and LightBG).", | |
131 | metavar='InteractiveShell.colors') |
|
131 | metavar='InteractiveShell.colors') | |
132 | ), |
|
132 | ), | |
133 |
(('-color |
|
133 | (('--color-info',), dict( | |
134 | action='store_true', dest='InteractiveShell.color_info', default=NoConfigDefault, |
|
134 | action='store_true', dest='InteractiveShell.color_info', default=NoConfigDefault, | |
135 | help="Enable using colors for info related things.") |
|
135 | help="Enable using colors for info related things.") | |
136 | ), |
|
136 | ), | |
137 |
(('- |
|
137 | (('--no-color-info',), dict( | |
138 | action='store_false', dest='InteractiveShell.color_info', default=NoConfigDefault, |
|
138 | action='store_false', dest='InteractiveShell.color_info', default=NoConfigDefault, | |
139 | help="Disable using colors for info related things.") |
|
139 | help="Disable using colors for info related things.") | |
140 | ), |
|
140 | ), | |
141 |
(('-confirm |
|
141 | (('--confirm-exit',), dict( | |
142 | action='store_true', dest='InteractiveShell.confirm_exit', default=NoConfigDefault, |
|
142 | action='store_true', dest='InteractiveShell.confirm_exit', default=NoConfigDefault, | |
143 | help="Prompt the user when existing.") |
|
143 | help="Prompt the user when existing.") | |
144 | ), |
|
144 | ), | |
145 |
(('-noconfirm |
|
145 | (('--no-confirm-exit',), dict( | |
146 | action='store_false', dest='InteractiveShell.confirm_exit', default=NoConfigDefault, |
|
146 | action='store_false', dest='InteractiveShell.confirm_exit', default=NoConfigDefault, | |
147 | help="Don't prompt the user when existing.") |
|
147 | help="Don't prompt the user when existing.") | |
148 | ), |
|
148 | ), | |
149 |
(('- |
|
149 | (('--deep-reload',), dict( | |
150 | action='store_true', dest='InteractiveShell.deep_reload', default=NoConfigDefault, |
|
150 | action='store_true', dest='InteractiveShell.deep_reload', default=NoConfigDefault, | |
151 | help="Enable deep (recursive) reloading by default.") |
|
151 | help="Enable deep (recursive) reloading by default.") | |
152 | ), |
|
152 | ), | |
153 |
(('- |
|
153 | (('--no-deep-reload',), dict( | |
154 | action='store_false', dest='InteractiveShell.deep_reload', default=NoConfigDefault, |
|
154 | action='store_false', dest='InteractiveShell.deep_reload', default=NoConfigDefault, | |
155 | help="Disable deep (recursive) reloading by default.") |
|
155 | help="Disable deep (recursive) reloading by default.") | |
156 | ), |
|
156 | ), | |
157 | (('-editor',), dict( |
|
157 | (('--editor',), dict( | |
158 | type=str, dest='InteractiveShell.editor', default=NoConfigDefault, |
|
158 | type=str, dest='InteractiveShell.editor', default=NoConfigDefault, | |
159 | help="Set the editor used by IPython (default to $EDITOR/vi/notepad).", |
|
159 | help="Set the editor used by IPython (default to $EDITOR/vi/notepad).", | |
160 | metavar='InteractiveShell.editor') |
|
160 | metavar='InteractiveShell.editor') | |
161 | ), |
|
161 | ), | |
162 | (('-log','-l'), dict( |
|
162 | (('--log','-l'), dict( | |
163 | action='store_true', dest='InteractiveShell.logstart', default=NoConfigDefault, |
|
163 | action='store_true', dest='InteractiveShell.logstart', default=NoConfigDefault, | |
164 | help="Start logging to the default file (./ipython_log.py).") |
|
164 | help="Start logging to the default file (./ipython_log.py).") | |
165 | ), |
|
165 | ), | |
166 | (('-logfile','-lf'), dict( |
|
166 | (('--logfile','-lf'), dict( | |
167 | type=str, dest='InteractiveShell.logfile', default=NoConfigDefault, |
|
167 | type=str, dest='InteractiveShell.logfile', default=NoConfigDefault, | |
168 | help="Start logging to logfile.", |
|
168 | help="Start logging to logfile.", | |
169 | metavar='InteractiveShell.logfile') |
|
169 | metavar='InteractiveShell.logfile') | |
170 | ), |
|
170 | ), | |
171 | (('-logappend','-la'), dict( |
|
171 | (('--log-append','-la'), dict( | |
172 | type=str, dest='InteractiveShell.logappend', default=NoConfigDefault, |
|
172 | type=str, dest='InteractiveShell.logappend', default=NoConfigDefault, | |
173 | help="Start logging to logappend in append mode.", |
|
173 | help="Start logging to logappend in append mode.", | |
174 | metavar='InteractiveShell.logfile') |
|
174 | metavar='InteractiveShell.logfile') | |
175 | ), |
|
175 | ), | |
176 | (('-pdb',), dict( |
|
176 | (('--pdb',), dict( | |
177 | action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault, |
|
177 | action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault, | |
178 | help="Enable auto calling the pdb debugger after every exception.") |
|
178 | help="Enable auto calling the pdb debugger after every exception.") | |
179 | ), |
|
179 | ), | |
180 | (('-nopdb',), dict( |
|
180 | (('--nopdb',), dict( | |
181 | action='store_false', dest='InteractiveShell.pdb', default=NoConfigDefault, |
|
181 | action='store_false', dest='InteractiveShell.pdb', default=NoConfigDefault, | |
182 | help="Disable auto calling the pdb debugger after every exception.") |
|
182 | help="Disable auto calling the pdb debugger after every exception.") | |
183 | ), |
|
183 | ), | |
184 | (('-pprint',), dict( |
|
184 | (('--pprint',), dict( | |
185 | action='store_true', dest='InteractiveShell.pprint', default=NoConfigDefault, |
|
185 | action='store_true', dest='InteractiveShell.pprint', default=NoConfigDefault, | |
186 | help="Enable auto pretty printing of results.") |
|
186 | help="Enable auto pretty printing of results.") | |
187 | ), |
|
187 | ), | |
188 | (('-nopprint',), dict( |
|
188 | (('--no-pprint',), dict( | |
189 | action='store_false', dest='InteractiveShell.pprint', default=NoConfigDefault, |
|
189 | action='store_false', dest='InteractiveShell.pprint', default=NoConfigDefault, | |
190 | help="Disable auto auto pretty printing of results.") |
|
190 | help="Disable auto auto pretty printing of results.") | |
191 | ), |
|
191 | ), | |
192 |
(('-prompt |
|
192 | (('--prompt-in1','-pi1'), dict( | |
193 | type=str, dest='InteractiveShell.prompt_in1', default=NoConfigDefault, |
|
193 | type=str, dest='InteractiveShell.prompt_in1', default=NoConfigDefault, | |
194 | help="Set the main input prompt ('In [\#]: ')", |
|
194 | help="Set the main input prompt ('In [\#]: ')", | |
195 | metavar='InteractiveShell.prompt_in1') |
|
195 | metavar='InteractiveShell.prompt_in1') | |
196 | ), |
|
196 | ), | |
197 |
(('-prompt |
|
197 | (('--prompt-in2','-pi2'), dict( | |
198 | type=str, dest='InteractiveShell.prompt_in2', default=NoConfigDefault, |
|
198 | type=str, dest='InteractiveShell.prompt_in2', default=NoConfigDefault, | |
199 | help="Set the secondary input prompt (' .\D.: ')", |
|
199 | help="Set the secondary input prompt (' .\D.: ')", | |
200 | metavar='InteractiveShell.prompt_in2') |
|
200 | metavar='InteractiveShell.prompt_in2') | |
201 | ), |
|
201 | ), | |
202 |
(('-prompt |
|
202 | (('--prompt-out','-po'), dict( | |
203 | type=str, dest='InteractiveShell.prompt_out', default=NoConfigDefault, |
|
203 | type=str, dest='InteractiveShell.prompt_out', default=NoConfigDefault, | |
204 | help="Set the output prompt ('Out[\#]:')", |
|
204 | help="Set the output prompt ('Out[\#]:')", | |
205 | metavar='InteractiveShell.prompt_out') |
|
205 | metavar='InteractiveShell.prompt_out') | |
206 | ), |
|
206 | ), | |
207 | (('-quick',), dict( |
|
207 | (('--quick',), dict( | |
208 | action='store_true', dest='Global.quick', default=NoConfigDefault, |
|
208 | action='store_true', dest='Global.quick', default=NoConfigDefault, | |
209 | help="Enable quick startup with no config files.") |
|
209 | help="Enable quick startup with no config files.") | |
210 | ), |
|
210 | ), | |
211 | (('-readline',), dict( |
|
211 | (('--readline',), dict( | |
212 | action='store_true', dest='InteractiveShell.readline_use', default=NoConfigDefault, |
|
212 | action='store_true', dest='InteractiveShell.readline_use', default=NoConfigDefault, | |
213 | help="Enable readline for command line usage.") |
|
213 | help="Enable readline for command line usage.") | |
214 | ), |
|
214 | ), | |
215 | (('-noreadline',), dict( |
|
215 | (('--no-readline',), dict( | |
216 | action='store_false', dest='InteractiveShell.readline_use', default=NoConfigDefault, |
|
216 | action='store_false', dest='InteractiveShell.readline_use', default=NoConfigDefault, | |
217 | help="Disable readline for command line usage.") |
|
217 | help="Disable readline for command line usage.") | |
218 | ), |
|
218 | ), | |
219 |
(('-screen |
|
219 | (('--screen-length','-sl'), dict( | |
220 | type=int, dest='InteractiveShell.screen_length', default=NoConfigDefault, |
|
220 | type=int, dest='InteractiveShell.screen_length', default=NoConfigDefault, | |
221 | help='Number of lines on screen, used to control printing of long strings.', |
|
221 | help='Number of lines on screen, used to control printing of long strings.', | |
222 | metavar='InteractiveShell.screen_length') |
|
222 | metavar='InteractiveShell.screen_length') | |
223 | ), |
|
223 | ), | |
224 |
(('-separate |
|
224 | (('--separate-in','-si'), dict( | |
225 | type=str, dest='InteractiveShell.separate_in', default=NoConfigDefault, |
|
225 | type=str, dest='InteractiveShell.separate_in', default=NoConfigDefault, | |
226 | help="Separator before input prompts. Default '\n'.", |
|
226 | help="Separator before input prompts. Default '\n'.", | |
227 | metavar='InteractiveShell.separate_in') |
|
227 | metavar='InteractiveShell.separate_in') | |
228 | ), |
|
228 | ), | |
229 |
(('-separate |
|
229 | (('--separate-out','-so'), dict( | |
230 | type=str, dest='InteractiveShell.separate_out', default=NoConfigDefault, |
|
230 | type=str, dest='InteractiveShell.separate_out', default=NoConfigDefault, | |
231 | help="Separator before output prompts. Default 0 (nothing).", |
|
231 | help="Separator before output prompts. Default 0 (nothing).", | |
232 | metavar='InteractiveShell.separate_out') |
|
232 | metavar='InteractiveShell.separate_out') | |
233 | ), |
|
233 | ), | |
234 |
(('-separate |
|
234 | (('--separate-out2','-so2'), dict( | |
235 | type=str, dest='InteractiveShell.separate_out2', default=NoConfigDefault, |
|
235 | type=str, dest='InteractiveShell.separate_out2', default=NoConfigDefault, | |
236 | help="Separator after output prompts. Default 0 (nonight).", |
|
236 | help="Separator after output prompts. Default 0 (nonight).", | |
237 | metavar='InteractiveShell.separate_out2') |
|
237 | metavar='InteractiveShell.separate_out2') | |
238 | ), |
|
238 | ), | |
239 | (('-nosep',), dict( |
|
239 | (('-no-sep',), dict( | |
240 | action='store_true', dest='Global.nosep', default=NoConfigDefault, |
|
240 | action='store_true', dest='Global.nosep', default=NoConfigDefault, | |
241 | help="Eliminate all spacing between prompts.") |
|
241 | help="Eliminate all spacing between prompts.") | |
242 | ), |
|
242 | ), | |
243 |
(('- |
|
243 | (('--term-title',), dict( | |
244 | action='store_true', dest='InteractiveShell.term_title', default=NoConfigDefault, |
|
244 | action='store_true', dest='InteractiveShell.term_title', default=NoConfigDefault, | |
245 | help="Enable auto setting the terminal title.") |
|
245 | help="Enable auto setting the terminal title.") | |
246 | ), |
|
246 | ), | |
247 |
(('- |
|
247 | (('--no-term-title',), dict( | |
248 | action='store_false', dest='InteractiveShell.term_title', default=NoConfigDefault, |
|
248 | action='store_false', dest='InteractiveShell.term_title', default=NoConfigDefault, | |
249 | help="Disable auto setting the terminal title.") |
|
249 | help="Disable auto setting the terminal title.") | |
250 | ), |
|
250 | ), | |
251 | (('-xmode',), dict( |
|
251 | (('--xmode',), dict( | |
252 | type=str, dest='InteractiveShell.xmode', default=NoConfigDefault, |
|
252 | type=str, dest='InteractiveShell.xmode', default=NoConfigDefault, | |
253 | help="Exception mode ('Plain','Context','Verbose')", |
|
253 | help="Exception mode ('Plain','Context','Verbose')", | |
254 | metavar='InteractiveShell.xmode') |
|
254 | metavar='InteractiveShell.xmode') | |
255 | ), |
|
255 | ), | |
256 | (('-ext',), dict( |
|
256 | (('--ext',), dict( | |
257 | type=str, dest='Global.extra_extension', default=NoConfigDefault, |
|
257 | type=str, dest='Global.extra_extension', default=NoConfigDefault, | |
258 | help="The dotted module name of an IPython extension to load.", |
|
258 | help="The dotted module name of an IPython extension to load.", | |
259 | metavar='Global.extra_extension') |
|
259 | metavar='Global.extra_extension') | |
@@ -267,20 +267,20 b' cl_args = (' | |||||
267 | action='store_true', dest='Global.force_interact', default=NoConfigDefault, |
|
267 | action='store_true', dest='Global.force_interact', default=NoConfigDefault, | |
268 | help="If running code from the command line, become interactive afterwards.") |
|
268 | help="If running code from the command line, become interactive afterwards.") | |
269 | ), |
|
269 | ), | |
270 | (('-wthread',), dict( |
|
270 | (('--wthread',), dict( | |
271 | action='store_true', dest='Global.wthread', default=NoConfigDefault, |
|
271 | action='store_true', dest='Global.wthread', default=NoConfigDefault, | |
272 | help="Enable wxPython event loop integration.") |
|
272 | help="Enable wxPython event loop integration.") | |
273 | ), |
|
273 | ), | |
274 | (('-q4thread','-qthread'), dict( |
|
274 | (('--q4thread','--qthread'), dict( | |
275 | action='store_true', dest='Global.q4thread', default=NoConfigDefault, |
|
275 | action='store_true', dest='Global.q4thread', default=NoConfigDefault, | |
276 | help="Enable Qt4 event loop integration. Qt3 is no longer supported.") |
|
276 | help="Enable Qt4 event loop integration. Qt3 is no longer supported.") | |
277 | ), |
|
277 | ), | |
278 | (('-gthread',), dict( |
|
278 | (('--gthread',), dict( | |
279 | action='store_true', dest='Global.gthread', default=NoConfigDefault, |
|
279 | action='store_true', dest='Global.gthread', default=NoConfigDefault, | |
280 | help="Enable GTK event loop integration.") |
|
280 | help="Enable GTK event loop integration.") | |
281 | ), |
|
281 | ), | |
282 | # # These are only here to get the proper deprecation warnings |
|
282 | # # These are only here to get the proper deprecation warnings | |
283 | (('-pylab',), dict( |
|
283 | (('--pylab',), dict( | |
284 | action='store_true', dest='Global.pylab', default=NoConfigDefault, |
|
284 | action='store_true', dest='Global.pylab', default=NoConfigDefault, | |
285 | help="Disabled. Pylab has been disabled until matplotlib " |
|
285 | help="Disabled. Pylab has been disabled until matplotlib " | |
286 | "supports this version of IPython.") |
|
286 | "supports this version of IPython.") | |
@@ -475,7 +475,7 b' class IPythonApp(Application):' | |||||
475 | self.shell.showtraceback() |
|
475 | self.shell.showtraceback() | |
476 |
|
476 | |||
477 | def _exec_file(self, fname): |
|
477 | def _exec_file(self, fname): | |
478 | full_filename = filefind(fname, ['.', self.ipythondir]) |
|
478 | full_filename = filefind(fname, ['.', self.ipython_dir]) | |
479 | if os.path.isfile(full_filename): |
|
479 | if os.path.isfile(full_filename): | |
480 | if full_filename.endswith('.py'): |
|
480 | if full_filename.endswith('.py'): | |
481 | self.log.info("Running file in user namespace: %s" % full_filename) |
|
481 | self.log.info("Running file in user namespace: %s" % full_filename) | |
@@ -525,14 +525,14 b' class IPythonApp(Application):' | |||||
525 | self.shell.mainloop() |
|
525 | self.shell.mainloop() | |
526 |
|
526 | |||
527 |
|
527 | |||
528 | def load_default_config(ipythondir=None): |
|
528 | def load_default_config(ipython_dir=None): | |
529 | """Load the default config file from the default ipythondir. |
|
529 | """Load the default config file from the default ipython_dir. | |
530 |
|
530 | |||
531 | This is useful for embedded shells. |
|
531 | This is useful for embedded shells. | |
532 | """ |
|
532 | """ | |
533 | if ipythondir is None: |
|
533 | if ipython_dir is None: | |
534 | ipythondir = get_ipython_dir() |
|
534 | ipython_dir = get_ipython_dir() | |
535 | cl = PyFileConfigLoader(default_config_file_name, ipythondir) |
|
535 | cl = PyFileConfigLoader(default_config_file_name, ipython_dir) | |
536 | config = cl.load_config() |
|
536 | config = cl.load_config() | |
537 | return config |
|
537 | return config | |
538 |
|
538 |
@@ -215,7 +215,7 b' class InteractiveShell(Component, Magic):' | |||||
215 | embedded_active = CBool(False) |
|
215 | embedded_active = CBool(False) | |
216 | editor = Str(get_default_editor(), config=True) |
|
216 | editor = Str(get_default_editor(), config=True) | |
217 | filename = Str("<ipython console>") |
|
217 | filename = Str("<ipython console>") | |
218 | ipythondir= Unicode('', config=True) # Set to get_ipython_dir() in __init__ |
|
218 | ipython_dir= Unicode('', config=True) # Set to get_ipython_dir() in __init__ | |
219 | logstart = CBool(False, config=True) |
|
219 | logstart = CBool(False, config=True) | |
220 | logfile = Str('', config=True) |
|
220 | logfile = Str('', config=True) | |
221 | logappend = Str('', config=True) |
|
221 | logappend = Str('', config=True) | |
@@ -273,7 +273,7 b' class InteractiveShell(Component, Magic):' | |||||
273 | # Subclasses with thread support should override this as needed. |
|
273 | # Subclasses with thread support should override this as needed. | |
274 | isthreaded = False |
|
274 | isthreaded = False | |
275 |
|
275 | |||
276 | def __init__(self, parent=None, config=None, ipythondir=None, usage=None, |
|
276 | def __init__(self, parent=None, config=None, ipython_dir=None, usage=None, | |
277 | user_ns=None, user_global_ns=None, |
|
277 | user_ns=None, user_global_ns=None, | |
278 | banner1=None, banner2=None, display_banner=None, |
|
278 | banner1=None, banner2=None, display_banner=None, | |
279 | custom_exceptions=((),None)): |
|
279 | custom_exceptions=((),None)): | |
@@ -283,7 +283,7 b' class InteractiveShell(Component, Magic):' | |||||
283 | super(InteractiveShell, self).__init__(parent, config=config) |
|
283 | super(InteractiveShell, self).__init__(parent, config=config) | |
284 |
|
284 | |||
285 | # These are relatively independent and stateless |
|
285 | # These are relatively independent and stateless | |
286 | self.init_ipythondir(ipythondir) |
|
286 | self.init_ipython_dir(ipython_dir) | |
287 | self.init_instance_attrs() |
|
287 | self.init_instance_attrs() | |
288 | self.init_term_title() |
|
288 | self.init_term_title() | |
289 | self.init_usage(usage) |
|
289 | self.init_usage(usage) | |
@@ -341,7 +341,7 b' class InteractiveShell(Component, Magic):' | |||||
341 | def _banner2_changed(self): |
|
341 | def _banner2_changed(self): | |
342 | self.compute_banner() |
|
342 | self.compute_banner() | |
343 |
|
343 | |||
344 | def _ipythondir_changed(self, name, new): |
|
344 | def _ipython_dir_changed(self, name, new): | |
345 | if not os.path.isdir(new): |
|
345 | if not os.path.isdir(new): | |
346 | os.makedirs(new, mode = 0777) |
|
346 | os.makedirs(new, mode = 0777) | |
347 | if not os.path.isdir(self.ipython_extension_dir): |
|
347 | if not os.path.isdir(self.ipython_extension_dir): | |
@@ -349,7 +349,7 b' class InteractiveShell(Component, Magic):' | |||||
349 |
|
349 | |||
350 | @property |
|
350 | @property | |
351 | def ipython_extension_dir(self): |
|
351 | def ipython_extension_dir(self): | |
352 | return os.path.join(self.ipythondir, 'extensions') |
|
352 | return os.path.join(self.ipython_dir, 'extensions') | |
353 |
|
353 | |||
354 | @property |
|
354 | @property | |
355 | def usable_screen_length(self): |
|
355 | def usable_screen_length(self): | |
@@ -381,19 +381,19 b' class InteractiveShell(Component, Magic):' | |||||
381 | # init_* methods called by __init__ |
|
381 | # init_* methods called by __init__ | |
382 | #------------------------------------------------------------------------- |
|
382 | #------------------------------------------------------------------------- | |
383 |
|
383 | |||
384 | def init_ipythondir(self, ipythondir): |
|
384 | def init_ipython_dir(self, ipython_dir): | |
385 | if ipythondir is not None: |
|
385 | if ipython_dir is not None: | |
386 | self.ipythondir = ipythondir |
|
386 | self.ipython_dir = ipython_dir | |
387 | self.config.Global.ipythondir = self.ipythondir |
|
387 | self.config.Global.ipython_dir = self.ipython_dir | |
388 | return |
|
388 | return | |
389 |
|
389 | |||
390 | if hasattr(self.config.Global, 'ipythondir'): |
|
390 | if hasattr(self.config.Global, 'ipython_dir'): | |
391 | self.ipythondir = self.config.Global.ipythondir |
|
391 | self.ipython_dir = self.config.Global.ipython_dir | |
392 | else: |
|
392 | else: | |
393 | self.ipythondir = get_ipython_dir() |
|
393 | self.ipython_dir = get_ipython_dir() | |
394 |
|
394 | |||
395 | # All children can just read this |
|
395 | # All children can just read this | |
396 | self.config.Global.ipythondir = self.ipythondir |
|
396 | self.config.Global.ipython_dir = self.ipython_dir | |
397 |
|
397 | |||
398 | def init_instance_attrs(self): |
|
398 | def init_instance_attrs(self): | |
399 | self.jobs = BackgroundJobManager() |
|
399 | self.jobs = BackgroundJobManager() | |
@@ -1079,7 +1079,7 b' class InteractiveShell(Component, Magic):' | |||||
1079 | histfname = 'history-%s' % self.profile |
|
1079 | histfname = 'history-%s' % self.profile | |
1080 | else: |
|
1080 | else: | |
1081 | histfname = 'history' |
|
1081 | histfname = 'history' | |
1082 | self.histfile = os.path.join(self.ipythondir, histfname) |
|
1082 | self.histfile = os.path.join(self.ipython_dir, histfname) | |
1083 |
|
1083 | |||
1084 | # Fill the history zero entry, user counter starts at 1 |
|
1084 | # Fill the history zero entry, user counter starts at 1 | |
1085 | self.input_hist.append('\n') |
|
1085 | self.input_hist.append('\n') | |
@@ -1087,12 +1087,12 b' class InteractiveShell(Component, Magic):' | |||||
1087 |
|
1087 | |||
1088 | def init_shadow_hist(self): |
|
1088 | def init_shadow_hist(self): | |
1089 | try: |
|
1089 | try: | |
1090 | self.db = pickleshare.PickleShareDB(self.ipythondir + "/db") |
|
1090 | self.db = pickleshare.PickleShareDB(self.ipython_dir + "/db") | |
1091 | except exceptions.UnicodeDecodeError: |
|
1091 | except exceptions.UnicodeDecodeError: | |
1092 | print "Your ipythondir can't be decoded to unicode!" |
|
1092 | print "Your ipython_dir can't be decoded to unicode!" | |
1093 | print "Please set HOME environment variable to something that" |
|
1093 | print "Please set HOME environment variable to something that" | |
1094 | print r"only has ASCII characters, e.g. c:\home" |
|
1094 | print r"only has ASCII characters, e.g. c:\home" | |
1095 | print "Now it is", self.ipythondir |
|
1095 | print "Now it is", self.ipython_dir | |
1096 | sys.exit() |
|
1096 | sys.exit() | |
1097 | self.shadowhist = ipcorehist.ShadowHist(self.db) |
|
1097 | self.shadowhist = ipcorehist.ShadowHist(self.db) | |
1098 |
|
1098 | |||
@@ -2327,7 +2327,7 b' class InteractiveShell(Component, Magic):' | |||||
2327 | You can put your extension modules anywhere you want, as long as |
|
2327 | You can put your extension modules anywhere you want, as long as | |
2328 | they can be imported by Python's standard import mechanism. However, |
|
2328 | they can be imported by Python's standard import mechanism. However, | |
2329 | to make it easy to write extensions, you can also put your extensions |
|
2329 | to make it easy to write extensions, you can also put your extensions | |
2330 | in ``os.path.join(self.ipythondir, 'extensions')``. This directory |
|
2330 | in ``os.path.join(self.ipython_dir, 'extensions')``. This directory | |
2331 | is added to ``sys.path`` automatically. |
|
2331 | is added to ``sys.path`` automatically. | |
2332 | """ |
|
2332 | """ | |
2333 | from IPython.utils.syspathcontext import prepended_to_syspath |
|
2333 | from IPython.utils.syspathcontext import prepended_to_syspath |
@@ -3379,34 +3379,6 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3379 |
|
3379 | |||
3380 | page(qr) |
|
3380 | page(qr) | |
3381 |
|
3381 | |||
3382 | def magic_upgrade(self,arg): |
|
|||
3383 | """ Upgrade your IPython installation |
|
|||
3384 |
|
||||
3385 | This will copy the config files that don't yet exist in your |
|
|||
3386 | ipython dir from the system config dir. Use this after upgrading |
|
|||
3387 | IPython if you don't wish to delete your .ipython dir. |
|
|||
3388 |
|
||||
3389 | Call with -nolegacy to get rid of ipythonrc* files (recommended for |
|
|||
3390 | new users) |
|
|||
3391 |
|
||||
3392 | """ |
|
|||
3393 | ip = self.getapi() |
|
|||
3394 | ipinstallation = path(IPython.__file__).dirname() |
|
|||
3395 | upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'utils' / 'upgradedir.py') |
|
|||
3396 | src_config = ipinstallation / 'config' / 'userconfig' |
|
|||
3397 | userdir = path(ip.config.IPYTHONDIR) |
|
|||
3398 | cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir) |
|
|||
3399 | print ">",cmd |
|
|||
3400 | shell(cmd) |
|
|||
3401 | if arg == '-nolegacy': |
|
|||
3402 | legacy = userdir.files('ipythonrc*') |
|
|||
3403 | print "Nuking legacy files:",legacy |
|
|||
3404 |
|
||||
3405 | [p.remove() for p in legacy] |
|
|||
3406 | suffix = (sys.platform == 'win32' and '.ini' or '') |
|
|||
3407 | (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n') |
|
|||
3408 |
|
||||
3409 |
|
||||
3410 | def magic_doctest_mode(self,parameter_s=''): |
|
3382 | def magic_doctest_mode(self,parameter_s=''): | |
3411 | """Toggle doctest mode on and off. |
|
3383 | """Toggle doctest mode on and off. | |
3412 |
|
3384 | |||
@@ -3565,18 +3537,18 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3565 | overwrite = False |
|
3537 | overwrite = False | |
3566 | from IPython.config import profile |
|
3538 | from IPython.config import profile | |
3567 | profile_dir = os.path.split(profile.__file__)[0] |
|
3539 | profile_dir = os.path.split(profile.__file__)[0] | |
3568 | ipythondir = self.ipythondir |
|
3540 | ipython_dir = self.ipython_dir | |
3569 | files = os.listdir(profile_dir) |
|
3541 | files = os.listdir(profile_dir) | |
3570 |
|
3542 | |||
3571 | to_install = [] |
|
3543 | to_install = [] | |
3572 | for f in files: |
|
3544 | for f in files: | |
3573 | if f.startswith('ipython_config'): |
|
3545 | if f.startswith('ipython_config'): | |
3574 | src = os.path.join(profile_dir, f) |
|
3546 | src = os.path.join(profile_dir, f) | |
3575 | dst = os.path.join(ipythondir, f) |
|
3547 | dst = os.path.join(ipython_dir, f) | |
3576 | if (not os.path.isfile(dst)) or overwrite: |
|
3548 | if (not os.path.isfile(dst)) or overwrite: | |
3577 | to_install.append((f, src, dst)) |
|
3549 | to_install.append((f, src, dst)) | |
3578 | if len(to_install)>0: |
|
3550 | if len(to_install)>0: | |
3579 | print "Installing profiles to: ", ipythondir |
|
3551 | print "Installing profiles to: ", ipython_dir | |
3580 | for (f, src, dst) in to_install: |
|
3552 | for (f, src, dst) in to_install: | |
3581 | shutil.copy(src, dst) |
|
3553 | shutil.copy(src, dst) | |
3582 | print " %s" % f |
|
3554 | print " %s" % f | |
@@ -3596,10 +3568,10 b' Defaulting color scheme to \'NoColor\'"""' | |||||
3596 | overwrite = False |
|
3568 | overwrite = False | |
3597 | from IPython.config import default |
|
3569 | from IPython.config import default | |
3598 | config_dir = os.path.split(default.__file__)[0] |
|
3570 | config_dir = os.path.split(default.__file__)[0] | |
3599 | ipythondir = self.ipythondir |
|
3571 | ipython_dir = self.ipython_dir | |
3600 | default_config_file_name = 'ipython_config.py' |
|
3572 | default_config_file_name = 'ipython_config.py' | |
3601 | src = os.path.join(config_dir, default_config_file_name) |
|
3573 | src = os.path.join(config_dir, default_config_file_name) | |
3602 | dst = os.path.join(ipythondir, default_config_file_name) |
|
3574 | dst = os.path.join(ipython_dir, default_config_file_name) | |
3603 | if (not os.path.isfile(dst)) or overwrite: |
|
3575 | if (not os.path.isfile(dst)) or overwrite: | |
3604 | shutil.copy(src, dst) |
|
3576 | shutil.copy(src, dst) | |
3605 | print "Installing default config file: %s" % dst |
|
3577 | print "Installing default config file: %s" % dst |
@@ -15,7 +15,7 b' import nose.tools as nt' | |||||
15 | # our own packages |
|
15 | # our own packages | |
16 | from IPython.core import iplib |
|
16 | from IPython.core import iplib | |
17 | from IPython.core import ipapi |
|
17 | from IPython.core import ipapi | |
18 | from IPython.core.oldusersetup import user_setup |
|
18 | ||
19 |
|
19 | |||
20 | #----------------------------------------------------------------------------- |
|
20 | #----------------------------------------------------------------------------- | |
21 | # Globals |
|
21 | # Globals | |
@@ -55,26 +55,3 b' def test_reset():' | |||||
55 | nt.assert_equals(len(ns),0) |
|
55 | nt.assert_equals(len(ns),0) | |
56 |
|
56 | |||
57 |
|
57 | |||
No newline at end of file |
|
||||
58 | # make sure that user_setup can be run re-entrantly in 'install' mode. |
|
|||
59 | def test_user_setup(): |
|
|||
60 | # use a lambda to pass kwargs to the generator |
|
|||
61 | user_setup = lambda a,k: user_setup(*a,**k) |
|
|||
62 | kw = dict(mode='install', interactive=False) |
|
|||
63 |
|
||||
64 | # Call the user setup and verify that the directory exists |
|
|||
65 | yield user_setup, (ip.config.IPYTHONDIR,''), kw |
|
|||
66 | yield os.path.isdir, ip.config.IPYTHONDIR |
|
|||
67 |
|
||||
68 | # Now repeat the operation with a non-existent directory. Check both that |
|
|||
69 | # the call succeeds and that the directory is created. |
|
|||
70 | tmpdir = tempfile.mktemp(prefix='ipython-test-') |
|
|||
71 | # Use a try with an empty except because try/finally doesn't work with a |
|
|||
72 | # yield in Python 2.4. |
|
|||
73 | try: |
|
|||
74 | yield user_setup, (tmpdir,''), kw |
|
|||
75 | yield os.path.isdir, tmpdir |
|
|||
76 | except: |
|
|||
77 | pass |
|
|||
78 | # Clean up the temp dir once done |
|
|||
79 | shutil.rmtree(tmpdir) |
|
|||
80 | No newline at end of file |
|
@@ -40,7 +40,7 b' USAGE' | |||||
40 | in directories. |
|
40 | in directories. | |
41 |
|
41 | |||
42 | In the rest of this text, we will refer to this directory as |
|
42 | In the rest of this text, we will refer to this directory as | |
43 | IPYTHONDIR. |
|
43 | IPYTHON_DIR. | |
44 |
|
44 | |||
45 | REGULAR OPTIONS |
|
45 | REGULAR OPTIONS | |
46 | After the above threading options have been given, regular options can |
|
46 | After the above threading options have been given, regular options can | |
@@ -150,9 +150,9 b' REGULAR OPTIONS' | |||||
150 | here (in case your default EDITOR is something like Emacs). |
|
150 | here (in case your default EDITOR is something like Emacs). | |
151 |
|
151 | |||
152 | -ipythondir <name> |
|
152 | -ipythondir <name> | |
153 | The name of your IPython configuration directory IPYTHONDIR. |
|
153 | The name of your IPython configuration directory IPYTHON_DIR. | |
154 | This can also be specified through the environment variable |
|
154 | This can also be specified through the environment variable | |
155 | IPYTHONDIR. |
|
155 | IPYTHON_DIR. | |
156 |
|
156 | |||
157 | -log|l Generate a log file of all input. The file is named |
|
157 | -log|l Generate a log file of all input. The file is named | |
158 | ipython_log.py in your current directory (which prevents logs |
|
158 | ipython_log.py in your current directory (which prevents logs | |
@@ -201,10 +201,10 b' REGULAR OPTIONS' | |||||
201 |
|
201 | |||
202 | -profile|p <name> |
|
202 | -profile|p <name> | |
203 | Assume that your config file is ipythonrc-<name> (looks in cur- |
|
203 | Assume that your config file is ipythonrc-<name> (looks in cur- | |
204 | rent dir first, then in IPYTHONDIR). This is a quick way to keep |
|
204 | rent dir first, then in IPYTHON_DIR). This is a quick way to keep | |
205 | and load multiple config files for different tasks, especially |
|
205 | and load multiple config files for different tasks, especially | |
206 | if you use the include option of config files. You can keep a |
|
206 | if you use the include option of config files. You can keep a | |
207 | basic IPYTHONDIR/ipythonrc file and then have other 'profiles' |
|
207 | basic IPYTHON_DIR/ipythonrc file and then have other 'profiles' | |
208 | which include this one and load extra things for particular |
|
208 | which include this one and load extra things for particular | |
209 | tasks. For example: |
|
209 | tasks. For example: | |
210 |
|
210 | |||
@@ -245,7 +245,7 b' REGULAR OPTIONS' | |||||
245 | -rcfile <name> |
|
245 | -rcfile <name> | |
246 | Name of your IPython resource configuration file. normally |
|
246 | Name of your IPython resource configuration file. normally | |
247 | IPython loads ipythonrc (from current directory) or |
|
247 | IPython loads ipythonrc (from current directory) or | |
248 | IPYTHONDIR/ipythonrc. If the loading of your config file fails, |
|
248 | IPYTHON_DIR/ipythonrc. If the loading of your config file fails, | |
249 | IPython starts with a bare bones configuration (no modules |
|
249 | IPython starts with a bare bones configuration (no modules | |
250 | loaded at all). |
|
250 | loaded at all). | |
251 |
|
251 | |||
@@ -284,7 +284,7 b' REGULAR OPTIONS' | |||||
284 | Simply removes all input/output separators. |
|
284 | Simply removes all input/output separators. | |
285 |
|
285 | |||
286 | -upgrade |
|
286 | -upgrade | |
287 | Allows you to upgrade your IPYTHONDIR configuration when you |
|
287 | Allows you to upgrade your IPYTHON_DIR configuration when you | |
288 | install a new version of IPython. Since new versions may |
|
288 | install a new version of IPython. Since new versions may | |
289 | include new command lines options or example files, this copies |
|
289 | include new command lines options or example files, this copies | |
290 | updated ipythonrc-type files. However, it backs up (with a .old |
|
290 | updated ipythonrc-type files. However, it backs up (with a .old |
@@ -109,7 +109,7 b' class MyFrame(wx.Frame):' | |||||
109 |
|
109 | |||
110 | def optionSave(self, name, value): |
|
110 | def optionSave(self, name, value): | |
111 | ip = get() |
|
111 | ip = get() | |
112 |
path = ip. |
|
112 | path = ip.ipython_dir | |
113 | opt = open(path + '/options.conf','w') |
|
113 | opt = open(path + '/options.conf','w') | |
114 |
|
114 | |||
115 | try: |
|
115 | try: | |
@@ -126,7 +126,7 b' class MyFrame(wx.Frame):' | |||||
126 | def optionLoad(self): |
|
126 | def optionLoad(self): | |
127 | try: |
|
127 | try: | |
128 | ip = get() |
|
128 | ip = get() | |
129 |
path = ip. |
|
129 | path = ip.ipython_dir | |
130 | opt = open(path + '/options.conf','r') |
|
130 | opt = open(path + '/options.conf','r') | |
131 | lines = opt.readlines() |
|
131 | lines = opt.readlines() | |
132 | opt.close() |
|
132 | opt.close() |
@@ -65,8 +65,8 b' class AsyncClientConnector(object):' | |||||
65 |
|
65 | |||
66 | def _find_furl(self, profile='default', cluster_dir=None, |
|
66 | def _find_furl(self, profile='default', cluster_dir=None, | |
67 | furl_or_file=None, furl_file_name=None, |
|
67 | furl_or_file=None, furl_file_name=None, | |
68 | ipythondir=None): |
|
68 | ipython_dir=None): | |
69 | """Find a FURL file by profile+ipythondir or cluster dir. |
|
69 | """Find a FURL file by profile+ipython_dir or cluster dir. | |
70 |
|
70 | |||
71 | This raises an :exc:`~IPython.kernel.fcutil.FURLError` exception |
|
71 | This raises an :exc:`~IPython.kernel.fcutil.FURLError` exception | |
72 | if a FURL file can't be found. |
|
72 | if a FURL file can't be found. | |
@@ -88,11 +88,11 b' class AsyncClientConnector(object):' | |||||
88 | return furl_file |
|
88 | return furl_file | |
89 |
|
89 | |||
90 | # Try by profile |
|
90 | # Try by profile | |
91 | if ipythondir is None: |
|
91 | if ipython_dir is None: | |
92 | ipythondir = get_ipython_dir() |
|
92 | ipython_dir = get_ipython_dir() | |
93 | if profile is not None: |
|
93 | if profile is not None: | |
94 | cluster_dir_obj = ClusterDir.find_cluster_dir_by_profile( |
|
94 | cluster_dir_obj = ClusterDir.find_cluster_dir_by_profile( | |
95 | ipythondir, profile) |
|
95 | ipython_dir, profile) | |
96 | sdir = cluster_dir_obj.security_dir |
|
96 | sdir = cluster_dir_obj.security_dir | |
97 | furl_file = os.path.join(sdir, furl_file_name) |
|
97 | furl_file = os.path.join(sdir, furl_file_name) | |
98 | validate_furl_or_file(furl_file) |
|
98 | validate_furl_or_file(furl_file) | |
@@ -131,7 +131,7 b' class AsyncClientConnector(object):' | |||||
131 | return ref |
|
131 | return ref | |
132 |
|
132 | |||
133 | def get_task_client(self, profile='default', cluster_dir=None, |
|
133 | def get_task_client(self, profile='default', cluster_dir=None, | |
134 | furl_or_file=None, ipythondir=None, |
|
134 | furl_or_file=None, ipython_dir=None, | |
135 | delay=DELAY, max_tries=MAX_TRIES): |
|
135 | delay=DELAY, max_tries=MAX_TRIES): | |
136 | """Get the task controller client. |
|
136 | """Get the task controller client. | |
137 |
|
137 | |||
@@ -145,16 +145,16 b' class AsyncClientConnector(object):' | |||||
145 | profile : str |
|
145 | profile : str | |
146 | The name of a cluster directory profile (default="default"). The |
|
146 | The name of a cluster directory profile (default="default"). The | |
147 | cluster directory "cluster_<profile>" will be searched for |
|
147 | cluster directory "cluster_<profile>" will be searched for | |
148 | in ``os.getcwd()``, the ipythondir and then in the directories |
|
148 | in ``os.getcwd()``, the ipython_dir and then in the directories | |
149 | listed in the :env:`IPCLUSTERDIR_PATH` environment variable. |
|
149 | listed in the :env:`IPCLUSTER_DIR_PATH` environment variable. | |
150 | cluster_dir : str |
|
150 | cluster_dir : str | |
151 | The full path to a cluster directory. This is useful if profiles |
|
151 | The full path to a cluster directory. This is useful if profiles | |
152 | are not being used. |
|
152 | are not being used. | |
153 | furl_or_file : str |
|
153 | furl_or_file : str | |
154 | A furl or a filename containing a FURLK. This is useful if you |
|
154 | A furl or a filename containing a FURLK. This is useful if you | |
155 | simply know the location of the FURL file. |
|
155 | simply know the location of the FURL file. | |
156 | ipythondir : str |
|
156 | ipython_dir : str | |
157 | The location of the ipythondir if different from the default. |
|
157 | The location of the ipython_dir if different from the default. | |
158 | This is used if the cluster directory is being found by profile. |
|
158 | This is used if the cluster directory is being found by profile. | |
159 | delay : float |
|
159 | delay : float | |
160 | The initial delay between re-connection attempts. Susequent delays |
|
160 | The initial delay between re-connection attempts. Susequent delays | |
@@ -168,12 +168,12 b' class AsyncClientConnector(object):' | |||||
168 | """ |
|
168 | """ | |
169 | return self.get_client( |
|
169 | return self.get_client( | |
170 | profile, cluster_dir, furl_or_file, |
|
170 | profile, cluster_dir, furl_or_file, | |
171 | 'ipcontroller-tc.furl', ipythondir, |
|
171 | 'ipcontroller-tc.furl', ipython_dir, | |
172 | delay, max_tries |
|
172 | delay, max_tries | |
173 | ) |
|
173 | ) | |
174 |
|
174 | |||
175 | def get_multiengine_client(self, profile='default', cluster_dir=None, |
|
175 | def get_multiengine_client(self, profile='default', cluster_dir=None, | |
176 | furl_or_file=None, ipythondir=None, |
|
176 | furl_or_file=None, ipython_dir=None, | |
177 | delay=DELAY, max_tries=MAX_TRIES): |
|
177 | delay=DELAY, max_tries=MAX_TRIES): | |
178 | """Get the multiengine controller client. |
|
178 | """Get the multiengine controller client. | |
179 |
|
179 | |||
@@ -187,16 +187,16 b' class AsyncClientConnector(object):' | |||||
187 | profile : str |
|
187 | profile : str | |
188 | The name of a cluster directory profile (default="default"). The |
|
188 | The name of a cluster directory profile (default="default"). The | |
189 | cluster directory "cluster_<profile>" will be searched for |
|
189 | cluster directory "cluster_<profile>" will be searched for | |
190 | in ``os.getcwd()``, the ipythondir and then in the directories |
|
190 | in ``os.getcwd()``, the ipython_dir and then in the directories | |
191 | listed in the :env:`IPCLUSTERDIR_PATH` environment variable. |
|
191 | listed in the :env:`IPCLUSTER_DIR_PATH` environment variable. | |
192 | cluster_dir : str |
|
192 | cluster_dir : str | |
193 | The full path to a cluster directory. This is useful if profiles |
|
193 | The full path to a cluster directory. This is useful if profiles | |
194 | are not being used. |
|
194 | are not being used. | |
195 | furl_or_file : str |
|
195 | furl_or_file : str | |
196 | A furl or a filename containing a FURLK. This is useful if you |
|
196 | A furl or a filename containing a FURLK. This is useful if you | |
197 | simply know the location of the FURL file. |
|
197 | simply know the location of the FURL file. | |
198 | ipythondir : str |
|
198 | ipython_dir : str | |
199 | The location of the ipythondir if different from the default. |
|
199 | The location of the ipython_dir if different from the default. | |
200 | This is used if the cluster directory is being found by profile. |
|
200 | This is used if the cluster directory is being found by profile. | |
201 | delay : float |
|
201 | delay : float | |
202 | The initial delay between re-connection attempts. Susequent delays |
|
202 | The initial delay between re-connection attempts. Susequent delays | |
@@ -210,12 +210,12 b' class AsyncClientConnector(object):' | |||||
210 | """ |
|
210 | """ | |
211 | return self.get_client( |
|
211 | return self.get_client( | |
212 | profile, cluster_dir, furl_or_file, |
|
212 | profile, cluster_dir, furl_or_file, | |
213 | 'ipcontroller-mec.furl', ipythondir, |
|
213 | 'ipcontroller-mec.furl', ipython_dir, | |
214 | delay, max_tries |
|
214 | delay, max_tries | |
215 | ) |
|
215 | ) | |
216 |
|
216 | |||
217 | def get_client(self, profile='default', cluster_dir=None, |
|
217 | def get_client(self, profile='default', cluster_dir=None, | |
218 | furl_or_file=None, furl_file_name=None, ipythondir=None, |
|
218 | furl_or_file=None, furl_file_name=None, ipython_dir=None, | |
219 | delay=DELAY, max_tries=MAX_TRIES): |
|
219 | delay=DELAY, max_tries=MAX_TRIES): | |
220 | """Get a remote reference and wrap it in a client by furl. |
|
220 | """Get a remote reference and wrap it in a client by furl. | |
221 |
|
221 | |||
@@ -229,8 +229,8 b' class AsyncClientConnector(object):' | |||||
229 | profile : str |
|
229 | profile : str | |
230 | The name of a cluster directory profile (default="default"). The |
|
230 | The name of a cluster directory profile (default="default"). The | |
231 | cluster directory "cluster_<profile>" will be searched for |
|
231 | cluster directory "cluster_<profile>" will be searched for | |
232 | in ``os.getcwd()``, the ipythondir and then in the directories |
|
232 | in ``os.getcwd()``, the ipython_dir and then in the directories | |
233 | listed in the :env:`IPCLUSTERDIR_PATH` environment variable. |
|
233 | listed in the :env:`IPCLUSTER_DIR_PATH` environment variable. | |
234 | cluster_dir : str |
|
234 | cluster_dir : str | |
235 | The full path to a cluster directory. This is useful if profiles |
|
235 | The full path to a cluster directory. This is useful if profiles | |
236 | are not being used. |
|
236 | are not being used. | |
@@ -240,8 +240,8 b' class AsyncClientConnector(object):' | |||||
240 | furl_file_name : str |
|
240 | furl_file_name : str | |
241 | The filename (not the full path) of the FURL. This must be |
|
241 | The filename (not the full path) of the FURL. This must be | |
242 | provided if ``furl_or_file`` is not. |
|
242 | provided if ``furl_or_file`` is not. | |
243 | ipythondir : str |
|
243 | ipython_dir : str | |
244 | The location of the ipythondir if different from the default. |
|
244 | The location of the ipython_dir if different from the default. | |
245 | This is used if the cluster directory is being found by profile. |
|
245 | This is used if the cluster directory is being found by profile. | |
246 | delay : float |
|
246 | delay : float | |
247 | The initial delay between re-connection attempts. Susequent delays |
|
247 | The initial delay between re-connection attempts. Susequent delays | |
@@ -257,7 +257,7 b' class AsyncClientConnector(object):' | |||||
257 | try: |
|
257 | try: | |
258 | furl_file = self._find_furl( |
|
258 | furl_file = self._find_furl( | |
259 | profile, cluster_dir, furl_or_file, |
|
259 | profile, cluster_dir, furl_or_file, | |
260 | furl_file_name, ipythondir |
|
260 | furl_file_name, ipython_dir | |
261 | ) |
|
261 | ) | |
262 | except FURLError: |
|
262 | except FURLError: | |
263 | return defer.fail(failure.Failure()) |
|
263 | return defer.fail(failure.Failure()) | |
@@ -323,7 +323,7 b' class ClientConnector(object):' | |||||
323 | self.async_cc = AsyncClientConnector() |
|
323 | self.async_cc = AsyncClientConnector() | |
324 |
|
324 | |||
325 | def get_task_client(self, profile='default', cluster_dir=None, |
|
325 | def get_task_client(self, profile='default', cluster_dir=None, | |
326 | furl_or_file=None, ipythondir=None, |
|
326 | furl_or_file=None, ipython_dir=None, | |
327 | delay=DELAY, max_tries=MAX_TRIES): |
|
327 | delay=DELAY, max_tries=MAX_TRIES): | |
328 | """Get the task client. |
|
328 | """Get the task client. | |
329 |
|
329 | |||
@@ -336,16 +336,16 b' class ClientConnector(object):' | |||||
336 | profile : str |
|
336 | profile : str | |
337 | The name of a cluster directory profile (default="default"). The |
|
337 | The name of a cluster directory profile (default="default"). The | |
338 | cluster directory "cluster_<profile>" will be searched for |
|
338 | cluster directory "cluster_<profile>" will be searched for | |
339 | in ``os.getcwd()``, the ipythondir and then in the directories |
|
339 | in ``os.getcwd()``, the ipython_dir and then in the directories | |
340 | listed in the :env:`IPCLUSTERDIR_PATH` environment variable. |
|
340 | listed in the :env:`IPCLUSTER_DIR_PATH` environment variable. | |
341 | cluster_dir : str |
|
341 | cluster_dir : str | |
342 | The full path to a cluster directory. This is useful if profiles |
|
342 | The full path to a cluster directory. This is useful if profiles | |
343 | are not being used. |
|
343 | are not being used. | |
344 | furl_or_file : str |
|
344 | furl_or_file : str | |
345 | A furl or a filename containing a FURLK. This is useful if you |
|
345 | A furl or a filename containing a FURLK. This is useful if you | |
346 | simply know the location of the FURL file. |
|
346 | simply know the location of the FURL file. | |
347 | ipythondir : str |
|
347 | ipython_dir : str | |
348 | The location of the ipythondir if different from the default. |
|
348 | The location of the ipython_dir if different from the default. | |
349 | This is used if the cluster directory is being found by profile. |
|
349 | This is used if the cluster directory is being found by profile. | |
350 | delay : float |
|
350 | delay : float | |
351 | The initial delay between re-connection attempts. Susequent delays |
|
351 | The initial delay between re-connection attempts. Susequent delays | |
@@ -359,12 +359,12 b' class ClientConnector(object):' | |||||
359 | """ |
|
359 | """ | |
360 | client = blockingCallFromThread( |
|
360 | client = blockingCallFromThread( | |
361 | self.async_cc.get_task_client, profile, cluster_dir, |
|
361 | self.async_cc.get_task_client, profile, cluster_dir, | |
362 | furl_or_file, ipythondir, delay, max_tries |
|
362 | furl_or_file, ipython_dir, delay, max_tries | |
363 | ) |
|
363 | ) | |
364 | return client.adapt_to_blocking_client() |
|
364 | return client.adapt_to_blocking_client() | |
365 |
|
365 | |||
366 | def get_multiengine_client(self, profile='default', cluster_dir=None, |
|
366 | def get_multiengine_client(self, profile='default', cluster_dir=None, | |
367 | furl_or_file=None, ipythondir=None, |
|
367 | furl_or_file=None, ipython_dir=None, | |
368 | delay=DELAY, max_tries=MAX_TRIES): |
|
368 | delay=DELAY, max_tries=MAX_TRIES): | |
369 | """Get the multiengine client. |
|
369 | """Get the multiengine client. | |
370 |
|
370 | |||
@@ -377,16 +377,16 b' class ClientConnector(object):' | |||||
377 | profile : str |
|
377 | profile : str | |
378 | The name of a cluster directory profile (default="default"). The |
|
378 | The name of a cluster directory profile (default="default"). The | |
379 | cluster directory "cluster_<profile>" will be searched for |
|
379 | cluster directory "cluster_<profile>" will be searched for | |
380 | in ``os.getcwd()``, the ipythondir and then in the directories |
|
380 | in ``os.getcwd()``, the ipython_dir and then in the directories | |
381 | listed in the :env:`IPCLUSTERDIR_PATH` environment variable. |
|
381 | listed in the :env:`IPCLUSTER_DIR_PATH` environment variable. | |
382 | cluster_dir : str |
|
382 | cluster_dir : str | |
383 | The full path to a cluster directory. This is useful if profiles |
|
383 | The full path to a cluster directory. This is useful if profiles | |
384 | are not being used. |
|
384 | are not being used. | |
385 | furl_or_file : str |
|
385 | furl_or_file : str | |
386 | A furl or a filename containing a FURLK. This is useful if you |
|
386 | A furl or a filename containing a FURLK. This is useful if you | |
387 | simply know the location of the FURL file. |
|
387 | simply know the location of the FURL file. | |
388 | ipythondir : str |
|
388 | ipython_dir : str | |
389 | The location of the ipythondir if different from the default. |
|
389 | The location of the ipython_dir if different from the default. | |
390 | This is used if the cluster directory is being found by profile. |
|
390 | This is used if the cluster directory is being found by profile. | |
391 | delay : float |
|
391 | delay : float | |
392 | The initial delay between re-connection attempts. Susequent delays |
|
392 | The initial delay between re-connection attempts. Susequent delays | |
@@ -400,16 +400,16 b' class ClientConnector(object):' | |||||
400 | """ |
|
400 | """ | |
401 | client = blockingCallFromThread( |
|
401 | client = blockingCallFromThread( | |
402 | self.async_cc.get_multiengine_client, profile, cluster_dir, |
|
402 | self.async_cc.get_multiengine_client, profile, cluster_dir, | |
403 | furl_or_file, ipythondir, delay, max_tries |
|
403 | furl_or_file, ipython_dir, delay, max_tries | |
404 | ) |
|
404 | ) | |
405 | return client.adapt_to_blocking_client() |
|
405 | return client.adapt_to_blocking_client() | |
406 |
|
406 | |||
407 | def get_client(self, profile='default', cluster_dir=None, |
|
407 | def get_client(self, profile='default', cluster_dir=None, | |
408 | furl_or_file=None, ipythondir=None, |
|
408 | furl_or_file=None, ipython_dir=None, | |
409 | delay=DELAY, max_tries=MAX_TRIES): |
|
409 | delay=DELAY, max_tries=MAX_TRIES): | |
410 | client = blockingCallFromThread( |
|
410 | client = blockingCallFromThread( | |
411 | self.async_cc.get_client, profile, cluster_dir, |
|
411 | self.async_cc.get_client, profile, cluster_dir, | |
412 | furl_or_file, ipythondir, |
|
412 | furl_or_file, ipython_dir, | |
413 | delay, max_tries |
|
413 | delay, max_tries | |
414 | ) |
|
414 | ) | |
415 | return client.adapt_to_blocking_client() |
|
415 | return client.adapt_to_blocking_client() | |
@@ -422,7 +422,7 b' class ClusterStateError(Exception):' | |||||
422 | class AsyncCluster(object): |
|
422 | class AsyncCluster(object): | |
423 | """An class that wraps the :command:`ipcluster` script.""" |
|
423 | """An class that wraps the :command:`ipcluster` script.""" | |
424 |
|
424 | |||
425 | def __init__(self, profile='default', cluster_dir=None, ipythondir=None, |
|
425 | def __init__(self, profile='default', cluster_dir=None, ipython_dir=None, | |
426 | auto_create=False, auto_stop=True): |
|
426 | auto_create=False, auto_stop=True): | |
427 | """Create a class to manage an IPython cluster. |
|
427 | """Create a class to manage an IPython cluster. | |
428 |
|
428 | |||
@@ -437,13 +437,13 b' class AsyncCluster(object):' | |||||
437 | profile : str |
|
437 | profile : str | |
438 | The name of a cluster directory profile (default="default"). The |
|
438 | The name of a cluster directory profile (default="default"). The | |
439 | cluster directory "cluster_<profile>" will be searched for |
|
439 | cluster directory "cluster_<profile>" will be searched for | |
440 | in ``os.getcwd()``, the ipythondir and then in the directories |
|
440 | in ``os.getcwd()``, the ipython_dir and then in the directories | |
441 | listed in the :env:`IPCLUSTERDIR_PATH` environment variable. |
|
441 | listed in the :env:`IPCLUSTER_DIR_PATH` environment variable. | |
442 | cluster_dir : str |
|
442 | cluster_dir : str | |
443 | The full path to a cluster directory. This is useful if profiles |
|
443 | The full path to a cluster directory. This is useful if profiles | |
444 | are not being used. |
|
444 | are not being used. | |
445 | ipythondir : str |
|
445 | ipython_dir : str | |
446 | The location of the ipythondir if different from the default. |
|
446 | The location of the ipython_dir if different from the default. | |
447 | This is used if the cluster directory is being found by profile. |
|
447 | This is used if the cluster directory is being found by profile. | |
448 | auto_create : bool |
|
448 | auto_create : bool | |
449 | Automatically create the cluster directory it is dones't exist. |
|
449 | Automatically create the cluster directory it is dones't exist. | |
@@ -455,7 +455,7 b' class AsyncCluster(object):' | |||||
455 | to live beyond your current process. There is also an instance |
|
455 | to live beyond your current process. There is also an instance | |
456 | attribute ``auto_stop`` to change this behavior. |
|
456 | attribute ``auto_stop`` to change this behavior. | |
457 | """ |
|
457 | """ | |
458 | self._setup_cluster_dir(profile, cluster_dir, ipythondir, auto_create) |
|
458 | self._setup_cluster_dir(profile, cluster_dir, ipython_dir, auto_create) | |
459 | self.state = 'before' |
|
459 | self.state = 'before' | |
460 | self.launcher = None |
|
460 | self.launcher = None | |
461 | self.client_connector = None |
|
461 | self.client_connector = None | |
@@ -480,9 +480,9 b' class AsyncCluster(object):' | |||||
480 | else: |
|
480 | else: | |
481 | return False |
|
481 | return False | |
482 |
|
482 | |||
483 | def _setup_cluster_dir(self, profile, cluster_dir, ipythondir, auto_create): |
|
483 | def _setup_cluster_dir(self, profile, cluster_dir, ipython_dir, auto_create): | |
484 | if ipythondir is None: |
|
484 | if ipython_dir is None: | |
485 | ipythondir = get_ipython_dir() |
|
485 | ipython_dir = get_ipython_dir() | |
486 | if cluster_dir is not None: |
|
486 | if cluster_dir is not None: | |
487 | try: |
|
487 | try: | |
488 | self.cluster_dir_obj = ClusterDir.find_cluster_dir(cluster_dir) |
|
488 | self.cluster_dir_obj = ClusterDir.find_cluster_dir(cluster_dir) | |
@@ -491,13 +491,13 b' class AsyncCluster(object):' | |||||
491 | if profile is not None: |
|
491 | if profile is not None: | |
492 | try: |
|
492 | try: | |
493 | self.cluster_dir_obj = ClusterDir.find_cluster_dir_by_profile( |
|
493 | self.cluster_dir_obj = ClusterDir.find_cluster_dir_by_profile( | |
494 | ipythondir, profile) |
|
494 | ipython_dir, profile) | |
495 | except ClusterDirError: |
|
495 | except ClusterDirError: | |
496 | pass |
|
496 | pass | |
497 | if auto_create or profile=='default': |
|
497 | if auto_create or profile=='default': | |
498 | # This should call 'ipcluster create --profile default |
|
498 | # This should call 'ipcluster create --profile default | |
499 | self.cluster_dir_obj = ClusterDir.create_cluster_dir_by_profile( |
|
499 | self.cluster_dir_obj = ClusterDir.create_cluster_dir_by_profile( | |
500 | ipythondir, profile) |
|
500 | ipython_dir, profile) | |
501 | else: |
|
501 | else: | |
502 | raise ClusterDirError('Cluster dir not found.') |
|
502 | raise ClusterDirError('Cluster dir not found.') | |
503 |
|
503 | |||
@@ -593,7 +593,7 b' class AsyncCluster(object):' | |||||
593 | class Cluster(object): |
|
593 | class Cluster(object): | |
594 |
|
594 | |||
595 |
|
595 | |||
596 | def __init__(self, profile='default', cluster_dir=None, ipythondir=None, |
|
596 | def __init__(self, profile='default', cluster_dir=None, ipython_dir=None, | |
597 | auto_create=False, auto_stop=True): |
|
597 | auto_create=False, auto_stop=True): | |
598 | """Create a class to manage an IPython cluster. |
|
598 | """Create a class to manage an IPython cluster. | |
599 |
|
599 | |||
@@ -608,13 +608,13 b' class Cluster(object):' | |||||
608 | profile : str |
|
608 | profile : str | |
609 | The name of a cluster directory profile (default="default"). The |
|
609 | The name of a cluster directory profile (default="default"). The | |
610 | cluster directory "cluster_<profile>" will be searched for |
|
610 | cluster directory "cluster_<profile>" will be searched for | |
611 | in ``os.getcwd()``, the ipythondir and then in the directories |
|
611 | in ``os.getcwd()``, the ipython_dir and then in the directories | |
612 | listed in the :env:`IPCLUSTERDIR_PATH` environment variable. |
|
612 | listed in the :env:`IPCLUSTER_DIR_PATH` environment variable. | |
613 | cluster_dir : str |
|
613 | cluster_dir : str | |
614 | The full path to a cluster directory. This is useful if profiles |
|
614 | The full path to a cluster directory. This is useful if profiles | |
615 | are not being used. |
|
615 | are not being used. | |
616 | ipythondir : str |
|
616 | ipython_dir : str | |
617 | The location of the ipythondir if different from the default. |
|
617 | The location of the ipython_dir if different from the default. | |
618 | This is used if the cluster directory is being found by profile. |
|
618 | This is used if the cluster directory is being found by profile. | |
619 | auto_create : bool |
|
619 | auto_create : bool | |
620 | Automatically create the cluster directory it is dones't exist. |
|
620 | Automatically create the cluster directory it is dones't exist. | |
@@ -627,7 +627,7 b' class Cluster(object):' | |||||
627 | attribute ``auto_stop`` to change this behavior. |
|
627 | attribute ``auto_stop`` to change this behavior. | |
628 | """ |
|
628 | """ | |
629 | self.async_cluster = AsyncCluster( |
|
629 | self.async_cluster = AsyncCluster( | |
630 | profile, cluster_dir, ipythondir, auto_create, auto_stop |
|
630 | profile, cluster_dir, ipython_dir, auto_create, auto_stop | |
631 | ) |
|
631 | ) | |
632 | self.cluster_dir_obj = self.async_cluster.cluster_dir_obj |
|
632 | self.cluster_dir_obj = self.async_cluster.cluster_dir_obj | |
633 | self.client_connector = None |
|
633 | self.client_connector = None |
@@ -172,7 +172,7 b' class ClusterDir(Component):' | |||||
172 | return ClusterDir(cluster_dir) |
|
172 | return ClusterDir(cluster_dir) | |
173 |
|
173 | |||
174 | @classmethod |
|
174 | @classmethod | |
175 | def find_cluster_dir_by_profile(cls, ipythondir, profile='default'): |
|
175 | def find_cluster_dir_by_profile(cls, ipython_dir, profile='default'): | |
176 | """Find an existing cluster dir by profile name, return its ClusterDir. |
|
176 | """Find an existing cluster dir by profile name, return its ClusterDir. | |
177 |
|
177 | |||
178 | This searches through a sequence of paths for a cluster dir. If it |
|
178 | This searches through a sequence of paths for a cluster dir. If it | |
@@ -180,25 +180,25 b' class ClusterDir(Component):' | |||||
180 |
|
180 | |||
181 | The search path algorithm is: |
|
181 | The search path algorithm is: | |
182 | 1. ``os.getcwd()`` |
|
182 | 1. ``os.getcwd()`` | |
183 | 2. ``ipythondir`` |
|
183 | 2. ``ipython_dir`` | |
184 | 3. The directories found in the ":" separated |
|
184 | 3. The directories found in the ":" separated | |
185 | :env:`IPCLUSTERDIR_PATH` environment variable. |
|
185 | :env:`IPCLUSTER_DIR_PATH` environment variable. | |
186 |
|
186 | |||
187 | Parameters |
|
187 | Parameters | |
188 | ---------- |
|
188 | ---------- | |
189 | ipythondir : unicode or str |
|
189 | ipython_dir : unicode or str | |
190 | The IPython directory to use. |
|
190 | The IPython directory to use. | |
191 | profile : unicode or str |
|
191 | profile : unicode or str | |
192 | The name of the profile. The name of the cluster directory |
|
192 | The name of the profile. The name of the cluster directory | |
193 | will be "cluster_<profile>". |
|
193 | will be "cluster_<profile>". | |
194 | """ |
|
194 | """ | |
195 | dirname = 'cluster_' + profile |
|
195 | dirname = 'cluster_' + profile | |
196 | cluster_dir_paths = os.environ.get('IPCLUSTERDIR_PATH','') |
|
196 | cluster_dir_paths = os.environ.get('IPCLUSTER_DIR_PATH','') | |
197 | if cluster_dir_paths: |
|
197 | if cluster_dir_paths: | |
198 | cluster_dir_paths = cluster_dir_paths.split(':') |
|
198 | cluster_dir_paths = cluster_dir_paths.split(':') | |
199 | else: |
|
199 | else: | |
200 | cluster_dir_paths = [] |
|
200 | cluster_dir_paths = [] | |
201 | paths = [os.getcwd(), ipythondir] + cluster_dir_paths |
|
201 | paths = [os.getcwd(), ipython_dir] + cluster_dir_paths | |
202 | for p in paths: |
|
202 | for p in paths: | |
203 | cluster_dir = os.path.join(p, dirname) |
|
203 | cluster_dir = os.path.join(p, dirname) | |
204 | if os.path.isdir(cluster_dir): |
|
204 | if os.path.isdir(cluster_dir): | |
@@ -229,10 +229,10 b' class AppWithClusterDirArgParseConfigLoader(ArgParseConfigLoader):' | |||||
229 |
|
229 | |||
230 | def _add_other_arguments(self): |
|
230 | def _add_other_arguments(self): | |
231 | self.parser.add_argument('--ipython-dir', |
|
231 | self.parser.add_argument('--ipython-dir', | |
232 | dest='Global.ipythondir',type=str, |
|
232 | dest='Global.ipython_dir',type=str, | |
233 | help='Set to override default location of Global.ipythondir.', |
|
233 | help='Set to override default location of Global.ipython_dir.', | |
234 | default=NoConfigDefault, |
|
234 | default=NoConfigDefault, | |
235 | metavar='Global.ipythondir' |
|
235 | metavar='Global.ipython_dir' | |
236 | ) |
|
236 | ) | |
237 | self.parser.add_argument('-p', '--profile', |
|
237 | self.parser.add_argument('-p', '--profile', | |
238 | dest='Global.profile',type=str, |
|
238 | dest='Global.profile',type=str, | |
@@ -270,7 +270,7 b' class AppWithClusterDirArgParseConfigLoader(ArgParseConfigLoader):' | |||||
270 | class ApplicationWithClusterDir(Application): |
|
270 | class ApplicationWithClusterDir(Application): | |
271 | """An application that puts everything into a cluster directory. |
|
271 | """An application that puts everything into a cluster directory. | |
272 |
|
272 | |||
273 | Instead of looking for things in the ipythondir, this type of application |
|
273 | Instead of looking for things in the ipython_dir, this type of application | |
274 | will use its own private directory called the "cluster directory" |
|
274 | will use its own private directory called the "cluster directory" | |
275 | for things like config files, log files, etc. |
|
275 | for things like config files, log files, etc. | |
276 |
|
276 | |||
@@ -280,7 +280,7 b' class ApplicationWithClusterDir(Application):' | |||||
280 | * If ``--cluster-dir`` is not given, the application directory is |
|
280 | * If ``--cluster-dir`` is not given, the application directory is | |
281 | resolve using the profile name as ``cluster_<profile>``. The search |
|
281 | resolve using the profile name as ``cluster_<profile>``. The search | |
282 | path for this directory is then i) cwd if it is found there |
|
282 | path for this directory is then i) cwd if it is found there | |
283 | and ii) in ipythondir otherwise. |
|
283 | and ii) in ipython_dir otherwise. | |
284 |
|
284 | |||
285 | The config file for the application is to be put in the cluster |
|
285 | The config file for the application is to be put in the cluster | |
286 | dir and named the value of the ``config_file_name`` class attribute. |
|
286 | dir and named the value of the ``config_file_name`` class attribute. | |
@@ -342,7 +342,7 b' class ApplicationWithClusterDir(Application):' | |||||
342 | self.profile = self.default_config.Global.profile |
|
342 | self.profile = self.default_config.Global.profile | |
343 | try: |
|
343 | try: | |
344 | self.cluster_dir_obj = ClusterDir.find_cluster_dir_by_profile( |
|
344 | self.cluster_dir_obj = ClusterDir.find_cluster_dir_by_profile( | |
345 | self.ipythondir, self.profile) |
|
345 | self.ipython_dir, self.profile) | |
346 | except ClusterDirError: |
|
346 | except ClusterDirError: | |
347 | pass |
|
347 | pass | |
348 | else: |
|
348 | else: | |
@@ -354,7 +354,7 b' class ApplicationWithClusterDir(Application):' | |||||
354 |
|
354 | |||
355 | if self.auto_create_cluster_dir: |
|
355 | if self.auto_create_cluster_dir: | |
356 | self.cluster_dir_obj = ClusterDir.create_cluster_dir_by_profile( |
|
356 | self.cluster_dir_obj = ClusterDir.create_cluster_dir_by_profile( | |
357 | self.ipythondir, self.profile |
|
357 | self.ipython_dir, self.profile | |
358 | ) |
|
358 | ) | |
359 | self.log.info('Creating new cluster dir: %s' % \ |
|
359 | self.log.info('Creating new cluster dir: %s' % \ | |
360 | self.cluster_dir_obj.location |
|
360 | self.cluster_dir_obj.location |
@@ -52,10 +52,10 b' class IPClusterCLLoader(ArgParseConfigLoader):' | |||||
52 | # This has all the common options that all subcommands use |
|
52 | # This has all the common options that all subcommands use | |
53 | parent_parser1 = argparse.ArgumentParser(add_help=False) |
|
53 | parent_parser1 = argparse.ArgumentParser(add_help=False) | |
54 | parent_parser1.add_argument('--ipython-dir', |
|
54 | parent_parser1.add_argument('--ipython-dir', | |
55 | dest='Global.ipythondir',type=str, |
|
55 | dest='Global.ipython_dir',type=str, | |
56 | help='Set to override default location of Global.ipythondir.', |
|
56 | help='Set to override default location of Global.ipython_dir.', | |
57 | default=NoConfigDefault, |
|
57 | default=NoConfigDefault, | |
58 | metavar='Global.ipythondir') |
|
58 | metavar='Global.ipython_dir') | |
59 | parent_parser1.add_argument('--log-level', |
|
59 | parent_parser1.add_argument('--log-level', | |
60 | dest="Global.log_level",type=int, |
|
60 | dest="Global.log_level",type=int, | |
61 | help='Set the log level (0,10,20,30,40,50). Default is 30.', |
|
61 | help='Set the log level (0,10,20,30,40,50). Default is 30.', | |
@@ -96,7 +96,7 b' class IPClusterCLLoader(ArgParseConfigLoader):' | |||||
96 |
|
96 | |||
97 | parser_list = subparsers.add_parser( |
|
97 | parser_list = subparsers.add_parser( | |
98 | 'list', |
|
98 | 'list', | |
99 | help='List all clusters in cwd and ipythondir.', |
|
99 | help='List all clusters in cwd and ipython_dir.', | |
100 | parents=[parent_parser1] |
|
100 | parents=[parent_parser1] | |
101 | ) |
|
101 | ) | |
102 |
|
102 | |||
@@ -140,7 +140,7 b' class IPClusterCLLoader(ArgParseConfigLoader):' | |||||
140 | help='Daemonize the ipcluster program. This implies --log-to-file', |
|
140 | help='Daemonize the ipcluster program. This implies --log-to-file', | |
141 | default=NoConfigDefault |
|
141 | default=NoConfigDefault | |
142 | ) |
|
142 | ) | |
143 | parser_start.add_argument('--nodaemon', |
|
143 | parser_start.add_argument('--no-daemon', | |
144 | dest='Global.daemonize', action='store_false', |
|
144 | dest='Global.daemonize', action='store_false', | |
145 | help="Dont't daemonize the ipcluster program.", |
|
145 | help="Dont't daemonize the ipcluster program.", | |
146 | default=NoConfigDefault |
|
146 | default=NoConfigDefault | |
@@ -233,16 +233,16 b' class IPClusterApp(ApplicationWithClusterDir):' | |||||
233 |
|
233 | |||
234 | def list_cluster_dirs(self): |
|
234 | def list_cluster_dirs(self): | |
235 | # Find the search paths |
|
235 | # Find the search paths | |
236 | cluster_dir_paths = os.environ.get('IPCLUSTERDIR_PATH','') |
|
236 | cluster_dir_paths = os.environ.get('IPCLUSTER_DIR_PATH','') | |
237 | if cluster_dir_paths: |
|
237 | if cluster_dir_paths: | |
238 | cluster_dir_paths = cluster_dir_paths.split(':') |
|
238 | cluster_dir_paths = cluster_dir_paths.split(':') | |
239 | else: |
|
239 | else: | |
240 | cluster_dir_paths = [] |
|
240 | cluster_dir_paths = [] | |
241 | try: |
|
241 | try: | |
242 | ipythondir = self.command_line_config.Global.ipythondir |
|
242 | ipython_dir = self.command_line_config.Global.ipython_dir | |
243 | except AttributeError: |
|
243 | except AttributeError: | |
244 | ipythondir = self.default_config.Global.ipythondir |
|
244 | ipython_dir = self.default_config.Global.ipython_dir | |
245 | paths = [os.getcwd(), ipythondir] + \ |
|
245 | paths = [os.getcwd(), ipython_dir] + \ | |
246 | cluster_dir_paths |
|
246 | cluster_dir_paths | |
247 | paths = list(set(paths)) |
|
247 | paths = list(set(paths)) | |
248 |
|
248 |
@@ -303,11 +303,11 b' class IPythonRunner(InteractiveRunner):' | |||||
303 | def __init__(self,program = 'ipython',args=None,out=sys.stdout,echo=True): |
|
303 | def __init__(self,program = 'ipython',args=None,out=sys.stdout,echo=True): | |
304 | """New runner, optionally passing the ipython command to use.""" |
|
304 | """New runner, optionally passing the ipython command to use.""" | |
305 |
|
305 | |||
306 | args0 = ['-colors','NoColor', |
|
306 | args0 = ['--colors','NoColor', | |
307 | '-pi1','In [\\#]: ', |
|
307 | '-pi1','In [\\#]: ', | |
308 | '-pi2',' .\\D.: ', |
|
308 | '-pi2',' .\\D.: ', | |
309 |
'-noterm |
|
309 | '--noterm-title', | |
310 | '-noautoindent'] |
|
310 | '--no-auto-indent'] | |
311 | if args is None: args = args0 |
|
311 | if args is None: args = args0 | |
312 | else: args = args0 + args |
|
312 | else: args = args0 + args | |
313 | prompts = [r'In \[\d+\]: ',r' \.*: '] |
|
313 | prompts = [r'In \[\d+\]: ',r' \.*: '] |
@@ -141,7 +141,7 b' def collect(ip,arg):' | |||||
141 | Without args, try to open ~/_ipython/collect dir (in win32 at least). |
|
141 | Without args, try to open ~/_ipython/collect dir (in win32 at least). | |
142 | """ |
|
142 | """ | |
143 | from IPython.external.path import path |
|
143 | from IPython.external.path import path | |
144 |
basedir = path(ip. |
|
144 | basedir = path(ip.ipython_dir + '/collect') | |
145 | try: |
|
145 | try: | |
146 | fs = mglob.expand(arg.split(None,1)[1]) |
|
146 | fs = mglob.expand(arg.split(None,1)[1]) | |
147 | except IndexError: |
|
147 | except IndexError: | |
@@ -170,7 +170,7 b' def inote(ip,arg):' | |||||
170 | Without args, opens notes.txt for editing. |
|
170 | Without args, opens notes.txt for editing. | |
171 | """ |
|
171 | """ | |
172 | import time |
|
172 | import time | |
173 |
fname = ip. |
|
173 | fname = ip.ipython_dir + '/notes.txt' | |
174 |
|
174 | |||
175 | try: |
|
175 | try: | |
176 | entry = " === " + time.asctime() + ': ===\n' + arg.split(None,1)[1] + '\n' |
|
176 | entry = " === " + time.asctime() + ': ===\n' + arg.split(None,1)[1] + '\n' |
@@ -818,8 +818,11 b' def get_ipython_dir():' | |||||
818 | """ |
|
818 | """ | |
819 | ipdir_def = '.ipython' |
|
819 | ipdir_def = '.ipython' | |
820 | home_dir = get_home_dir() |
|
820 | home_dir = get_home_dir() | |
821 |
ipdir = os. |
|
821 | ipdir = os.environ.get( | |
822 | os.path.join(home_dir, ipdir_def))) |
|
822 | 'IPYTHON_DIR', os.environ.get( | |
|
823 | 'IPYTHONDIR', os.path.join(home_dir, ipdir_def) | |||
|
824 | ) | |||
|
825 | ) | |||
823 | return ipdir.decode(sys.getfilesystemencoding()) |
|
826 | return ipdir.decode(sys.getfilesystemencoding()) | |
824 |
|
827 | |||
825 |
|
828 |
@@ -11,7 +11,7 b'' | |||||
11 | ipcluster is a control tool for IPython's parallel computing functions. |
|
11 | ipcluster is a control tool for IPython's parallel computing functions. | |
12 |
|
12 | |||
13 | IPython cluster startup. This starts a controller and engines using various |
|
13 | IPython cluster startup. This starts a controller and engines using various | |
14 | approaches. Use the IPYTHONDIR environment variable to change your IPython |
|
14 | approaches. Use the IPYTHON_DIR environment variable to change your IPython | |
15 | directory from the default of .ipython or _ipython. The log and security |
|
15 | directory from the default of .ipython or _ipython. The log and security | |
16 | subdirectories of your IPython directory will be used by this script for log |
|
16 | subdirectories of your IPython directory will be used by this script for log | |
17 | files and security files. |
|
17 | files and security files. |
@@ -141,8 +141,8 b' may want to use a small, lightweight editor here (in case your default' | |||||
141 | EDITOR is something like Emacs). |
|
141 | EDITOR is something like Emacs). | |
142 | .TP |
|
142 | .TP | |
143 | .B \-ipythondir <name> |
|
143 | .B \-ipythondir <name> | |
144 | The name of your IPython configuration directory IPYTHONDIR. This can |
|
144 | The name of your IPython configuration directory IPYTHON_DIR. This can | |
145 | also be specified through the environment variable IPYTHONDIR. |
|
145 | also be specified through the environment variable IPYTHON_DIR. | |
146 | .TP |
|
146 | .TP | |
147 | .B \-log|l |
|
147 | .B \-log|l | |
148 | Generate a log file of all input. The file is named ipython_log.py in your |
|
148 | Generate a log file of all input. The file is named ipython_log.py in your | |
@@ -197,10 +197,10 b' your config file (default off).' | |||||
197 | .TP |
|
197 | .TP | |
198 | .B \-profile|p <name> |
|
198 | .B \-profile|p <name> | |
199 | Assume that your config file is ipythonrc-<name> (looks in current dir |
|
199 | Assume that your config file is ipythonrc-<name> (looks in current dir | |
200 | first, then in IPYTHONDIR). This is a quick way to keep and load |
|
200 | first, then in IPYTHON_DIR). This is a quick way to keep and load | |
201 | multiple config files for different tasks, especially if you use the |
|
201 | multiple config files for different tasks, especially if you use the | |
202 | include option of config files. You can keep a basic |
|
202 | include option of config files. You can keep a basic | |
203 | IPYTHONDIR/ipythonrc file and then have other 'profiles' which include |
|
203 | IPYTHON_DIR/ipythonrc file and then have other 'profiles' which include | |
204 | this one and load extra things for particular tasks. For example: |
|
204 | this one and load extra things for particular tasks. For example: | |
205 | .br |
|
205 | .br | |
206 | .sp 1 |
|
206 | .sp 1 | |
@@ -244,7 +244,7 b' Start in bare bones mode (no config file loaded).' | |||||
244 | .TP |
|
244 | .TP | |
245 | .B \-rcfile <name> |
|
245 | .B \-rcfile <name> | |
246 | Name of your IPython resource configuration file. normally IPython |
|
246 | Name of your IPython resource configuration file. normally IPython | |
247 | loads ipythonrc (from current directory) or IPYTHONDIR/ipythonrc. If |
|
247 | loads ipythonrc (from current directory) or IPYTHON_DIR/ipythonrc. If | |
248 | the loading of your config file fails, IPython starts with a bare |
|
248 | the loading of your config file fails, IPython starts with a bare | |
249 | bones configuration (no modules loaded at all). |
|
249 | bones configuration (no modules loaded at all). | |
250 | .TP |
|
250 | .TP | |
@@ -286,7 +286,7 b" Shorthand for '\\-separate_in 0 \\-separate_out 0 \\-separate_out2 0'." | |||||
286 | Simply removes all input/output separators. |
|
286 | Simply removes all input/output separators. | |
287 | .TP |
|
287 | .TP | |
288 | .B \-upgrade |
|
288 | .B \-upgrade | |
289 | Allows you to upgrade your IPYTHONDIR configuration when you install a |
|
289 | Allows you to upgrade your IPYTHON_DIR configuration when you install a | |
290 | new version of IPython. Since new versions may include new command |
|
290 | new version of IPython. Since new versions may include new command | |
291 | lines options or example files, this copies updated ipythonrc-type |
|
291 | lines options or example files, this copies updated ipythonrc-type | |
292 | files. However, it backs up (with a .old extension) all files which |
|
292 | files. However, it backs up (with a .old extension) all files which |
@@ -243,15 +243,15 b' So where should you put your configuration files? By default, all IPython' | |||||
243 | applications look in the so called "IPython directory". The location of |
|
243 | applications look in the so called "IPython directory". The location of | |
244 | this directory is determined by the following algorithm: |
|
244 | this directory is determined by the following algorithm: | |
245 |
|
245 | |||
246 | * If the ``-ipythondir`` command line flag is given, its value is used. |
|
246 | * If the ``--ipython-dir`` command line flag is given, its value is used. | |
247 |
|
247 | |||
248 | * If not, the value returned by :func:`IPython.utils.genutils.get_ipython_dir` |
|
248 | * If not, the value returned by :func:`IPython.utils.genutils.get_ipython_dir` | |
249 | is used. This function will first look at the :envvar:`IPYTHONDIR` |
|
249 | is used. This function will first look at the :envvar:`IPYTHON_DIR` | |
250 | environment variable and then default to the directory |
|
250 | environment variable and then default to the directory | |
251 |
:file:`$HOME/.ipython |
|
251 | :file:`$HOME/.ipython`. | |
252 |
|
252 | |||
253 | For most users, the default value will simply be something like |
|
253 | For most users, the default value will simply be something like | |
254 |
:file:`$HOME/.ipython |
|
254 | :file:`$HOME/.ipython`. | |
255 |
|
255 | |||
256 | Once the location of the IPython directory has been determined, you need to |
|
256 | Once the location of the IPython directory has been determined, you need to | |
257 | know what filename to use for the configuration file. The basic idea is that |
|
257 | know what filename to use for the configuration file. The basic idea is that |
@@ -31,7 +31,7 b' your ipythonrc configuration file for details on those. This file' | |||||
31 | typically installed in the $HOME/.ipython directory. For Windows users, |
|
31 | typically installed in the $HOME/.ipython directory. For Windows users, | |
32 | $HOME resolves to C:\\Documents and Settings\\YourUserName in most |
|
32 | $HOME resolves to C:\\Documents and Settings\\YourUserName in most | |
33 | instances. In the rest of this text, we will refer to this directory as |
|
33 | instances. In the rest of this text, we will refer to this directory as | |
34 | IPYTHONDIR. |
|
34 | IPYTHON_DIR. | |
35 |
|
35 | |||
36 |
|
36 | |||
37 |
|
37 | |||
@@ -150,9 +150,9 b' All options with a [no] prepended can be specified in negated form' | |||||
150 | something like Emacs). |
|
150 | something like Emacs). | |
151 |
|
151 | |||
152 | -ipythondir <name> |
|
152 | -ipythondir <name> | |
153 | name of your IPython configuration directory IPYTHONDIR. This |
|
153 | name of your IPython configuration directory IPYTHON_DIR. This | |
154 | can also be specified through the environment variable |
|
154 | can also be specified through the environment variable | |
155 | IPYTHONDIR. |
|
155 | IPYTHON_DIR. | |
156 |
|
156 | |||
157 | -log, l |
|
157 | -log, l | |
158 | generate a log file of all input. The file is named |
|
158 | generate a log file of all input. The file is named | |
@@ -211,10 +211,10 b' All options with a [no] prepended can be specified in negated form' | |||||
211 |
|
211 | |||
212 | assume that your config file is ipythonrc-<name> or |
|
212 | assume that your config file is ipythonrc-<name> or | |
213 | ipy_profile_<name>.py (looks in current dir first, then in |
|
213 | ipy_profile_<name>.py (looks in current dir first, then in | |
214 | IPYTHONDIR). This is a quick way to keep and load multiple |
|
214 | IPYTHON_DIR). This is a quick way to keep and load multiple | |
215 | config files for different tasks, especially if you use the |
|
215 | config files for different tasks, especially if you use the | |
216 | include option of config files. You can keep a basic |
|
216 | include option of config files. You can keep a basic | |
217 | IPYTHONDIR/ipythonrc file and then have other 'profiles' which |
|
217 | IPYTHON_DIR/ipythonrc file and then have other 'profiles' which | |
218 | include this one and load extra things for particular |
|
218 | include this one and load extra things for particular | |
219 | tasks. For example: |
|
219 | tasks. For example: | |
220 |
|
220 | |||
@@ -252,7 +252,7 b' All options with a [no] prepended can be specified in negated form' | |||||
252 | -rcfile <name> |
|
252 | -rcfile <name> | |
253 | name of your IPython resource configuration file. Normally |
|
253 | name of your IPython resource configuration file. Normally | |
254 | IPython loads ipythonrc (from current directory) or |
|
254 | IPython loads ipythonrc (from current directory) or | |
255 | IPYTHONDIR/ipythonrc. |
|
255 | IPYTHON_DIR/ipythonrc. | |
256 |
|
256 | |||
257 | If the loading of your config file fails, IPython starts with |
|
257 | If the loading of your config file fails, IPython starts with | |
258 | a bare bones configuration (no modules loaded at all). |
|
258 | a bare bones configuration (no modules loaded at all). | |
@@ -299,7 +299,7 b' All options with a [no] prepended can be specified in negated form' | |||||
299 | 0'. Simply removes all input/output separators. |
|
299 | 0'. Simply removes all input/output separators. | |
300 |
|
300 | |||
301 | -upgrade |
|
301 | -upgrade | |
302 | allows you to upgrade your IPYTHONDIR configuration when you |
|
302 | allows you to upgrade your IPYTHON_DIR configuration when you | |
303 | install a new version of IPython. Since new versions may |
|
303 | install a new version of IPython. Since new versions may | |
304 | include new command line options or example files, this copies |
|
304 | include new command line options or example files, this copies | |
305 | updated ipythonrc-type files. However, it backs up (with a |
|
305 | updated ipythonrc-type files. However, it backs up (with a | |
@@ -542,7 +542,7 b' Persistent command history across sessions' | |||||
542 |
|
542 | |||
543 | IPython will save your input history when it leaves and reload it next |
|
543 | IPython will save your input history when it leaves and reload it next | |
544 | time you restart it. By default, the history file is named |
|
544 | time you restart it. By default, the history file is named | |
545 | $IPYTHONDIR/history, but if you've loaded a named profile, |
|
545 | $IPYTHON_DIR/history, but if you've loaded a named profile, | |
546 | '-PROFILE_NAME' is appended to the name. This allows you to keep |
|
546 | '-PROFILE_NAME' is appended to the name. This allows you to keep | |
547 | separate histories related to various tasks: commands related to |
|
547 | separate histories related to various tasks: commands related to | |
548 | numerical work will not be clobbered by a system shell history, for |
|
548 | numerical work will not be clobbered by a system shell history, for | |
@@ -636,7 +636,7 b' follows:' | |||||
636 | %logstart [log_name [log_mode]] |
|
636 | %logstart [log_name [log_mode]] | |
637 |
|
637 | |||
638 | If no name is given, it defaults to a file named 'log' in your |
|
638 | If no name is given, it defaults to a file named 'log' in your | |
639 | IPYTHONDIR directory, in 'rotate' mode (see below). |
|
639 | IPYTHON_DIR directory, in 'rotate' mode (see below). | |
640 |
|
640 | |||
641 | '%logstart name' saves to file 'name' in 'backup' mode. It saves your |
|
641 | '%logstart name' saves to file 'name' in 'backup' mode. It saves your | |
642 | history up to that point and then continues logging. |
|
642 | history up to that point and then continues logging. |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now