##// END OF EJS Templates
added example of configuring and embedded interpreter
Erich Spaker -
Show More
@@ -0,0 +1,22 b''
1 """Quick snippet explaining how to set config options when embedding ipython."""
2
3 # First create a config object from the traitlets library
4 from traitlets.config import Config
5 c = Config()
6
7 # Now we can set options as we would in a config file:
8 # c.Class.config_value = value
9 # For, example, we can set the exec_lines option of the InteractiveShellApp
10 # class to run some code when the IPython REPL starts
11 c.InteractiveShellApp.exec_lines = [
12 'print("\\nimporting some things\\n")',
13 'import math',
14 "math"
15 ]
16 c.InteractiveShell.colors = 'LightBG'
17 c.InteractiveShell.confirm_exit = False
18 c.TerminalIPythonApp.display_banner = False
19
20 # Now we start ipython with our configurtion
21 import IPython
22 IPython.start_ipython(config=c)
General Comments 0
You need to be logged in to leave comments. Login now