From cc93d67a134a0fe4bbad77dd96fdb28c43fd3c26 2017-08-01 20:36:20 From: Erich Spaker Date: 2017-08-01 20:36:20 Subject: [PATCH] Added embedded configuration to docs --- diff --git a/docs/source/config/intro.rst b/docs/source/config/intro.rst index d3ab800..c79b70f 100644 --- a/docs/source/config/intro.rst +++ b/docs/source/config/intro.rst @@ -112,6 +112,18 @@ At present, this only affects the current session - changes you make to config are not saved anywhere. Also, some options are only read when IPython starts, so they can't be changed like this. +.. _configure_embedded: + +Configuring embedded IPython +---------------------------- + +If you are :ref:`Embedding`, you can set configuration options the same +way as in a config file by creating a traitlets config object and passing +it to start_ipython like in the example below. + +.. literalinclude:: ../../../examples/Embedding/embed_configured.py + :language: python + .. _profiles: Profiles diff --git a/docs/source/interactive/reference.rst b/docs/source/interactive/reference.rst index e79d713..ec2d6d1 100644 --- a/docs/source/interactive/reference.rst +++ b/docs/source/interactive/reference.rst @@ -671,6 +671,9 @@ code fragments in your programs which are ready for cut and paste: .. literalinclude:: ../../../examples/Embedding/embed_class_short.py :language: python +For more information on setting configuration options for an embedded +IPython instance, see :ref:`configure_embedded`. + Using the Python debugger (pdb) =============================== diff --git a/examples/Embedding/embed_configured.py b/examples/Embedding/embed_configured.py index 86be1a5..8f9138a 100755 --- a/examples/Embedding/embed_configured.py +++ b/examples/Embedding/embed_configured.py @@ -6,7 +6,7 @@ c = Config() # Now we can set options as we would in a config file: # c.Class.config_value = value -# For, example, we can set the exec_lines option of the InteractiveShellApp +# For example, we can set the exec_lines option of the InteractiveShellApp # class to run some code when the IPython REPL starts c.InteractiveShellApp.exec_lines = [ 'print("\\nimporting some things\\n")', @@ -17,6 +17,6 @@ c.InteractiveShell.colors = 'LightBG' c.InteractiveShell.confirm_exit = False c.TerminalIPythonApp.display_banner = False -# Now we start ipython with our configurtion +# Now we start ipython with our configuration import IPython IPython.start_ipython(config=c)