FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add flag for simple_prompt. by Carreau · Pull Request #9506 · ipython/ipython · GitHub

Repository navigation

Add flag for simple_prompt. - #9506

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

takluyver merged 2 commits into
ipython:masterfrom
Carreau:simple_prompt

Conversation

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 added this to the 5.0 milestone May 27, 2016

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"

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

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 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 commented May 31, 2016 •
edited
Loading

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

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.

Copy link
Copy Markdown
Member

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

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

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.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL