Skip to content
This repository

We're ignoring prompt customizations #1075

Closed
fperez opened this Issue November 30, 2011 · 10 comments

3 participants

Fernando Perez Gökhan Sever Min RK
Fernando Perez
Owner

Reported on the user list and I confirmed it:

This is with Python 2.7, IPython 0.12.beta (a checkout about an hour ago)

I have these following lines in my ipython_config.py

c.TerminalInteractiveShell.prompt_in1 = 'I\\# '
c.TerminalInteractiveShell.prompt_out = 'O\\# '

But IPython shows prompts in its way:

In [1]: a = 5

In [2]: a
Out[2]: 5

This is definitely a blocker, lots of people customize their prompts so we shouldn't release with this broken.

Gökhan Sever

Thanks for carrying the email report here. Interestingly, changing the lines from /IPython/core/interactiveshell.py as

prompt_in1 = Unicode('I\\# ', config=True)
prompt_out = Unicode('O\\# ', config=True)

does not make any difference. I wonder where else IPython loading these defaults?

Fernando Perez
Owner

Not sure; @takluyver, is it possible that the recent prompt reorg in #507 broke things here? I haven't bisected the problem yet, unfortunately I can't do it right now...

Min RK
Owner

Wasn't this the whole point of the PromptManager? prompts are not traits of the InteractiveShell anymore, they are now traits of the PromptManager:

c.PromptManager.in_template = 'I\\#'
c.PromptManager.out_template = 'O\\#'

The prompt_foo traits of the InteractiveShell shouldn't even exist anymore.

Gökhan Sever

These adds an extra tab before I and O characters. By the way, how to get config object from within IPython?

c = get_config()

Where is this get_config is imported from?

Fernando Perez
Owner
Min RK
Owner

get_config is not imported from anywhere, it's defined interactively, but you can get the config object from the IPython instance with:

c = get_ipython().config

The extra indentation is because the PromptManager right-aligns all prompts to the longest one, so you either have to set PromptManager.justify=False, or make sure that none of the prompts are longer than your input (rewrite is the most likely to be too long).

There seem to be a few issues with the PromptManager. We should probably have had a transition plan in place for before merging a major reorganization of config like this.

Min RK
Owner

Yes, absolutely - there are a number of places this needs to be fixed. Should we leave the InteractiveShell.prompt traits with a deprecation warning, or just remove them and leave users to their own devices?

Min RK
Owner

See #1078 for some fixes. The old traits still exist and work, but point to the new ones shouting about deprecation if you use them. Various references to the old traits in tests, docs, examples, etc. also fixed.

Fernando Perez
Owner

Thanks, I like the approach you took re. deprecation and trait redirection; see my comments in the PR regarding the indentation. I can't work on it tonight, but if you don't get to it or @takluyver doesn't do it, I can also help finish it and recover the behavior we had before. @gsever, we'll only close this issue when that's fully addressed.

Gökhan Sever

The solutions provided by @minrk fixes the I/O prompt customization problem for me. Thanks for the comments on the issue.

Fernando Perez fperez closed this in 4b8920a December 01, 2011
Fernando Perez fperez referenced this issue 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
Something went wrong with that request. Please try again.