[IPython-dev] changing input_splitter from config
Sat Sep 8 17:24:15 CDT 2012
Only class attributes that have config=True set can be configured from
the command line or config files. In general, these are things that
have values of simple types such as strings, ints, bools, etc.
When you do:
c.InteractiveShellApp.input_splitter = SageIPythonInputSplitter()
You are not setting this attribute on the real InteractiveShellApp (I
think it would actually be InteractiveShell but thats a side point).
Instead you are setting the input_splitter attr on a special config
object that is used when the real InteractiveShell is created. What
you are wanting to do is fundamentally change how that object is built
so an extension is the only way to go.
I suppose we might be able to create a config=True
input_splitter_class attribute that could be set to
SageIPythonInputSplitter. Then you could set this in your config
files. I think that would be a pretty simple PR to put together. One
thing to be careful of though - the input splitter is used in multiple
locations in the code base you we would need to make sure that all of
those are changed to the same value.
On Sat, Sep 8, 2012 at 12:46 PM, Jason Grout
> Is it possible to change the input splitter from within the
> ipython_config.py file? I can successfully change it from a custom
> extension, but none of the variants I've tried in a config file seem to
> work. For example, in the ipython_config file:
> from IPython.core.inputsplitter import IPythonInputSplitter
> class SageIPythonInputSplitter(IPythonInputSplitter):
> def push(self, lines):
> print "push line"
> super(SageaIPythonInputSplitter, self).push(lines)
> # Execute the given command string.
> c.InteractiveShellApp.input_splitter = SageIPythonInputSplitter()
> IPython-dev mailing list
Brian E. Granger
Cal Poly State University, San Luis Obispo
firstname.lastname@example.org and email@example.com
More information about the IPython-dev