15Defines a function embed() that can be used to drop into an interactive python
16shell from within a steering file or python module. If available, IPython will
17be used. Use Ctrl+D to exit the shell.
19 >>> import interactive
20 >>> interactive.embed()
23See framework/examples/interactive_python.py
for an example.
26from traitlets.config.loader import Config
27from IPython.terminal.prompts import Prompts, Token
28from IPython import embed
32 """Provide slightly customized prompts when running basf2 interactively"""
36 return [(Token.Prompt,
"basf2 in ["),
37 (Token.PromptNum, str(self.shell.execution_count)),
38 (Token.Prompt,
']: ')]
42 return [(Token.OutPrompt,
"basf2 out["),
43 (Token.OutPromptNum, str(self.shell.execution_count)),
44 (Token.OutPrompt,
']: ')]
47def basf2_shell_config():
48 """Return a config object customizing the shell prompt for basf2"""
50 c.TerminalInteractiveShell.prompts_class = Basf2IPythonPrompt
def out_prompt_tokens(self)
def in_prompt_tokens(self, cli=None)