[IPython-user] pylab and embedded IPython

Michael Foord fuzzyman at voidspace.org.uk
Thu Apr 13 08:45:32 CDT 2006


Ville Vainio wrote:
> On 4/12/06, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
>
>   
>> * Being able to set the ipythondir (sending ['-ipythondir', libdir] as
>> the first argument)
>> * Being able to set a banner
>> * Running in a namespace (pass in a locals and globals dictinary)
>>     
>
> Banner should be easy, see ipy_profile_sh.py for an example.
>
>   
Ok, thanks.

>> Looking in Shell.py, when '-pylab' is passed in, the class returned by
>> ``_matplotlib_shell_class`` is used. I can't see how to pass in a
>> namespace here - ``user_global_ns`` and ``user_ns`` don't seem to do it.
>>     
>
> Line 132 of Shell.py worries me a bit:
>
>         # FIXME. Passing user_ns breaks namespace handling.
>         #self.IP = make_IPython(argv,user_ns=__main__.__dict__)
>         self.IP = make_IPython(argv,rc_override=rc_override,embedded=True)
>
> Perhaps Fernando could enlighten us on this?
>
>   
>> Is it possible to expose this functionality (or even some of it) ?
>>     
>
> I'm down with exposing the functionality and can take a look at it
> (but please have a look at it yourself also, patches appreciated).
> Most configuration should be doable by executing IPython.ipapi
> commands (see files in UserConfig) after instantiating the shell, but
> the namespace thing is more problematic.
>   
I'm happy to work on it as well. However, the *most* important function 
for me is being able to pass a namespace in. I'll wait and see what 
Fernando says about this.

At the moment I've just added pylab support by using the following 
(without it working in the users namespace) :

    IPython.Shell.start().mainloop()

When '-pylab' is in sys.argv, this 'does the right thing'.

All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

> --
> Ville Vainio - vivainio.googlepages.com
> vainio.blogspot.com - g[mail | talk]='vivainio'
>
>   




More information about the IPython-user mailing list