Friday, April 5, 2013

ipython went and changed the way they do configuration files

When I start ipython, I get a much longer returned message than I should:

ipython
/usr/lib/python2.7/dist-packages/IPython/utils/path.py:420: UserWarning: Found old IPython config file u'/home/rperry/.ipython/ipy_user_conf.py' (modified by user)
  warnings.warn("Found old IPython config file %r (modified by user)"%f)
/usr/lib/python2.7/dist-packages/IPython/utils/path.py:420: UserWarning: Found old IPython config file u'/home/rperry/.ipython/ipythonrc' (modified by user)
  warnings.warn("Found old IPython config file %r (modified by user)"%f)
/usr/lib/python2.7/dist-packages/IPython/utils/path.py:432: UserWarning:
  The IPython configuration system has changed as of 0.11, and these files will
  be ignored. See http://ipython.github.com/ipython-doc/dev/config for details
  of the new config system.
  To start configuring IPython, do `ipython profile create`, and edit
  `ipython_config.py` in <ipython_dir>/profile_default.
  If you need to leave the old config files in place for an older version of
  IPython and want to suppress this warning message, set
  `c.InteractiveShellApp.ignore_old_config=True` in the new config.
  `c.InteractiveShellApp.ignore_old_config=True` in the new config.""")
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
Type "copyright", "credits" or "license" for more information.

IPython 0.12.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.


So the problem here is that when I had an older version of ipython, I made some config files-- apparently ipy_user_conf.py, and ipythonrc which are not outdated by my current ipython 0.12.1. What were those configuration files doing anyways? How do I change the configurations in the current version? I'll find out!

ipy_user_conf.py seems to be all factory settings. I removed it:
rm -r ipy_user_conf.py
ipythonrc seems to be all factory settings. I removed it:
rm -r ipythonrc

Now when I start ipython, I don't get so much text returned!
ipythonPython 2.7.3 (default, Aug  1 2012, 05:14:39)
Type "copyright", "credits" or "license" for more information.

IPython 0.12.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.




But, what configurations can I modify if I want to? Following the directions from the original, lengthy printout to the screen:
ipython profile create
creates
~/.ipython/profile_default/ipython_config.py which can be modified

there is also a startup directory in which you can place python scripts that you want run every time you start ipython!
~/.ipython/profile_default/startup (there is a README there explaining)
I put a script there that says:
import holopy as hp
this will make startup slower, but I won't have to type that again!!! Plus, if I just want a python session to use as a simple calculator, then I can always just run:
python instead of ipython.

You can make non-default configurations as well... for now, I'll just stick to the one. Hopefully I won't be bothered by the extra time it takes to start ipython.

No comments:

Post a Comment