[IPython-dev] changing input_splitter from config
Jason Grout
jason-sage at creativetrax.com
Sat Sep 8 19:08:45 EDT 2012
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
More information about the IPython-dev
mailing list