Show More
@@ -85,6 +85,8 b' ipython profile create foo --parallel # also stage parallel config files' | |||||
85 | _main_examples = """ |
|
85 | _main_examples = """ | |
86 | ipython profile create -h # show the help string for the create subcommand |
|
86 | ipython profile create -h # show the help string for the create subcommand | |
87 | ipython profile list -h # show the help string for the list subcommand |
|
87 | ipython profile list -h # show the help string for the list subcommand | |
|
88 | ||||
|
89 | ipython locate profile foo # print the path to the directory for profile 'foo' | |||
88 | """ |
|
90 | """ | |
89 |
|
91 | |||
90 | #----------------------------------------------------------------------------- |
|
92 | #----------------------------------------------------------------------------- | |
@@ -115,6 +117,18 b' def list_bundled_profiles():' | |||||
115 | return profiles |
|
117 | return profiles | |
116 |
|
118 | |||
117 |
|
119 | |||
|
120 | class ProfileLocate(BaseIPythonApplication): | |||
|
121 | description = """print the path an IPython profile dir""" | |||
|
122 | ||||
|
123 | def parse_command_line(self, argv=None): | |||
|
124 | super(ProfileLocate, self).parse_command_line(argv) | |||
|
125 | if self.extra_args: | |||
|
126 | self.profile = self.extra_args[0] | |||
|
127 | ||||
|
128 | def start(self): | |||
|
129 | print self.profile_dir.location | |||
|
130 | ||||
|
131 | ||||
118 | class ProfileList(Application): |
|
132 | class ProfileList(Application): | |
119 | name = u'ipython-profile' |
|
133 | name = u'ipython-profile' | |
120 | description = list_help |
|
134 | description = list_help | |
@@ -277,8 +291,8 b' class ProfileApp(Application):' | |||||
277 | examples = _main_examples |
|
291 | examples = _main_examples | |
278 |
|
292 | |||
279 | subcommands = Dict(dict( |
|
293 | subcommands = Dict(dict( | |
280 | create = (ProfileCreate, "Create a new profile dir with default config files"), |
|
294 | create = (ProfileCreate, ProfileCreate.description.splitlines()[0]), | |
281 | list = (ProfileList, "List existing profiles") |
|
295 | list = (ProfileList, ProfileList.description.splitlines()[0]), | |
282 | )) |
|
296 | )) | |
283 |
|
297 | |||
284 | def start(self): |
|
298 | def start(self): |
@@ -78,6 +78,9 b' ipython help notebook # show the help for the notebook subcmd' | |||||
78 |
|
78 | |||
79 | ipython profile create foo # create profile foo w/ default config files |
|
79 | ipython profile create foo # create profile foo w/ default config files | |
80 | ipython help profile # show the help for the profile subcmd |
|
80 | ipython help profile # show the help for the profile subcmd | |
|
81 | ||||
|
82 | ipython locate # print the path to the IPython directory | |||
|
83 | ipython locate profile foo # print the path to the directory for profile `foo` | |||
81 | """ |
|
84 | """ | |
82 |
|
85 | |||
83 | #----------------------------------------------------------------------------- |
|
86 | #----------------------------------------------------------------------------- | |
@@ -180,6 +183,21 b' aliases.update(shell_aliases)' | |||||
180 | # Main classes and functions |
|
183 | # Main classes and functions | |
181 | #----------------------------------------------------------------------------- |
|
184 | #----------------------------------------------------------------------------- | |
182 |
|
185 | |||
|
186 | ||||
|
187 | class LocateIPythonApp(BaseIPythonApplication): | |||
|
188 | description = """print the path to the IPython dir""" | |||
|
189 | subcommands = Dict(dict( | |||
|
190 | profile=('IPython.core.profileapp.ProfileLocate', | |||
|
191 | "print the path to an IPython profile directory", | |||
|
192 | ), | |||
|
193 | )) | |||
|
194 | def start(self): | |||
|
195 | if self.subapp is not None: | |||
|
196 | return self.subapp.start() | |||
|
197 | else: | |||
|
198 | print self.ipython_dir | |||
|
199 | ||||
|
200 | ||||
183 | class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp): |
|
201 | class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp): | |
184 | name = u'ipython' |
|
202 | name = u'ipython' | |
185 | description = usage.cl_usage |
|
203 | description = usage.cl_usage | |
@@ -219,6 +237,9 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||||
219 | console=('IPython.frontend.terminal.console.app.ZMQTerminalIPythonApp', |
|
237 | console=('IPython.frontend.terminal.console.app.ZMQTerminalIPythonApp', | |
220 | """Launch the IPython terminal-based Console.""" |
|
238 | """Launch the IPython terminal-based Console.""" | |
221 | ), |
|
239 | ), | |
|
240 | locate=('IPython.frontend.terminal.ipapp.LocateIPythonApp', | |||
|
241 | LocateIPythonApp.description | |||
|
242 | ), | |||
222 | )) |
|
243 | )) | |
223 |
|
244 | |||
224 | # *do* autocreate requested profile, but don't create the config file. |
|
245 | # *do* autocreate requested profile, but don't create the config file. |
@@ -281,7 +281,7 b' configuration, and by default, all profiles will be stored in the so called' | |||||
281 | "IPython directory". The location of this directory is determined by the |
|
281 | "IPython directory". The location of this directory is determined by the | |
282 | following algorithm: |
|
282 | following algorithm: | |
283 |
|
283 | |||
284 |
* If the ``ipython |
|
284 | * If the ``ipython-dir`` command line flag is given, its value is used. | |
285 |
|
285 | |||
286 | * If not, the value returned by :func:`IPython.utils.path.get_ipython_dir` |
|
286 | * If not, the value returned by :func:`IPython.utils.path.get_ipython_dir` | |
287 | is used. This function will first look at the :envvar:`IPYTHONDIR` |
|
287 | is used. This function will first look at the :envvar:`IPYTHONDIR` | |
@@ -324,6 +324,25 b' under :file:`profile_default`. If you want the default config files for the' | |||||
324 | :mod:`IPython.parallel` applications, add ``--parallel`` to the end of the |
|
324 | :mod:`IPython.parallel` applications, add ``--parallel`` to the end of the | |
325 | command-line args. |
|
325 | command-line args. | |
326 |
|
326 | |||
|
327 | ||||
|
328 | Locating these files | |||
|
329 | -------------------- | |||
|
330 | ||||
|
331 | From the command-line, you can quickly locate the IPYTHONDIR or a specific | |||
|
332 | profile with: | |||
|
333 | ||||
|
334 | .. sourcecode:: bash | |||
|
335 | ||||
|
336 | $> ipython locate | |||
|
337 | /home/you/.ipython | |||
|
338 | ||||
|
339 | $> ipython locate profile foo | |||
|
340 | /home/you/.ipython/profile_foo | |||
|
341 | ||||
|
342 | These map to the utility functions: :func:`IPython.utils.path.get_ipython_dir` | |||
|
343 | and :func:`IPython.utils.path.locate_profile` respectively. | |||
|
344 | ||||
|
345 | ||||
327 | .. _Profiles: |
|
346 | .. _Profiles: | |
328 |
|
347 | |||
329 | Profiles |
|
348 | Profiles |
General Comments 0
You need to be logged in to leave comments.
Login now