[IPython-dev] Embedded shell setup

Frédéric Mantegazza mantegazza at ill.fr
Tue Dec 1 07:12:20 EST 2015

Le 01/12/2015, Matthias a écrit :


> > config = IPython.config.loader.Config()
> > promptManager = config.PromptManager  
> I’m not sure this assignment will work, because of what the config
> object works. In doubt I would explicitly use
> config.PromptManager.in/out_template if you have issues. I would have to
> try and check that. 

Well, this part works fine (I found this syntax in the examples).

> > # profile is not loaded does not work!
> > config.profile = “pymad"  
> I’m not sure  what yo are trying to do. 
> I guess you might want to load a subconfia from another profile ?

Yes, exactly.

> https://ipython.org/ipython-doc/2/development/config.html?highlight=load_subconfig#configuration-files-inheritance
> InteractiveShellEmbed is not a subclass of BaseIPythonApplication, so it
> does not seem have a `profile` configuration. The way it works in
> IPython is TerminalIPythonApp in init_shell call the following:
>   def init_shell(self):
>         ...
>         self.shell = TerminalInteractiveShell.instance(parent=self,
>                         ..., profile_dir=self.profile_dir,
>                         ipython_dir=self.ipython_dir, ...)

Thanks for the link.

The files in the 'pymad' profile dir mainly contains magic commands we add
in the shell (these magic commands, combined with TPG - Toy Parser
Generator - gives us a set of dedicated commands to drive our

But I just found that these magic commands are now registered using
decorators, and can even be defined from classes, which is nice. So, I
rewrote this part, and finally drop the profile dir.

> I’m not familiar enough with completion, I know that holoview register
> its own completer:
> https://github.com/ioam/holoviews/blob/master/holoviews/ipython/magics.py#L697-L717
> it might be of help. 

Yes, it does!

BTW, where can one find the complete list of availables hooks names?

Thanks for your help, Matthias!

    Frédéric MANTEGAZZA             CEA-Grenoble
    Tel.     : 33 (0) 476 207 617   INAC/SPSMS/MDN
    Fax      : 33 (0) 476 483 906   17, rue des Martyrs
    Courriel : mantegazza at ill.fr    F-38054 Grenoble Cedex 09

More information about the IPython-dev mailing list