Install and setup ipython for zope
I was demonstrated by Stefan (seletz) Eletzhofer how to run ipython as an interactive shell for Zope.
I was impressed enough by what he showed me to want to write some how-to about it and spread the info.
ipython can be used as a replacement to the zopectl debug command.
Install
First of all, we need to install ipython, you can use setup tools to install it from source, or install it from an egg.If you install it from an egg (assuming you have easy_install installed), you would simply key:
$ easy_install ipython
Which is easy enough, right?
Setup
Now we want to set it up for Zope.
Stefan wrote a custom setup profile for ipython.
it is hosted in the collective, under the dotipython project.
first go to the .ipython folder in your home directory:
$ cd ~/.ipython
If there is no .ipython in your home dir, launch ipython once and quit to have it created.
Then grab the file (here I use svn but you can use wget or download it with any web browser as it is a single file):
$ svn co http://svn.plone.org/svn/collective/dotipython/trunk/ipy_profile_zope.py .
It's all it needs really, now we can start our ipython session.
Usage
Zope needs some system environment to be set (INSTANCE_HOME and SOFTWARE_HOME).
We can do that by using the zopectl shell command:
$ cd ~/my/zope/instance $ ./bin/zopectl shell
make sure the setup is right:
$ echo $INSTANCE_HOME
Now all you need is to run the ipython shell with the profile we installed previously:
$ ipython -p zope
And you can start playing with it.
Links
Don't forget to have a look at iPython excellent documentation:
http://ipython.scipy.org/moin/Documentation
There are alternate ways to use iPython and the zope debugger. See those very good related links:
http://wiki.zope.org/zope2/DebuggingWithIPythonAndOtherTips
http://tomster.org/blog/archive/2006/10/09/ipython-as-zope-shell
And in french:
