[IPython-dev] ipython sphinx directive
Václav Šmilauer
eudoxos at arcig.cz
Sun Jan 10 05:42:34 EST 2010
Fernando Perez wrote:
>
> I've added this to a new branch I just made:
>
> https://code.launchpad.net/~ipython-dev/ipython/0.10.1
>
I found a problem with rc_override due to fact that
EmbeddedSphinxShell is instantiated at import time. This
patch works around the issue (diff'd against the branch
you mention):
--- ipython_directive.py.orig 2010-01-10 11:20:40.993799492 +0100
+++ ipython_directive.py 2010-01-10 11:28:29.863710962 +0100
@@ -25,6 +25,7 @@
prompt_in2=" .\D..",
prompt_out=" -> [\#]:"
)
+ id.reconfig_shell()
import ipython_console_highlighting as ich
ich.IPythonConsoleLexer.input_prompt=
@@ -213,7 +214,7 @@
argv, self.user_ns, self.user_glocal_ns, embedded=True,
#shell_class=IPython.Shell.InteractiveShell,
shell_class=MatplotlibShell,
- rc_override = dict(colors = 'NoColor'), **rc_override)
+ rc_override = dict(colors = 'NoColor', **rc_override))
self.input = ''
self.output = ''
@@ -402,6 +403,13 @@
# ipython_directive itself.
shell = EmbeddedSphinxShell()
+def reconfig_shell():
+ """Called after setting module-level variables to re-instantiate
+ with the set values (since shell is instantiated first at import-time
+ when module variables have default values)"""
+ global shell
+ shell = EmbeddedSphinxShell()
+
def ipython_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine,
--
View this message in context: http://old.nabble.com/ipython-sphinx-directive-tp26239546p27097074.html
Sent from the IPython - Development mailing list archive at Nabble.com.
More information about the IPython-dev
mailing list