Skip to content

Loading…

Remove %install_default_config and %install_profiles #1174

Closed
wants to merge 1 commit into from

3 participants

@tomspur

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

@tomspur tomspur 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
@fperez
IPython member

@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.

@minrk
IPython member

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.

@fperez
IPython member

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).

@minrk
IPython member

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.

@fperez
IPython member
@tomspur

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...

@minrk
IPython member

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.

@fperez
IPython member

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'.

@minrk
IPython member

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.

@minrk
IPython member

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.

@fperez
IPython member

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.
@minrk
IPython member

Sounds good, see PR #1176 for sample output.

@fperez
IPython member

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

@minrk
IPython member

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

@fperez
IPython member

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

@minrk
IPython member

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

@fperez
IPython member

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

@fperez
IPython member

@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.

@minrk
IPython member

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

@fperez
IPython member

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

@minrk minrk added a commit that closed this pull request
@tomspur tomspur 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
@minrk minrk closed this in ac1e66f
@minrk minrk added a commit that referenced this pull request
@minrk minrk Merge PR #1174 (remove profile magics)
replaces broken %install_profiles and %install_default_config magics
with simple print statements.

closes #1174
2c5f256
@minrk minrk added a commit that closed this pull request
@minrk minrk Merge PR #1174 (remove profile magics)
replaces broken %install_profiles and %install_default_config magics
with simple print statements.

closes #1174
2c5f256
@minrk minrk closed this in 2c5f256
@minrk
IPython member

merged

@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request
@tomspur tomspur 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>
275618a
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request
@minrk minrk Merge PR #1174 (remove profile magics)
replaces broken %install_profiles and %install_default_config magics
with simple print statements.

closes #1174
5c00199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 18, 2011
  1. @tomspur

    Remove %install_default_config and %install_profiles

    tomspur committed
    as they are now controllen with "ipython profile" commands.
    
    closes #1174 and Redhad bug #751146
    
    Signed-off-by: Thomas Spura <thomas.spura@gmail.com>
Showing with 0 additions and 44 deletions.
  1. +0 −44 IPython/core/magic.py
View
44 IPython/core/magic.py
@@ -3360,50 +3360,6 @@ def magic_reload_ext(self, module_str):
"""Reload an IPython extension by its module name."""
self.extension_manager.reload_extension(module_str)
- @skip_doctest
- def magic_install_profiles(self, s):
- """Install the default IPython profiles into the .ipython dir.
-
- If the default profiles have already been installed, they will not
- be overwritten. You can force overwriting them by using the ``-o``
- option::
-
- In [1]: %install_profiles -o
- """
- 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 src in os.listdir(profile_dir):
- if src.startswith('profile_'):
- name = src.replace('profile_', '')
- print " %s"%name
- pd = ProfileDir.create_profile_dir_by_name(ipython_dir, name)
- pd.copy_config_file('ipython_config.py', path=src,
- overwrite=overwrite)
-
- @skip_doctest
- def magic_install_default_config(self, s):
- """Install IPython's default config file into the .ipython dir.
-
- If the default config file (:file:`ipython_config.py`) is already
- installed, it will not be overwritten. You can force overwriting
- by using the ``-o`` option::
-
- In [1]: %install_default_config
- """
- if '-o' in s:
- overwrite = True
- else:
- overwrite = False
- pd = self.shell.profile_dir
- print "Installing default config file in: %s" % pd.location
- pd.copy_config_file('ipython_config.py', overwrite=overwrite)
-
# Pylab support: simple wrappers that activate pylab, load gui input
# handling and modify slightly %run
Something went wrong with that request. Please try again.