[IPython-dev] changing input_splitter from config

Brian Granger ellisonbg at gmail.com
Sat Sep 8 18:24:15 EDT 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
<jason-sage at creativetrax.com> wrote:
> 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()
> Thanks,
> Jason
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com

More information about the IPython-dev mailing list