[IPython-dev] changing input_splitter from config

Brian Granger ellisonbg at gmail.com
Sat Sep 8 20:31:15 EDT 2012

One other factor:

If you want that bit of configuration to be easily usable by a lot of
people, then putting it into an extension is definitely the way to go.

On Sat, Sep 8, 2012 at 4:08 PM, Jason Grout <jason-sage at creativetrax.com> wrote:
> On 9/8/12 5:24 PM, Brian Granger wrote:
>> 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.
> Thanks for the explanation!
> It's not a problem for me to do it in an extension.  I have to load some
> magics and set up a few other things in an extension anyway, so I can
> set the input splitter there too.  It just looked to me like I should be
> able to configure it from the profile, and then I was puzzled why it
> wasn't working.
> I have to say I'm really impressed (again) with the hook system and the
> config system.  I'm trying to shift all of the Sage customizations into
> either a config file or an extension (i.e., a combination of both), and
> so far, it's working out nicely.  (And it's fairly simple thanks to the
> work other Sage devs did already in a first pass at migrating to the
> newest ipython [1]).
> Thanks,
> Jason
> [1] http://trac.sagemath.org/sage_trac/ticket/12719
> _______________________________________________
> 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