Show More
@@ -784,17 +784,27 b' command-line options, as those are trapped first by Python itself.' | |||||
784 | Embedding IPython |
|
784 | Embedding IPython | |
785 | ================= |
|
785 | ================= | |
786 |
|
786 | |||
787 | It is possible to start an IPython instance inside your own Python |
|
787 | You can start a regular IPython session with | |
788 | programs. This allows you to evaluate dynamically the state of your |
|
788 | ||
789 | code, operate with your variables, analyze them, etc. Note however that |
|
789 | .. sourcecode:: python | |
|
790 | ||||
|
791 | import IPython | |||
|
792 | IPython.start_ipython() | |||
|
793 | ||||
|
794 | at any point in your program. This will load IPython configuration, | |||
|
795 | startup files, and everything, just as if it were a normal IPython session. | |||
|
796 | In addition to this, | |||
|
797 | it is possible to embed an IPython instance inside your own Python programs. | |||
|
798 | This allows you to evaluate dynamically the state of your code, | |||
|
799 | operate with your variables, analyze them, etc. Note however that | |||
790 | any changes you make to values while in the shell do not propagate back |
|
800 | any changes you make to values while in the shell do not propagate back | |
791 | to the running code, so it is safe to modify your values because you |
|
801 | to the running code, so it is safe to modify your values because you | |
792 | won't break your code in bizarre ways by doing so. |
|
802 | won't break your code in bizarre ways by doing so. | |
793 |
|
803 | |||
794 | .. note:: |
|
804 | .. note:: | |
795 |
|
805 | |||
796 |
At present, |
|
806 | At present, embedding IPython cannot be done from inside IPython. | |
797 | the code samples below outside IPython. |
|
807 | Run the code samples below outside IPython. | |
798 |
|
808 | |||
799 | This feature allows you to easily have a fully functional python |
|
809 | This feature allows you to easily have a fully functional python | |
800 | environment for doing object introspection anywhere in your code with a |
|
810 | environment for doing object introspection anywhere in your code with a |
@@ -63,6 +63,9 b' there is an official public API for starting IPython:' | |||||
63 |
|
63 | |||
64 | This is what packages should use that start their own IPython session, |
|
64 | This is what packages should use that start their own IPython session, | |
65 | but don't actually want embedded IPython (most cases). |
|
65 | but don't actually want embedded IPython (most cases). | |
|
66 | :func:`IPython.embed()` is used for embedding IPython into the calling namespace, | |||
|
67 | similar to calling :func:`Pdb.set_trace`, whereas :func:`start_ipython` | |||
|
68 | will start a plain IPython session, loading config and startup files as normal. | |||
66 |
|
69 | |||
67 | We also have added: |
|
70 | We also have added: | |
68 |
|
71 |
General Comments 0
You need to be logged in to leave comments.
Login now