Skip to content
This repository

Remove %install_default_config and %install_profiles #1174

Closed
wants to merge 1 commit into from

3 participants

Thomas Spura Fernando Perez Min RK
Thomas Spura

as they are now controllen with "ipython profile" commands.

Thomas Spura Remove %install_default_config and %install_profiles
as they are now controllen with "ipython profile" commands.

closes #1174 and Redhad bug #751146

Signed-off-by: Thomas Spura <thomas.spura@gmail.com>
917b76c
Fernando Perez
Owner

@takluyver, @minrk: if you guys can have a look at this, go for it. I have to finish a talk for work today and will barely make all the last-minute work for the actual release.

Min RK
Owner

Sure, though I think these were added at your request, so this would remove the (obvious, easy) ability to generate the default config files from IPython.

Fernando Perez
Owner

Mmhh... I don't recall, but still, it's a good point. The question is: when we added this, did we have any mechanism at all other than manual copying of files and directories? I think we didn't, so a magic seemed like a good solution. Furthermore, I don't think our old system recognized profiles that were kept in the ipython directory, only those that had been made available to the user.

Now that users can specify with --profile a profile that they haven't installed locally, it seems to me that there is much less need to offer to install profiles in their personal area (if anything, there's less incentive, as by not installing their personal copies they benefit from updates we make to the shipped ones).

Min RK
Owner

An alternative, if we want to fix this behavior, would be:

loc = self.shell.profile_dir.location
cmd = ["ipython", "profile", "create", "--ProfileDir.location=%r" % loc]
if '-o' in s:
    cmd += '--reset'
subprocess.call(cmd)

And for %install_profiles:

if '-o' in s:
    overwrite = True
else:
    overwrite = False
from IPython.config import profile
profile_dir = os.path.dirname(profile.__file__)
ipython_dir = self.ipython_dir
print "Installing profiles to: %s [overwrite=%s]"%(ipython_dir,overwrite)
for name in os.listdir(profile_dir):
    src = os.path.join(profile_dir, name)
    files = glob.glob(os.path.join(src, "*.py"))
    if files:
        print "    %s" % name
        pd = ProfileDir.create_profile_dir_by_name(ipython_dir, name)
        for fname in [ os.path.basename(f) for f in files ]:
            pd.copy_config_file(fname, path=src, overwrite=overwrite)

If we do remove these magics, we should probably skim the docs for mentions, so we aren't pointing to them anymore.

Fernando Perez
Owner
Thomas Spura

Pointing to the new profile behavior would be fine too.

I'd delete them and point it out in the release notes, so people can find it through your favorite search engine.
But pointing to the new profile behavior for a few releases and then it can be cleaned up is fine too...

Min RK
Owner

I like the print statement. ipython profile create is definitely better than the %install_default_config, but we don't really have an analog to %install_profiles, which stages all the bundled profiles. That said, I'm not sure how many people actually care about that one, as you can just use profiles, and the first time you ask for them, the default is staged.

Fernando Perez
Owner

I'd be OK with %install_profiles being replaced also with a print statement that explains how one can use any bundled profile. I'm not sure there's much value/need for the 'dump all profiles automatically to my ipython dir'.

Min RK
Owner

The only advantage I see of %install_profiles is that it affects the output of ipython profile list to see everything available, but I'm not sure anyone uses that, not least of all because I just saw that the output was actually never fixed since we changed the way we specify args prior to 0.11 release.

It is currently the only easy way we have of seeing what the list of bundled profiles is. But since it would appear that people aren't really using it that way, I don't think anyone would be sad to see it go.

Min RK
Owner

I should also clarify that viewing the available bundled profiles is the only benefit to %install_profiles. There is exactly no difference between doing ipython --profile=sympy before/after %install_profiles, because bundled config is staged on first request of the profile anyway.

Fernando Perez
Owner

Shouldn't we then instead just fix profile list to show the existing ones from IPython? I imagine something like

ipython profile list

Available profiles in IPython:
- foo
- bar

Available profiles in /path/to/your/config/ipython:
-baz
-zap

Local profiles in the current directory (/path/to/cwd):
- x
- y

Note: you can use any of these by using `ipython profile --profile <name>`; 
if it is one of those within ipython it will be automatically staged in your 
config directory.
Min RK
Owner

Sounds good, see PR #1176 for sample output.

Fernando Perez
Owner

I like #1176 a lot, so I guess the plan will be to merge this and also 1176, right?

Min RK
Owner

