Skip to content

Add flag for simple_prompt.#9506

Merged
takluyver merged 2 commits into
ipython:masterfrom
Carreau:simple_prompt
Jun 1, 2016
Merged

Add flag for simple_prompt.#9506
takluyver merged 2 commits into
ipython:masterfrom
Carreau:simple_prompt

Conversation

@Carreau

@Carreau Carreau commented May 27, 2016

Copy link
Copy Markdown
Member

As this mode seem to be useful beyond testing, expose it via a flag and
make it official.

@Carreau Carreau added this to the 5.0 milestone May 27, 2016
@Carreau

Carreau commented May 27, 2016

Copy link
Copy Markdown
Member Author

@tacaswell would this flag name suits you ?

@takluyver Should we also check for os.environ["TERM"] == "dumb"

@tacaswell

Copy link
Copy Markdown
Contributor

I like 'simple-prompt'.

from .pt_inputhooks import get_inputhook_func
from .interactiveshell import get_default_editor, TerminalMagics

_use_simple_prompt = 'IPY_TEST_SIMPLE_PROMPT' in os.environ or not sys.stdin.isatty()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should probably override config, rather than providing the default value.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the command line flag should take precedence of the env variable, especially since it has the --no-simple-prompt alternative. IIRC that's how most of our commands works.

I'm fine changing if you still think it should be.

@takluyver

Copy link
Copy Markdown
Member

As #9487 was merged, we also need to make this switch affect the debugger. It can probably just change debugger_cls to the parent class from IPython.core.debugger, which is equivalently plain.

@Carreau Carreau self-assigned this May 27, 2016
Carreau added 2 commits May 31, 2016 13:33
As this mode seem to be useful beyond testing, expose it via a flag and
make it official.
@Carreau

Carreau commented May 31, 2016

Copy link
Copy Markdown
Member Author

As #9487 was merged, we also need to make this switch affect the debugger.

Yes.

It can probably just change debugger_cls to the parent class from IPython.core.debugger, which is equivalently plain.

Unsure what you mean exactly, I'm confused by the english construct, but gave it a try:

+    @observe('simple_prompt')
+    def _simple_prompt_changed(self, changes):
+        if changes['new'] == True:
+            self.debugger_cls = Pdb
+        else:
+            self.debugger_cls = TerminalPdb

@takluyver

Copy link
Copy Markdown
Member

That's basically what I meant, but I'd just change debugger_cls inside the if clause - simple_prompt can only take effect on startup anyway, so there's no need for traitlets' dynamism.

@takluyver

Copy link
Copy Markdown
Member

Since you won't be awake for several hours, I'm going to change it locally and merge.

@takluyver
takluyver merged commit b9ee485 into ipython:master Jun 1, 2016
@takluyver

Copy link
Copy Markdown
Member

I realised that init_prompt_toolkit_cli would be too late to change debugger_cls effectively, but I found another way to do it that I like more, using a property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants