add `locate` entry points #1762

Merged
merged 3 commits into from Jun 10, 2012

Conversation

Projects
None yet
3 participants
Owner

minrk commented May 24, 2012

These would be useful for quickly locating IPython directories and profiles from other (non-Python) applications.

Examples:

$> ipython locate
/Users/me/.ipython

$> ipython locate profile foo
/Users/me/.ipython/profile_foo

$> ipython locate profile 
/Users/me/.ipython/profile_default

$> ipython locate profile dne
[ProfileLocate] Profile u'dne' not found.

locate profile is also available as profile locate, since that subcommand tree already exists.

Owner

takluyver commented May 24, 2012

Do we also have documentation on how to find them from Python code, i.e. starting from IPython.config import ...?

Owner

minrk commented May 24, 2012

For ipython_dir, absolutely, but I don't think there is a prominent mention for utils.path.locate_profile(name).

Owner

minrk commented May 31, 2012

I added a simple doc section describing these entry points, and the corresponding utility functions.

IPython/core/profileapp.py
@@ -85,6 +85,8 @@
_main_examples = """
ipython profile create -h # show the help string for the create subcommand
ipython profile list -h # show the help string for the list subcommand
+
+ipython profile locate foo # print the path to the directory for profile 'foo'
@takluyver

takluyver May 31, 2012

Owner

Is it deliberate to allow both ipython profile locate foo and ipython locate profile foo? It seems kind of unpythonic to offer two similar commands for the same thing.

@minrk

minrk Jun 6, 2012

Owner

It's in both because I didn't know which one to choose. If there were no other commands, locate profile foo makes more sense because it's an actual sentence. But we already have an ipython profile subtree of commands, so it seemed weird for it to not be there. I will add ipython locate profile foo to the ipython profile help, if you think that's best, and remove the ipython profile locate entry point.

@takluyver

takluyver Jun 7, 2012

Owner

OK - I'm fairly neutral on which is better, but I think I marginally prefer having the locate commands together, so I'd remove ipython profile locate. Adding a note in the help makes sense too.

@minrk

minrk Jun 7, 2012

Owner

ipython profile locate removed

Owner

takluyver commented May 31, 2012

Thanks, I think the doc section looks good.

Owner

fperez commented Jun 10, 2012

This looks very useful, and after the review and fixes I see no reason to delay it further. Thanks guys! Going in...

fperez added a commit that referenced this pull request Jun 10, 2012

Merge pull request #1762 from minrk/locate
Add `locate` entry points; these would be useful for quickly locating IPython directories and profiles from other (non-Python) applications.

Examples:

    $> ipython locate
    /Users/me/.ipython
    
    $> ipython locate profile foo
    /Users/me/.ipython/profile_foo
    
    $> ipython locate profile 
    /Users/me/.ipython/profile_default
    
    $> ipython locate profile dne
    [ProfileLocate] Profile u'dne' not found.

@fperez fperez merged commit 0d0d208 into ipython:master Jun 10, 2012

@minrk minrk deleted the minrk:locate branch Mar 31, 2014

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014

Merge pull request #1762 from minrk/locate
Add `locate` entry points; these would be useful for quickly locating IPython directories and profiles from other (non-Python) applications.

Examples:

    $> ipython locate
    /Users/me/.ipython
    
    $> ipython locate profile foo
    /Users/me/.ipython/profile_foo
    
    $> ipython locate profile 
    /Users/me/.ipython/profile_default
    
    $> ipython locate profile dne
    [ProfileLocate] Profile u'dne' not found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment