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