Yes, I think so. Do we want print-statements on the removed magics, or just remove them?

Fernando Perez
Owner

Let's do print statements, to help users who might know about them transition more easily.

Min RK
Owner

Also, searching our docs suggests that we never even mentioned these magics, so there shouldn't be anything to change/update there.

Fernando Perez
Owner

Great, thanks. Just a quick print statement is enough then.

Fernando Perez
Owner

@minrk, can you take a shot at this one? I should be done with my talk shortly and will start writing up the release notes and example notebooks. I'd love a hand with this code.

Min RK
Owner

Sure, should I go ahead and merge with the added print statements, or do a quick PR?

Fernando Perez
Owner

I'm ok with a merge, but if you prefer to keep the PR workflow, I can look at it too.

Min RK minrk closed this pull request from a commit December 18, 2011
Thomas Spura Remove %install_default_config and %install_profiles
as they are now controllen with "ipython profile" commands.

closes #1174 and Redhad bug #751146

Signed-off-by: Thomas Spura <thomas.spura@gmail.com>
ac1e66f
Min RK minrk closed this in ac1e66f December 18, 2011
Min RK minrk referenced this pull request from a commit December 18, 2011
Min RK Merge PR #1174 (remove profile magics)
replaces broken %install_profiles and %install_default_config magics
with simple print statements.

closes #1174
2c5f256
Min RK minrk closed this pull request from a commit December 18, 2011
Min RK Merge PR #1174 (remove profile magics)
replaces broken %install_profiles and %install_default_config magics
with simple print statements.

closes #1174
2c5f256
Min RK minrk closed this in 2c5f256 December 18, 2011
Min RK
Owner

merged

Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Dec 18, 2011
Thomas Spura Remove %install_default_config and %install_profiles
as they are now controllen with "ipython profile" commands.

closes #1174 and Redhad bug #751146

Signed-off-by: Thomas Spura <thomas.spura@gmail.com>
917b76c
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 0 additions and 44 deletions. Show diff stats Hide diff stats

  1. 44  IPython/core/magic.py
44  IPython/core/magic.py
@@ -3360,50 +3360,6 @@ def magic_reload_ext(self, module_str):
3360 3360
         """Reload an IPython extension by its module name."""
3361 3361
         self.extension_manager.reload_extension(module_str)
3362 3362
 
3363  
-    @skip_doctest
3364  
-    def magic_install_profiles(self, s):
3365  
-        """Install the default IPython profiles into the .ipython dir.
3366  
-
3367  
-        If the default profiles have already been installed, they will not
3368  
-        be overwritten. You can force overwriting them by using the ``-o``
3369  
-        option::
3370  
-
3371  
-            In [1]: %install_profiles -o
3372  
-        """
3373  
-        if '-o' in s:
3374  
-            overwrite = True
3375  
-        else:
3376  
-            overwrite = False
3377  
-        from IPython.config import profile
3378  
-        profile_dir = os.path.dirname(profile.__file__)
3379  
-        ipython_dir = self.ipython_dir
3380  
-        print "Installing profiles to: %s [overwrite=%s]"%(ipython_dir,overwrite)
3381  
-        for src in os.listdir(profile_dir):
3382  
-            if src.startswith('profile_'):
3383  
-                name = src.replace('profile_', '')
3384  
-                print "    %s"%name
3385  
-                pd = ProfileDir.create_profile_dir_by_name(ipython_dir, name)
3386  
-                pd.copy_config_file('ipython_config.py', path=src,
3387  
-                                overwrite=overwrite)
3388  
-
3389  
-    @skip_doctest
3390  
-    def magic_install_default_config(self, s):
3391  
-        """Install IPython's default config file into the .ipython dir.
3392  
-
3393  
-        If the default config file (:file:`ipython_config.py`) is already
3394  
-        installed, it will not be overwritten. You can force overwriting
3395  
-        by using the ``-o`` option::
3396  
-
3397  
-            In [1]: %install_default_config
3398  
-        """
3399  
-        if '-o' in s:
3400  
-            overwrite = True
3401  
-        else:
3402  
-            overwrite = False
3403  
-        pd = self.shell.profile_dir
3404  
-        print "Installing default config file in: %s" % pd.location
3405  
-        pd.copy_config_file('ipython_config.py', overwrite=overwrite)
3406  
-
3407 3363
     # Pylab support: simple wrappers that activate pylab, load gui input
3408 3364
     # handling and modify slightly %run
3409 3365
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.