##// END OF EJS Templates
Don't add ipython unconditionally to sys.path...
Don't add ipython unconditionally to sys.path Load ext will already do it with a context manager. This should remove false positive when import modules, whithout breaking functionalities. Maybe closes #13294 (making this part of 8.0 release make sens).

File last commit:

r22430:95ed0855
r27190:575be23d
Show More
cwd_prompt.py
26 lines | 616 B | text/x-python | PythonLexer
Matthias Bussonnier
Add some documentation on how to configure prompts.
r22430 """This is an example that shows how to create new prompts for IPython
"""
from IPython.terminal.prompts import Prompts, Token
import os
class MyPrompt(Prompts):
def in_prompt_tokens(self, cli=None):
return [(Token, os.getcwd()),
(Token.Prompt, '>>>')]
def load_ipython_extension(shell):
new_prompts = MyPrompt(shell)
new_prompts.old_prompts = shell.prompts
shell.prompts = new_prompts
def unload_ipython_extension(shell):
if not hasattr(shell.prompts, 'old_prompts'):
print("cannot unload")
else:
shell.prompts = shell.prompts.old_prompts