ipython classic mode / precise pangolin
The Ubuntu do-release-upgrade
broke my ipython
classic mode. The
ipython package was upgraded, and apparently the configuration parser
was changed.
In bash, I want colors to help me find the beginning and end of output —
see this bug
report for
others agreeing with me that the derogatory comment about “focus should
be on the output, not on the prompt” in the skeleton .bashrc
is is
retared, but I diverge — in ipython, I just want to see the nice >>>
blocks that I’m used to and no extra spaces. I.e.: classic mode.
Previously, one could set classic 1
in ~/.ipythonrc
. Since the
upgrade, one should be able to fix it by editing
.config/ipython/profile_default/ipython_config.py
.
However, the fixes that the pages on google propose, do not work:
c.TerminalIPythonApp.classic = True
The following does work:
# Force classic mode!
c = get_config()
c.InteractiveShell.cache_size = 0
c.PlainTextFormatter.pprint = False
c.PromptManager.in_template = '>>> '
c.PromptManager.in2_template = '... '
c.PromptManager.out_template = ''
c.InteractiveShell.separate_in = ''
c.InteractiveShell.separate_out = ''
c.InteractiveShell.separate_out2 = ''
c.InteractiveShell.colors = 'NoColor'
c.InteractiveShell.xmode = 'Plain'
#
c.InteractiveShell.confirm_exit = False
#c.IPythonTerminalApp.display_banner = False
These settings are taken from the source where the --classic
option is
defined, so they should be ok.
Update 2012-06-07
If your django
shell does not show the right classic settings, you’re
probably running an old version.
Here, in the 1.3 branch and higher, the code looks like this:
def ipython(self):
try:
from IPython import embed
embed()
Previously that was this, and that doesn’t work, unless you pass default
config to TerminalInteractiveShell
from
IPython.frontend.terminal.ipapp.load_default_config
:
def ipython(self):
try:
from IPython.frontend.terminal.embed import TerminalInteractiveShell
shell = TerminalInteractiveShell()
shell.mainloop()
Just upgrade your django and be done.